app.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804
  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: {
  1600. asset: {
  1601. type: Object,
  1602. required: true
  1603. }
  1604. },
  1605. mounted: function mounted() {
  1606. var _this = this;
  1607. Echo.channel('asset.' + this.asset.pcid).listen('AssetUpdated', function (e) {
  1608. _this.asset = e.data;
  1609. });
  1610. }
  1611. });
  1612. /***/ }),
  1613. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1614. /*!*****************************************************************************************************************************************************************************!*\
  1615. !*** ./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& ***!
  1616. \*****************************************************************************************************************************************************************************/
  1617. /*! exports provided: default */
  1618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1619. "use strict";
  1620. __webpack_require__.r(__webpack_exports__);
  1621. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1622. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  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. //
  1668. //
  1669. //
  1670. //
  1671. //
  1672. /* harmony default export */ __webpack_exports__["default"] = ({
  1673. components: {
  1674. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1675. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1676. },
  1677. props: {
  1678. populateWith: {
  1679. type: Object,
  1680. required: true
  1681. },
  1682. modalId: {
  1683. type: String,
  1684. required: true
  1685. }
  1686. },
  1687. data: function data() {
  1688. return {
  1689. // Essentially makes a copy of the object. Otherwise
  1690. // We would have a reference to the exising object causing
  1691. // unwanted mutations in the parent component.
  1692. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1693. assetSaving: false
  1694. };
  1695. },
  1696. methods: {
  1697. updateAsset: function updateAsset() {
  1698. var _this = this;
  1699. this.assetSaving = true;
  1700. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1701. _this.assetSaving = false;
  1702. $("#".concat(_this.modalId)).modal('hide');
  1703. })["catch"](function (error) {
  1704. _this.assetSaving = false;
  1705. });
  1706. }
  1707. }
  1708. });
  1709. /***/ }),
  1710. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1711. /*!*************************************************************************************************************************************************************************************!*\
  1712. !*** ./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& ***!
  1713. \*************************************************************************************************************************************************************************************/
  1714. /*! exports provided: default */
  1715. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1716. "use strict";
  1717. __webpack_require__.r(__webpack_exports__);
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. /* harmony default export */ __webpack_exports__["default"] = ({
  1740. props: {
  1741. value: null,
  1742. // An object with the following format
  1743. // {
  1744. // key: value,
  1745. // key: value,
  1746. // }
  1747. options: {
  1748. type: Object,
  1749. required: true
  1750. },
  1751. allowCustom: {
  1752. type: Boolean,
  1753. "default": false
  1754. }
  1755. },
  1756. data: function data() {
  1757. return {
  1758. searchText: '',
  1759. selectedOption: null,
  1760. open: false,
  1761. // allows for checking whether button was clicked or text was typed.
  1762. // If button was clicked, we show all options without having to clear
  1763. // out any searchText that was autofilled when page loaded.
  1764. isSearching: false
  1765. };
  1766. },
  1767. computed: {
  1768. matches: function matches() {
  1769. var _this = this;
  1770. // If button was clicked, show all options, if typing, filter
  1771. // options based on searchText
  1772. return Object.entries(this.options).filter(function (option) {
  1773. var optionText = option[1].toUpperCase();
  1774. if (_this.isSearching) {
  1775. return optionText.match(_this.searchText.toUpperCase());
  1776. } else {
  1777. return optionText.match('');
  1778. }
  1779. });
  1780. }
  1781. },
  1782. methods: {
  1783. // if button is clicked, show all options
  1784. setOpen: function setOpen(isOpen) {
  1785. this.open = isOpen;
  1786. this.isSearching = false;
  1787. },
  1788. // if typing in the box, start filtering options
  1789. searchChanged: function searchChanged() {
  1790. if (!this.open) {
  1791. this.open = true;
  1792. }
  1793. if (!this.isSearching) {
  1794. this.isSearching = true;
  1795. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1796. if (this.allowCustom) {
  1797. this.$emit('input', {
  1798. 'id': 'custom',
  1799. 'name': this.searchText
  1800. });
  1801. }
  1802. },
  1803. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1804. // a suggestion is selected
  1805. suggestionSelected: function suggestionSelected(suggestion) {
  1806. this.open = false;
  1807. this.searchText = suggestion[1];
  1808. this.$emit('input', {
  1809. 'id': suggestion[0],
  1810. 'name': suggestion[1]
  1811. });
  1812. },
  1813. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1814. if (this.allowCustom) {
  1815. this.searchText = this.value.name;
  1816. } else {
  1817. if (newValue.id > -1) {
  1818. // Find the matching text for the supplied option value
  1819. for (var id in this.options) {
  1820. if (this.options.hasOwnProperty(id)) {
  1821. if (this.options[id] === this.options[newValue.id]) {
  1822. this.searchText = this.options[id];
  1823. }
  1824. }
  1825. }
  1826. }
  1827. }
  1828. }
  1829. },
  1830. mounted: function mounted() {
  1831. this.updateComponentWithValue(this.value);
  1832. },
  1833. watch: {
  1834. value: function value(newValue) {
  1835. this.updateComponentWithValue(newValue);
  1836. }
  1837. }
  1838. });
  1839. /***/ }),
  1840. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1841. /*!************************************************************************************************************************************************************************!*\
  1842. !*** ./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& ***!
  1843. \************************************************************************************************************************************************************************/
  1844. /*! exports provided: default */
  1845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1846. "use strict";
  1847. __webpack_require__.r(__webpack_exports__);
  1848. //
  1849. //
  1850. //
  1851. //
  1852. /* harmony default export */ __webpack_exports__["default"] = ({
  1853. name: 'IntersectingCirclesSpinner',
  1854. props: {
  1855. color: {
  1856. type: String,
  1857. "default": '#fff'
  1858. },
  1859. size: {
  1860. type: String,
  1861. "default": '10'
  1862. }
  1863. }
  1864. });
  1865. /***/ }),
  1866. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1867. /*!*********************************************************************************************************************************************************************!*\
  1868. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  1869. \*********************************************************************************************************************************************************************/
  1870. /*! exports provided: default */
  1871. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1872. "use strict";
  1873. __webpack_require__.r(__webpack_exports__);
  1874. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1875. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. //
  1919. /* harmony default export */ __webpack_exports__["default"] = ({
  1920. components: {
  1921. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1922. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1923. },
  1924. props: {
  1925. credential: {
  1926. type: Object,
  1927. required: true
  1928. },
  1929. descriptions: {
  1930. type: Array,
  1931. required: true
  1932. }
  1933. },
  1934. data: function data() {
  1935. return {
  1936. data: this.credential,
  1937. creddescList: this.descriptions
  1938. };
  1939. },
  1940. mounted: function mounted() {
  1941. var _this = this;
  1942. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  1943. _this.data = e.credential;
  1944. });
  1945. },
  1946. methods: {
  1947. deleteCredential: function deleteCredential() {
  1948. var _this2 = this;
  1949. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1950. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1951. })["catch"](function (error) {
  1952. console.error(error);
  1953. });
  1954. }
  1955. }
  1956. });
  1957. /***/ }),
  1958. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1959. /*!******************************************************************************************************************************************************************************!*\
  1960. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  1961. \******************************************************************************************************************************************************************************/
  1962. /*! exports provided: default */
  1963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1964. "use strict";
  1965. __webpack_require__.r(__webpack_exports__);
  1966. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1967. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. /* harmony default export */ __webpack_exports__["default"] = ({
  1995. components: {
  1996. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1997. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1998. },
  1999. props: {
  2000. populateWith: {
  2001. type: Object,
  2002. "default": function _default() {
  2003. return {
  2004. creddesc: null,
  2005. creduser: null,
  2006. credpass: null,
  2007. groupid: null,
  2008. pcid: null,
  2009. credtype: null
  2010. };
  2011. }
  2012. },
  2013. modalId: {
  2014. type: String,
  2015. required: true
  2016. },
  2017. descriptions: {
  2018. type: Object,
  2019. required: true
  2020. },
  2021. create: {
  2022. type: Boolean
  2023. },
  2024. pcid: {
  2025. type: Number
  2026. },
  2027. groupid: {
  2028. type: Number
  2029. }
  2030. },
  2031. data: function data() {
  2032. return {
  2033. data: JSON.parse(JSON.stringify(this.populateWith)),
  2034. creddesc: {},
  2035. id: this.modalId,
  2036. errors: []
  2037. };
  2038. },
  2039. mounted: function mounted() {
  2040. this.creddesc = {
  2041. 'id': this.data.credtype,
  2042. 'name': this.data.creddesc
  2043. };
  2044. },
  2045. methods: {
  2046. rndStr: function rndStr(len) {
  2047. var text = "";
  2048. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2049. for (var i = 0; i < len; i++) {
  2050. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2051. }
  2052. return text;
  2053. },
  2054. getRandomPassword: function getRandomPassword(id) {
  2055. this.data.credpass = this.rndStr(16);
  2056. },
  2057. updateCredential: function updateCredential() {
  2058. var _this = this;
  2059. if (this.creddesc.id === "custom") {
  2060. this.data.credtype = 1;
  2061. this.data.creddesc = this.creddesc.name;
  2062. } else {
  2063. this.data.credtype = this.creddesc.id;
  2064. this.data.creddesc = this.creddesc.name;
  2065. }
  2066. if (this.create) {
  2067. if (this.pcid) {
  2068. this.data.pcid = this.pcid;
  2069. }
  2070. if (this.groupid) {
  2071. this.data.groupid = this.groupid;
  2072. }
  2073. axios.post('/api/credentials/', this.data).then(function (response) {
  2074. $('#' + _this.id).modal('hide');
  2075. });
  2076. } else {
  2077. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2078. $('#' + _this.id).modal('hide');
  2079. })["catch"](function (error) {
  2080. console.error(error);
  2081. });
  2082. }
  2083. }
  2084. }
  2085. });
  2086. /***/ }),
  2087. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2088. /*!*************************************************************************************************************************************************************************!*\
  2089. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  2090. \*************************************************************************************************************************************************************************/
  2091. /*! exports provided: default */
  2092. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2093. "use strict";
  2094. __webpack_require__.r(__webpack_exports__);
  2095. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2096. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2097. //
  2098. //
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. /* harmony default export */ __webpack_exports__["default"] = ({
  2107. components: {
  2108. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2109. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2110. },
  2111. props: {
  2112. credentials: {
  2113. type: Array,
  2114. required: true
  2115. },
  2116. descriptions: {
  2117. type: Array,
  2118. required: true
  2119. },
  2120. pcid: {
  2121. type: Number
  2122. },
  2123. groupid: {
  2124. type: Number
  2125. }
  2126. },
  2127. computed: {
  2128. creddescList: function creddescList() {
  2129. var list = {};
  2130. this.descriptions.map(function (val) {
  2131. list[val.creddescid] = val.credtitle;
  2132. });
  2133. return list;
  2134. }
  2135. },
  2136. methods: {
  2137. deleteCred: function deleteCred(index) {
  2138. this.credentials.splice(index, 1);
  2139. }
  2140. },
  2141. mounted: function mounted() {
  2142. var _this = this;
  2143. if (this.pcid) {
  2144. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2145. var deletedCred = e.credential;
  2146. var index = _this.credentials.findIndex(function (credential) {
  2147. return credential.credid === deletedCred['credid'];
  2148. });
  2149. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2150. _this.deleteCred(index);
  2151. }).listen('CredentialAdded', function (e) {
  2152. _this.credentials.unshift(e.credential);
  2153. });
  2154. }
  2155. if (this.groupid) {
  2156. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2157. var deletedCred = e.credential;
  2158. var index = _this.credentials.findIndex(function (credential) {
  2159. return credential.groupid === deletedCred['groupid'];
  2160. });
  2161. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2162. _this.deleteCred(index);
  2163. }).listen('CredentialAdded', function (e) {
  2164. _this.credentials.unshift(e.credential);
  2165. });
  2166. }
  2167. }
  2168. });
  2169. /***/ }),
  2170. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2171. /*!**************************************************************************************************************************************************************************!*\
  2172. !*** ./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& ***!
  2173. \**************************************************************************************************************************************************************************/
  2174. /*! exports provided: default */
  2175. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2176. "use strict";
  2177. __webpack_require__.r(__webpack_exports__);
  2178. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  2179. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. /* harmony default export */ __webpack_exports__["default"] = ({
  2214. components: {
  2215. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  2216. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  2217. },
  2218. props: {
  2219. populateWith: {
  2220. type: Object,
  2221. required: true
  2222. },
  2223. storeList: {
  2224. type: Array,
  2225. required: true
  2226. },
  2227. modalId: {
  2228. type: String,
  2229. required: true
  2230. }
  2231. },
  2232. data: function data() {
  2233. return {
  2234. // Copies object from prop, so it doesn't mutate the object
  2235. // from the parent component. Parent component will be updated via
  2236. // Websocket if updateWorkOrder is successful.
  2237. data: JSON.parse(JSON.stringify(this.populateWith)),
  2238. id: this.modalId,
  2239. store: {},
  2240. errors: []
  2241. };
  2242. },
  2243. methods: {
  2244. updateWorkOrder: function updateWorkOrder() {
  2245. var _this = this;
  2246. this.data.storeid = this.store.id;
  2247. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2248. $('#workordereditModal').modal('hide');
  2249. })["catch"](function (error) {
  2250. _this.errors = JSON.parse(error.response.request.response).errors;
  2251. });
  2252. }
  2253. },
  2254. mounted: function mounted() {
  2255. this.store = {
  2256. 'id': this.data.storeid,
  2257. 'name': this.storeList[this.data.storeid]
  2258. };
  2259. },
  2260. // This was originally here because the populateWith info would originally
  2261. // not necessarily be loaded when this component was mounted. That is no
  2262. // longer the case as I now don't render the parent component until the
  2263. // ajax request is finised. The watch statements are still here to cover
  2264. // the case where someone else updates the populateWith values while
  2265. // someone is editing, although it probably should be edited so it doesn't
  2266. // immediately overwrite the unsaved edits of the current user.
  2267. watch: {
  2268. populateWith: function populateWith(value) {
  2269. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2270. this.store = {
  2271. 'id': this.data.storeid,
  2272. 'name': this.storeList[this.data.storeid]
  2273. };
  2274. },
  2275. storeList: function storeList(value) {
  2276. this.store = {
  2277. 'id': this.data.storeid,
  2278. 'name': this.storeList[this.data.storeid]
  2279. };
  2280. }
  2281. }
  2282. });
  2283. /***/ }),
  2284. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2285. /*!************************************************************************************************************************************************************************!*\
  2286. !*** ./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& ***!
  2287. \************************************************************************************************************************************************************************/
  2288. /*! exports provided: default */
  2289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2290. "use strict";
  2291. __webpack_require__.r(__webpack_exports__);
  2292. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2293. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. /* harmony default export */ __webpack_exports__["default"] = ({
  2315. components: {
  2316. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2317. },
  2318. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2319. props: ['workOrder', 'stores'],
  2320. computed: {
  2321. storeList: function storeList() {
  2322. var list = {};
  2323. Object.values(this.stores).map(function (val) {
  2324. list[val.storeid] = val.storesname;
  2325. });
  2326. return list;
  2327. }
  2328. }
  2329. });
  2330. /***/ }),
  2331. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2332. /*!*********************************************************************************************************************************************************!*\
  2333. !*** ./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& ***!
  2334. \*********************************************************************************************************************************************************/
  2335. /*! exports provided: default */
  2336. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2337. "use strict";
  2338. __webpack_require__.r(__webpack_exports__);
  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. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. /* harmony default export */ __webpack_exports__["default"] = ({
  2411. data: function data() {
  2412. return {
  2413. isLoggedIn: null,
  2414. username: null
  2415. };
  2416. },
  2417. mounted: function mounted() {
  2418. this.isLoggedIn = localStorage.getItem('jwt');
  2419. this.username = localStorage.getItem('user');
  2420. }
  2421. });
  2422. /***/ }),
  2423. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2424. /*!***************************************************************************************************************************************************************!*\
  2425. !*** ./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& ***!
  2426. \***************************************************************************************************************************************************************/
  2427. /*! exports provided: default */
  2428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2429. "use strict";
  2430. __webpack_require__.r(__webpack_exports__);
  2431. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2432. //
  2433. //
  2434. //
  2435. //
  2436. //
  2437. //
  2438. //
  2439. //
  2440. //
  2441. //
  2442. //
  2443. //
  2444. //
  2445. //
  2446. //
  2447. //
  2448. //
  2449. //
  2450. //
  2451. //
  2452. //
  2453. //
  2454. //
  2455. //
  2456. //
  2457. //
  2458. /* harmony default export */ __webpack_exports__["default"] = ({
  2459. components: {
  2460. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2461. },
  2462. data: function data() {
  2463. return {
  2464. workOrders: [],
  2465. isLoading: true
  2466. };
  2467. },
  2468. mounted: function mounted() {
  2469. var _this = this;
  2470. var token = localStorage.getItem('jwt');
  2471. var user = localStorage.getItem('user');
  2472. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2473. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2474. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2475. _this.workOrders = response.data;
  2476. _this.isLoading = false;
  2477. })["catch"](function (error) {
  2478. console.log(error);
  2479. });
  2480. },
  2481. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2482. if (!localStorage.getItem('jwt')) {
  2483. return next('login');
  2484. }
  2485. next();
  2486. }
  2487. });
  2488. /***/ }),
  2489. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2490. /*!***********************************************************************************************************************************************************!*\
  2491. !*** ./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& ***!
  2492. \***********************************************************************************************************************************************************/
  2493. /*! exports provided: default */
  2494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2495. "use strict";
  2496. __webpack_require__.r(__webpack_exports__);
  2497. //
  2498. //
  2499. //
  2500. //
  2501. //
  2502. //
  2503. //
  2504. //
  2505. //
  2506. //
  2507. //
  2508. //
  2509. //
  2510. //
  2511. //
  2512. //
  2513. //
  2514. //
  2515. //
  2516. //
  2517. //
  2518. //
  2519. //
  2520. //
  2521. //
  2522. //
  2523. //
  2524. //
  2525. //
  2526. //
  2527. //
  2528. //
  2529. //
  2530. //
  2531. //
  2532. //
  2533. //
  2534. //
  2535. //
  2536. /* harmony default export */ __webpack_exports__["default"] = ({
  2537. data: function data() {
  2538. return {
  2539. username: "",
  2540. password: ""
  2541. };
  2542. },
  2543. methods: {
  2544. handleSubmit: function handleSubmit(e) {
  2545. var _this = this;
  2546. e.preventDefault();
  2547. if (this.password.length > 0) {
  2548. axios.post('api/login', {
  2549. username: this.username,
  2550. password: this.password
  2551. }).then(function (response) {
  2552. localStorage.setItem('user', response.data.success.username);
  2553. localStorage.setItem('jwt', response.data.success.token);
  2554. if (localStorage.getItem('jwt') != null) {
  2555. _this.$router.go('/dashboard');
  2556. }
  2557. })["catch"](function (error) {
  2558. console.error(error);
  2559. });
  2560. }
  2561. }
  2562. },
  2563. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2564. if (localStorage.getItem('jwt')) {
  2565. return next('dashboard');
  2566. }
  2567. next();
  2568. }
  2569. });
  2570. /***/ }),
  2571. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2572. /*!*************************************************************************************************************************************************************!*\
  2573. !*** ./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& ***!
  2574. \*************************************************************************************************************************************************************/
  2575. /*! exports provided: default */
  2576. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2577. "use strict";
  2578. __webpack_require__.r(__webpack_exports__);
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. //
  2592. //
  2593. //
  2594. //
  2595. //
  2596. //
  2597. //
  2598. //
  2599. //
  2600. //
  2601. //
  2602. //
  2603. //
  2604. //
  2605. //
  2606. //
  2607. //
  2608. //
  2609. //
  2610. //
  2611. //
  2612. //
  2613. //
  2614. //
  2615. //
  2616. //
  2617. //
  2618. //
  2619. //
  2620. //
  2621. //
  2622. //
  2623. //
  2624. //
  2625. //
  2626. //
  2627. //
  2628. //
  2629. //
  2630. /* harmony default export */ __webpack_exports__["default"] = ({});
  2631. /***/ }),
  2632. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2633. /*!***************************************************************************************************************************************************************!*\
  2634. !*** ./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& ***!
  2635. \***************************************************************************************************************************************************************/
  2636. /*! exports provided: default */
  2637. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2638. "use strict";
  2639. __webpack_require__.r(__webpack_exports__);
  2640. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2641. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2642. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2643. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2644. //
  2645. //
  2646. //
  2647. //
  2648. //
  2649. //
  2650. //
  2651. //
  2652. //
  2653. //
  2654. //
  2655. //
  2656. //
  2657. //
  2658. //
  2659. //
  2660. //
  2661. //
  2662. //
  2663. //
  2664. //
  2665. //
  2666. //
  2667. //
  2668. //
  2669. //
  2670. //
  2671. //
  2672. //
  2673. //
  2674. //
  2675. //
  2676. //
  2677. //
  2678. //
  2679. //
  2680. //
  2681. //
  2682. //
  2683. //
  2684. //
  2685. //
  2686. //
  2687. //
  2688. //
  2689. //
  2690. //
  2691. //
  2692. //
  2693. //
  2694. //
  2695. //
  2696. //
  2697. //
  2698. //
  2699. //
  2700. //
  2701. //
  2702. //
  2703. //
  2704. //
  2705. //
  2706. //
  2707. //
  2708. //
  2709. //
  2710. //
  2711. //
  2712. //
  2713. //
  2714. //
  2715. //
  2716. //
  2717. //
  2718. //
  2719. //
  2720. //
  2721. //
  2722. //
  2723. //
  2724. //
  2725. //
  2726. //
  2727. //
  2728. //
  2729. //
  2730. //
  2731. //
  2732. //
  2733. //
  2734. //
  2735. //
  2736. //
  2737. //
  2738. //
  2739. //
  2740. //
  2741. //
  2742. //
  2743. /* harmony default export */ __webpack_exports__["default"] = ({
  2744. components: {
  2745. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2746. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2747. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2748. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2749. },
  2750. props: {
  2751. id: {
  2752. type: Number,
  2753. required: true
  2754. }
  2755. },
  2756. data: function data() {
  2757. return {
  2758. workOrder: {},
  2759. asset: {},
  2760. stores: {},
  2761. credentials: {},
  2762. credentialDescriptions: {},
  2763. woLoading: true,
  2764. assetLoading: true,
  2765. storesLoading: true,
  2766. credentialsLoading: true,
  2767. credentialDescriptionsLoading: true
  2768. };
  2769. },
  2770. mounted: function mounted() {
  2771. var _this = this;
  2772. // Get authentication info from current user from local storage
  2773. var token = localStorage.getItem('jwt');
  2774. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  2775. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2776. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  2777. axios.get('/api/workorders/' + this.id).then(function (response) {
  2778. _this.workOrder = response.data;
  2779. _this.woLoading = false;
  2780. })["catch"](function (error) {
  2781. console.log(error);
  2782. }); // Get list of stores from API
  2783. axios.get('/api/stores/').then(function (response) {
  2784. _this.stores = response.data;
  2785. _this.storesLoading = false;
  2786. })["catch"](function (error) {
  2787. console.log(error);
  2788. }); // Get Asset from API (will most likely be replaced with list of assets
  2789. // in the future. Current each WO can only have one but that is likely
  2790. // to change)
  2791. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  2792. _this.asset = response.data;
  2793. _this.assetLoading = false; // Get Credentials for this asset. May be relocated to be part of asset
  2794. // Component when WOs can have more than one asset.
  2795. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  2796. _this.credentials = response.data;
  2797. _this.credentialsLoading = false;
  2798. })["catch"](function (error) {
  2799. console.log(error);
  2800. }); // Get default list of Credential Descriptions. May be relocated along with
  2801. // the above.
  2802. axios.get('/api/credentials/descriptions').then(function (response) {
  2803. _this.credentialDescriptions = response.data;
  2804. _this.credentialDescriptionsLoading = false;
  2805. })["catch"](function (error) {
  2806. console.log(error);
  2807. });
  2808. })["catch"](function (error) {
  2809. console.log(error);
  2810. });
  2811. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2812. _this.workOrder = e.data;
  2813. });
  2814. }
  2815. });
  2816. /***/ }),
  2817. /***/ "./node_modules/base64-js/index.js":
  2818. /*!*****************************************!*\
  2819. !*** ./node_modules/base64-js/index.js ***!
  2820. \*****************************************/
  2821. /*! no static exports found */
  2822. /***/ (function(module, exports, __webpack_require__) {
  2823. "use strict";
  2824. exports.byteLength = byteLength
  2825. exports.toByteArray = toByteArray
  2826. exports.fromByteArray = fromByteArray
  2827. var lookup = []
  2828. var revLookup = []
  2829. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2830. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2831. for (var i = 0, len = code.length; i < len; ++i) {
  2832. lookup[i] = code[i]
  2833. revLookup[code.charCodeAt(i)] = i
  2834. }
  2835. // Support decoding URL-safe base64 strings, as Node.js does.
  2836. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2837. revLookup['-'.charCodeAt(0)] = 62
  2838. revLookup['_'.charCodeAt(0)] = 63
  2839. function getLens (b64) {
  2840. var len = b64.length
  2841. if (len % 4 > 0) {
  2842. throw new Error('Invalid string. Length must be a multiple of 4')
  2843. }
  2844. // Trim off extra bytes after placeholder bytes are found
  2845. // See: https://github.com/beatgammit/base64-js/issues/42
  2846. var validLen = b64.indexOf('=')
  2847. if (validLen === -1) validLen = len
  2848. var placeHoldersLen = validLen === len
  2849. ? 0
  2850. : 4 - (validLen % 4)
  2851. return [validLen, placeHoldersLen]
  2852. }
  2853. // base64 is 4/3 + up to two characters of the original data
  2854. function byteLength (b64) {
  2855. var lens = getLens(b64)
  2856. var validLen = lens[0]
  2857. var placeHoldersLen = lens[1]
  2858. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2859. }
  2860. function _byteLength (b64, validLen, placeHoldersLen) {
  2861. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2862. }
  2863. function toByteArray (b64) {
  2864. var tmp
  2865. var lens = getLens(b64)
  2866. var validLen = lens[0]
  2867. var placeHoldersLen = lens[1]
  2868. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2869. var curByte = 0
  2870. // if there are placeholders, only get up to the last complete 4 chars
  2871. var len = placeHoldersLen > 0
  2872. ? validLen - 4
  2873. : validLen
  2874. var i
  2875. for (i = 0; i < len; i += 4) {
  2876. tmp =
  2877. (revLookup[b64.charCodeAt(i)] << 18) |
  2878. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2879. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2880. revLookup[b64.charCodeAt(i + 3)]
  2881. arr[curByte++] = (tmp >> 16) & 0xFF
  2882. arr[curByte++] = (tmp >> 8) & 0xFF
  2883. arr[curByte++] = tmp & 0xFF
  2884. }
  2885. if (placeHoldersLen === 2) {
  2886. tmp =
  2887. (revLookup[b64.charCodeAt(i)] << 2) |
  2888. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2889. arr[curByte++] = tmp & 0xFF
  2890. }
  2891. if (placeHoldersLen === 1) {
  2892. tmp =
  2893. (revLookup[b64.charCodeAt(i)] << 10) |
  2894. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2895. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2896. arr[curByte++] = (tmp >> 8) & 0xFF
  2897. arr[curByte++] = tmp & 0xFF
  2898. }
  2899. return arr
  2900. }
  2901. function tripletToBase64 (num) {
  2902. return lookup[num >> 18 & 0x3F] +
  2903. lookup[num >> 12 & 0x3F] +
  2904. lookup[num >> 6 & 0x3F] +
  2905. lookup[num & 0x3F]
  2906. }
  2907. function encodeChunk (uint8, start, end) {
  2908. var tmp
  2909. var output = []
  2910. for (var i = start; i < end; i += 3) {
  2911. tmp =
  2912. ((uint8[i] << 16) & 0xFF0000) +
  2913. ((uint8[i + 1] << 8) & 0xFF00) +
  2914. (uint8[i + 2] & 0xFF)
  2915. output.push(tripletToBase64(tmp))
  2916. }
  2917. return output.join('')
  2918. }
  2919. function fromByteArray (uint8) {
  2920. var tmp
  2921. var len = uint8.length
  2922. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2923. var parts = []
  2924. var maxChunkLength = 16383 // must be multiple of 3
  2925. // go through the array every three bytes, we'll deal with trailing stuff later
  2926. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2927. parts.push(encodeChunk(
  2928. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2929. ))
  2930. }
  2931. // pad the end with zeros, but make sure to not forget the extra bytes
  2932. if (extraBytes === 1) {
  2933. tmp = uint8[len - 1]
  2934. parts.push(
  2935. lookup[tmp >> 2] +
  2936. lookup[(tmp << 4) & 0x3F] +
  2937. '=='
  2938. )
  2939. } else if (extraBytes === 2) {
  2940. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2941. parts.push(
  2942. lookup[tmp >> 10] +
  2943. lookup[(tmp >> 4) & 0x3F] +
  2944. lookup[(tmp << 2) & 0x3F] +
  2945. '='
  2946. )
  2947. }
  2948. return parts.join('')
  2949. }
  2950. /***/ }),
  2951. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2952. /*!*****************************************************!*\
  2953. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2954. \*****************************************************/
  2955. /*! no static exports found */
  2956. /***/ (function(module, exports, __webpack_require__) {
  2957. /*!
  2958. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2959. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2960. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2961. */
  2962. (function (global, factory) {
  2963. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2964. undefined;
  2965. }(this, (function (exports, $, Popper) { 'use strict';
  2966. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2967. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2968. function _defineProperties(target, props) {
  2969. for (var i = 0; i < props.length; i++) {
  2970. var descriptor = props[i];
  2971. descriptor.enumerable = descriptor.enumerable || false;
  2972. descriptor.configurable = true;
  2973. if ("value" in descriptor) descriptor.writable = true;
  2974. Object.defineProperty(target, descriptor.key, descriptor);
  2975. }
  2976. }
  2977. function _createClass(Constructor, protoProps, staticProps) {
  2978. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2979. if (staticProps) _defineProperties(Constructor, staticProps);
  2980. return Constructor;
  2981. }
  2982. function _defineProperty(obj, key, value) {
  2983. if (key in obj) {
  2984. Object.defineProperty(obj, key, {
  2985. value: value,
  2986. enumerable: true,
  2987. configurable: true,
  2988. writable: true
  2989. });
  2990. } else {
  2991. obj[key] = value;
  2992. }
  2993. return obj;
  2994. }
  2995. function ownKeys(object, enumerableOnly) {
  2996. var keys = Object.keys(object);
  2997. if (Object.getOwnPropertySymbols) {
  2998. var symbols = Object.getOwnPropertySymbols(object);
  2999. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3000. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3001. });
  3002. keys.push.apply(keys, symbols);
  3003. }
  3004. return keys;
  3005. }
  3006. function _objectSpread2(target) {
  3007. for (var i = 1; i < arguments.length; i++) {
  3008. var source = arguments[i] != null ? arguments[i] : {};
  3009. if (i % 2) {
  3010. ownKeys(Object(source), true).forEach(function (key) {
  3011. _defineProperty(target, key, source[key]);
  3012. });
  3013. } else if (Object.getOwnPropertyDescriptors) {
  3014. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3015. } else {
  3016. ownKeys(Object(source)).forEach(function (key) {
  3017. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3018. });
  3019. }
  3020. }
  3021. return target;
  3022. }
  3023. function _inheritsLoose(subClass, superClass) {
  3024. subClass.prototype = Object.create(superClass.prototype);
  3025. subClass.prototype.constructor = subClass;
  3026. subClass.__proto__ = superClass;
  3027. }
  3028. /**
  3029. * --------------------------------------------------------------------------
  3030. * Bootstrap (v4.4.1): util.js
  3031. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3032. * --------------------------------------------------------------------------
  3033. */
  3034. /**
  3035. * ------------------------------------------------------------------------
  3036. * Private TransitionEnd Helpers
  3037. * ------------------------------------------------------------------------
  3038. */
  3039. var TRANSITION_END = 'transitionend';
  3040. var MAX_UID = 1000000;
  3041. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3042. function toType(obj) {
  3043. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3044. }
  3045. function getSpecialTransitionEndEvent() {
  3046. return {
  3047. bindType: TRANSITION_END,
  3048. delegateType: TRANSITION_END,
  3049. handle: function handle(event) {
  3050. if ($(event.target).is(this)) {
  3051. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3052. }
  3053. return undefined; // eslint-disable-line no-undefined
  3054. }
  3055. };
  3056. }
  3057. function transitionEndEmulator(duration) {
  3058. var _this = this;
  3059. var called = false;
  3060. $(this).one(Util.TRANSITION_END, function () {
  3061. called = true;
  3062. });
  3063. setTimeout(function () {
  3064. if (!called) {
  3065. Util.triggerTransitionEnd(_this);
  3066. }
  3067. }, duration);
  3068. return this;
  3069. }
  3070. function setTransitionEndSupport() {
  3071. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3072. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3073. }
  3074. /**
  3075. * --------------------------------------------------------------------------
  3076. * Public Util Api
  3077. * --------------------------------------------------------------------------
  3078. */
  3079. var Util = {
  3080. TRANSITION_END: 'bsTransitionEnd',
  3081. getUID: function getUID(prefix) {
  3082. do {
  3083. // eslint-disable-next-line no-bitwise
  3084. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3085. } while (document.getElementById(prefix));
  3086. return prefix;
  3087. },
  3088. getSelectorFromElement: function getSelectorFromElement(element) {
  3089. var selector = element.getAttribute('data-target');
  3090. if (!selector || selector === '#') {
  3091. var hrefAttr = element.getAttribute('href');
  3092. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3093. }
  3094. try {
  3095. return document.querySelector(selector) ? selector : null;
  3096. } catch (err) {
  3097. return null;
  3098. }
  3099. },
  3100. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3101. if (!element) {
  3102. return 0;
  3103. } // Get transition-duration of the element
  3104. var transitionDuration = $(element).css('transition-duration');
  3105. var transitionDelay = $(element).css('transition-delay');
  3106. var floatTransitionDuration = parseFloat(transitionDuration);
  3107. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3108. if (!floatTransitionDuration && !floatTransitionDelay) {
  3109. return 0;
  3110. } // If multiple durations are defined, take the first
  3111. transitionDuration = transitionDuration.split(',')[0];
  3112. transitionDelay = transitionDelay.split(',')[0];
  3113. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3114. },
  3115. reflow: function reflow(element) {
  3116. return element.offsetHeight;
  3117. },
  3118. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3119. $(element).trigger(TRANSITION_END);
  3120. },
  3121. // TODO: Remove in v5
  3122. supportsTransitionEnd: function supportsTransitionEnd() {
  3123. return Boolean(TRANSITION_END);
  3124. },
  3125. isElement: function isElement(obj) {
  3126. return (obj[0] || obj).nodeType;
  3127. },
  3128. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3129. for (var property in configTypes) {
  3130. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3131. var expectedTypes = configTypes[property];
  3132. var value = config[property];
  3133. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3134. if (!new RegExp(expectedTypes).test(valueType)) {
  3135. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3136. }
  3137. }
  3138. }
  3139. },
  3140. findShadowRoot: function findShadowRoot(element) {
  3141. if (!document.documentElement.attachShadow) {
  3142. return null;
  3143. } // Can find the shadow root otherwise it'll return the document
  3144. if (typeof element.getRootNode === 'function') {
  3145. var root = element.getRootNode();
  3146. return root instanceof ShadowRoot ? root : null;
  3147. }
  3148. if (element instanceof ShadowRoot) {
  3149. return element;
  3150. } // when we don't find a shadow root
  3151. if (!element.parentNode) {
  3152. return null;
  3153. }
  3154. return Util.findShadowRoot(element.parentNode);
  3155. },
  3156. jQueryDetection: function jQueryDetection() {
  3157. if (typeof $ === 'undefined') {
  3158. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3159. }
  3160. var version = $.fn.jquery.split(' ')[0].split('.');
  3161. var minMajor = 1;
  3162. var ltMajor = 2;
  3163. var minMinor = 9;
  3164. var minPatch = 1;
  3165. var maxMajor = 4;
  3166. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3167. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3168. }
  3169. }
  3170. };
  3171. Util.jQueryDetection();
  3172. setTransitionEndSupport();
  3173. /**
  3174. * ------------------------------------------------------------------------
  3175. * Constants
  3176. * ------------------------------------------------------------------------
  3177. */
  3178. var NAME = 'alert';
  3179. var VERSION = '4.4.1';
  3180. var DATA_KEY = 'bs.alert';
  3181. var EVENT_KEY = "." + DATA_KEY;
  3182. var DATA_API_KEY = '.data-api';
  3183. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3184. var Selector = {
  3185. DISMISS: '[data-dismiss="alert"]'
  3186. };
  3187. var Event = {
  3188. CLOSE: "close" + EVENT_KEY,
  3189. CLOSED: "closed" + EVENT_KEY,
  3190. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3191. };
  3192. var ClassName = {
  3193. ALERT: 'alert',
  3194. FADE: 'fade',
  3195. SHOW: 'show'
  3196. };
  3197. /**
  3198. * ------------------------------------------------------------------------
  3199. * Class Definition
  3200. * ------------------------------------------------------------------------
  3201. */
  3202. var Alert =
  3203. /*#__PURE__*/
  3204. function () {
  3205. function Alert(element) {
  3206. this._element = element;
  3207. } // Getters
  3208. var _proto = Alert.prototype;
  3209. // Public
  3210. _proto.close = function close(element) {
  3211. var rootElement = this._element;
  3212. if (element) {
  3213. rootElement = this._getRootElement(element);
  3214. }
  3215. var customEvent = this._triggerCloseEvent(rootElement);
  3216. if (customEvent.isDefaultPrevented()) {
  3217. return;
  3218. }
  3219. this._removeElement(rootElement);
  3220. };
  3221. _proto.dispose = function dispose() {
  3222. $.removeData(this._element, DATA_KEY);
  3223. this._element = null;
  3224. } // Private
  3225. ;
  3226. _proto._getRootElement = function _getRootElement(element) {
  3227. var selector = Util.getSelectorFromElement(element);
  3228. var parent = false;
  3229. if (selector) {
  3230. parent = document.querySelector(selector);
  3231. }
  3232. if (!parent) {
  3233. parent = $(element).closest("." + ClassName.ALERT)[0];
  3234. }
  3235. return parent;
  3236. };
  3237. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3238. var closeEvent = $.Event(Event.CLOSE);
  3239. $(element).trigger(closeEvent);
  3240. return closeEvent;
  3241. };
  3242. _proto._removeElement = function _removeElement(element) {
  3243. var _this = this;
  3244. $(element).removeClass(ClassName.SHOW);
  3245. if (!$(element).hasClass(ClassName.FADE)) {
  3246. this._destroyElement(element);
  3247. return;
  3248. }
  3249. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3250. $(element).one(Util.TRANSITION_END, function (event) {
  3251. return _this._destroyElement(element, event);
  3252. }).emulateTransitionEnd(transitionDuration);
  3253. };
  3254. _proto._destroyElement = function _destroyElement(element) {
  3255. $(element).detach().trigger(Event.CLOSED).remove();
  3256. } // Static
  3257. ;
  3258. Alert._jQueryInterface = function _jQueryInterface(config) {
  3259. return this.each(function () {
  3260. var $element = $(this);
  3261. var data = $element.data(DATA_KEY);
  3262. if (!data) {
  3263. data = new Alert(this);
  3264. $element.data(DATA_KEY, data);
  3265. }
  3266. if (config === 'close') {
  3267. data[config](this);
  3268. }
  3269. });
  3270. };
  3271. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3272. return function (event) {
  3273. if (event) {
  3274. event.preventDefault();
  3275. }
  3276. alertInstance.close(this);
  3277. };
  3278. };
  3279. _createClass(Alert, null, [{
  3280. key: "VERSION",
  3281. get: function get() {
  3282. return VERSION;
  3283. }
  3284. }]);
  3285. return Alert;
  3286. }();
  3287. /**
  3288. * ------------------------------------------------------------------------
  3289. * Data Api implementation
  3290. * ------------------------------------------------------------------------
  3291. */
  3292. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3293. /**
  3294. * ------------------------------------------------------------------------
  3295. * jQuery
  3296. * ------------------------------------------------------------------------
  3297. */
  3298. $.fn[NAME] = Alert._jQueryInterface;
  3299. $.fn[NAME].Constructor = Alert;
  3300. $.fn[NAME].noConflict = function () {
  3301. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3302. return Alert._jQueryInterface;
  3303. };
  3304. /**
  3305. * ------------------------------------------------------------------------
  3306. * Constants
  3307. * ------------------------------------------------------------------------
  3308. */
  3309. var NAME$1 = 'button';
  3310. var VERSION$1 = '4.4.1';
  3311. var DATA_KEY$1 = 'bs.button';
  3312. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3313. var DATA_API_KEY$1 = '.data-api';
  3314. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3315. var ClassName$1 = {
  3316. ACTIVE: 'active',
  3317. BUTTON: 'btn',
  3318. FOCUS: 'focus'
  3319. };
  3320. var Selector$1 = {
  3321. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3322. DATA_TOGGLES: '[data-toggle="buttons"]',
  3323. DATA_TOGGLE: '[data-toggle="button"]',
  3324. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3325. INPUT: 'input:not([type="hidden"])',
  3326. ACTIVE: '.active',
  3327. BUTTON: '.btn'
  3328. };
  3329. var Event$1 = {
  3330. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3331. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3332. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3333. };
  3334. /**
  3335. * ------------------------------------------------------------------------
  3336. * Class Definition
  3337. * ------------------------------------------------------------------------
  3338. */
  3339. var Button =
  3340. /*#__PURE__*/
  3341. function () {
  3342. function Button(element) {
  3343. this._element = element;
  3344. } // Getters
  3345. var _proto = Button.prototype;
  3346. // Public
  3347. _proto.toggle = function toggle() {
  3348. var triggerChangeEvent = true;
  3349. var addAriaPressed = true;
  3350. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3351. if (rootElement) {
  3352. var input = this._element.querySelector(Selector$1.INPUT);
  3353. if (input) {
  3354. if (input.type === 'radio') {
  3355. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3356. triggerChangeEvent = false;
  3357. } else {
  3358. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3359. if (activeElement) {
  3360. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3361. }
  3362. }
  3363. } else if (input.type === 'checkbox') {
  3364. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3365. triggerChangeEvent = false;
  3366. }
  3367. } else {
  3368. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3369. triggerChangeEvent = false;
  3370. }
  3371. if (triggerChangeEvent) {
  3372. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3373. $(input).trigger('change');
  3374. }
  3375. input.focus();
  3376. addAriaPressed = false;
  3377. }
  3378. }
  3379. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3380. if (addAriaPressed) {
  3381. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3382. }
  3383. if (triggerChangeEvent) {
  3384. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3385. }
  3386. }
  3387. };
  3388. _proto.dispose = function dispose() {
  3389. $.removeData(this._element, DATA_KEY$1);
  3390. this._element = null;
  3391. } // Static
  3392. ;
  3393. Button._jQueryInterface = function _jQueryInterface(config) {
  3394. return this.each(function () {
  3395. var data = $(this).data(DATA_KEY$1);
  3396. if (!data) {
  3397. data = new Button(this);
  3398. $(this).data(DATA_KEY$1, data);
  3399. }
  3400. if (config === 'toggle') {
  3401. data[config]();
  3402. }
  3403. });
  3404. };
  3405. _createClass(Button, null, [{
  3406. key: "VERSION",
  3407. get: function get() {
  3408. return VERSION$1;
  3409. }
  3410. }]);
  3411. return Button;
  3412. }();
  3413. /**
  3414. * ------------------------------------------------------------------------
  3415. * Data Api implementation
  3416. * ------------------------------------------------------------------------
  3417. */
  3418. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3419. var button = event.target;
  3420. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3421. button = $(button).closest(Selector$1.BUTTON)[0];
  3422. }
  3423. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3424. event.preventDefault(); // work around Firefox bug #1540995
  3425. } else {
  3426. var inputBtn = button.querySelector(Selector$1.INPUT);
  3427. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3428. event.preventDefault(); // work around Firefox bug #1540995
  3429. return;
  3430. }
  3431. Button._jQueryInterface.call($(button), 'toggle');
  3432. }
  3433. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3434. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3435. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3436. });
  3437. $(window).on(Event$1.LOAD_DATA_API, function () {
  3438. // ensure correct active class is set to match the controls' actual values/states
  3439. // find all checkboxes/readio buttons inside data-toggle groups
  3440. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3441. for (var i = 0, len = buttons.length; i < len; i++) {
  3442. var button = buttons[i];
  3443. var input = button.querySelector(Selector$1.INPUT);
  3444. if (input.checked || input.hasAttribute('checked')) {
  3445. button.classList.add(ClassName$1.ACTIVE);
  3446. } else {
  3447. button.classList.remove(ClassName$1.ACTIVE);
  3448. }
  3449. } // find all button toggles
  3450. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3451. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3452. var _button = buttons[_i];
  3453. if (_button.getAttribute('aria-pressed') === 'true') {
  3454. _button.classList.add(ClassName$1.ACTIVE);
  3455. } else {
  3456. _button.classList.remove(ClassName$1.ACTIVE);
  3457. }
  3458. }
  3459. });
  3460. /**
  3461. * ------------------------------------------------------------------------
  3462. * jQuery
  3463. * ------------------------------------------------------------------------
  3464. */
  3465. $.fn[NAME$1] = Button._jQueryInterface;
  3466. $.fn[NAME$1].Constructor = Button;
  3467. $.fn[NAME$1].noConflict = function () {
  3468. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3469. return Button._jQueryInterface;
  3470. };
  3471. /**
  3472. * ------------------------------------------------------------------------
  3473. * Constants
  3474. * ------------------------------------------------------------------------
  3475. */
  3476. var NAME$2 = 'carousel';
  3477. var VERSION$2 = '4.4.1';
  3478. var DATA_KEY$2 = 'bs.carousel';
  3479. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3480. var DATA_API_KEY$2 = '.data-api';
  3481. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3482. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3483. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3484. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3485. var SWIPE_THRESHOLD = 40;
  3486. var Default = {
  3487. interval: 5000,
  3488. keyboard: true,
  3489. slide: false,
  3490. pause: 'hover',
  3491. wrap: true,
  3492. touch: true
  3493. };
  3494. var DefaultType = {
  3495. interval: '(number|boolean)',
  3496. keyboard: 'boolean',
  3497. slide: '(boolean|string)',
  3498. pause: '(string|boolean)',
  3499. wrap: 'boolean',
  3500. touch: 'boolean'
  3501. };
  3502. var Direction = {
  3503. NEXT: 'next',
  3504. PREV: 'prev',
  3505. LEFT: 'left',
  3506. RIGHT: 'right'
  3507. };
  3508. var Event$2 = {
  3509. SLIDE: "slide" + EVENT_KEY$2,
  3510. SLID: "slid" + EVENT_KEY$2,
  3511. KEYDOWN: "keydown" + EVENT_KEY$2,
  3512. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3513. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3514. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3515. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3516. TOUCHEND: "touchend" + EVENT_KEY$2,
  3517. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3518. POINTERUP: "pointerup" + EVENT_KEY$2,
  3519. DRAG_START: "dragstart" + EVENT_KEY$2,
  3520. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3521. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3522. };
  3523. var ClassName$2 = {
  3524. CAROUSEL: 'carousel',
  3525. ACTIVE: 'active',
  3526. SLIDE: 'slide',
  3527. RIGHT: 'carousel-item-right',
  3528. LEFT: 'carousel-item-left',
  3529. NEXT: 'carousel-item-next',
  3530. PREV: 'carousel-item-prev',
  3531. ITEM: 'carousel-item',
  3532. POINTER_EVENT: 'pointer-event'
  3533. };
  3534. var Selector$2 = {
  3535. ACTIVE: '.active',
  3536. ACTIVE_ITEM: '.active.carousel-item',
  3537. ITEM: '.carousel-item',
  3538. ITEM_IMG: '.carousel-item img',
  3539. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3540. INDICATORS: '.carousel-indicators',
  3541. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3542. DATA_RIDE: '[data-ride="carousel"]'
  3543. };
  3544. var PointerType = {
  3545. TOUCH: 'touch',
  3546. PEN: 'pen'
  3547. };
  3548. /**
  3549. * ------------------------------------------------------------------------
  3550. * Class Definition
  3551. * ------------------------------------------------------------------------
  3552. */
  3553. var Carousel =
  3554. /*#__PURE__*/
  3555. function () {
  3556. function Carousel(element, config) {
  3557. this._items = null;
  3558. this._interval = null;
  3559. this._activeElement = null;
  3560. this._isPaused = false;
  3561. this._isSliding = false;
  3562. this.touchTimeout = null;
  3563. this.touchStartX = 0;
  3564. this.touchDeltaX = 0;
  3565. this._config = this._getConfig(config);
  3566. this._element = element;
  3567. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3568. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3569. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3570. this._addEventListeners();
  3571. } // Getters
  3572. var _proto = Carousel.prototype;
  3573. // Public
  3574. _proto.next = function next() {
  3575. if (!this._isSliding) {
  3576. this._slide(Direction.NEXT);
  3577. }
  3578. };
  3579. _proto.nextWhenVisible = function nextWhenVisible() {
  3580. // Don't call next when the page isn't visible
  3581. // or the carousel or its parent isn't visible
  3582. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3583. this.next();
  3584. }
  3585. };
  3586. _proto.prev = function prev() {
  3587. if (!this._isSliding) {
  3588. this._slide(Direction.PREV);
  3589. }
  3590. };
  3591. _proto.pause = function pause(event) {
  3592. if (!event) {
  3593. this._isPaused = true;
  3594. }
  3595. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3596. Util.triggerTransitionEnd(this._element);
  3597. this.cycle(true);
  3598. }
  3599. clearInterval(this._interval);
  3600. this._interval = null;
  3601. };
  3602. _proto.cycle = function cycle(event) {
  3603. if (!event) {
  3604. this._isPaused = false;
  3605. }
  3606. if (this._interval) {
  3607. clearInterval(this._interval);
  3608. this._interval = null;
  3609. }
  3610. if (this._config.interval && !this._isPaused) {
  3611. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3612. }
  3613. };
  3614. _proto.to = function to(index) {
  3615. var _this = this;
  3616. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3617. var activeIndex = this._getItemIndex(this._activeElement);
  3618. if (index > this._items.length - 1 || index < 0) {
  3619. return;
  3620. }
  3621. if (this._isSliding) {
  3622. $(this._element).one(Event$2.SLID, function () {
  3623. return _this.to(index);
  3624. });
  3625. return;
  3626. }
  3627. if (activeIndex === index) {
  3628. this.pause();
  3629. this.cycle();
  3630. return;
  3631. }
  3632. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3633. this._slide(direction, this._items[index]);
  3634. };
  3635. _proto.dispose = function dispose() {
  3636. $(this._element).off(EVENT_KEY$2);
  3637. $.removeData(this._element, DATA_KEY$2);
  3638. this._items = null;
  3639. this._config = null;
  3640. this._element = null;
  3641. this._interval = null;
  3642. this._isPaused = null;
  3643. this._isSliding = null;
  3644. this._activeElement = null;
  3645. this._indicatorsElement = null;
  3646. } // Private
  3647. ;
  3648. _proto._getConfig = function _getConfig(config) {
  3649. config = _objectSpread2({}, Default, {}, config);
  3650. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3651. return config;
  3652. };
  3653. _proto._handleSwipe = function _handleSwipe() {
  3654. var absDeltax = Math.abs(this.touchDeltaX);
  3655. if (absDeltax <= SWIPE_THRESHOLD) {
  3656. return;
  3657. }
  3658. var direction = absDeltax / this.touchDeltaX;
  3659. this.touchDeltaX = 0; // swipe left
  3660. if (direction > 0) {
  3661. this.prev();
  3662. } // swipe right
  3663. if (direction < 0) {
  3664. this.next();
  3665. }
  3666. };
  3667. _proto._addEventListeners = function _addEventListeners() {
  3668. var _this2 = this;
  3669. if (this._config.keyboard) {
  3670. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3671. return _this2._keydown(event);
  3672. });
  3673. }
  3674. if (this._config.pause === 'hover') {
  3675. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3676. return _this2.pause(event);
  3677. }).on(Event$2.MOUSELEAVE, function (event) {
  3678. return _this2.cycle(event);
  3679. });
  3680. }
  3681. if (this._config.touch) {
  3682. this._addTouchEventListeners();
  3683. }
  3684. };
  3685. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3686. var _this3 = this;
  3687. if (!this._touchSupported) {
  3688. return;
  3689. }
  3690. var start = function start(event) {
  3691. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3692. _this3.touchStartX = event.originalEvent.clientX;
  3693. } else if (!_this3._pointerEvent) {
  3694. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3695. }
  3696. };
  3697. var move = function move(event) {
  3698. // ensure swiping with one touch and not pinching
  3699. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3700. _this3.touchDeltaX = 0;
  3701. } else {
  3702. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3703. }
  3704. };
  3705. var end = function end(event) {
  3706. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3707. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3708. }
  3709. _this3._handleSwipe();
  3710. if (_this3._config.pause === 'hover') {
  3711. // If it's a touch-enabled device, mouseenter/leave are fired as
  3712. // part of the mouse compatibility events on first tap - the carousel
  3713. // would stop cycling until user tapped out of it;
  3714. // here, we listen for touchend, explicitly pause the carousel
  3715. // (as if it's the second time we tap on it, mouseenter compat event
  3716. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3717. // events to fire) we explicitly restart cycling
  3718. _this3.pause();
  3719. if (_this3.touchTimeout) {
  3720. clearTimeout(_this3.touchTimeout);
  3721. }
  3722. _this3.touchTimeout = setTimeout(function (event) {
  3723. return _this3.cycle(event);
  3724. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3725. }
  3726. };
  3727. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3728. return e.preventDefault();
  3729. });
  3730. if (this._pointerEvent) {
  3731. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3732. return start(event);
  3733. });
  3734. $(this._element).on(Event$2.POINTERUP, function (event) {
  3735. return end(event);
  3736. });
  3737. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3738. } else {
  3739. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3740. return start(event);
  3741. });
  3742. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3743. return move(event);
  3744. });
  3745. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3746. return end(event);
  3747. });
  3748. }
  3749. };
  3750. _proto._keydown = function _keydown(event) {
  3751. if (/input|textarea/i.test(event.target.tagName)) {
  3752. return;
  3753. }
  3754. switch (event.which) {
  3755. case ARROW_LEFT_KEYCODE:
  3756. event.preventDefault();
  3757. this.prev();
  3758. break;
  3759. case ARROW_RIGHT_KEYCODE:
  3760. event.preventDefault();
  3761. this.next();
  3762. break;
  3763. }
  3764. };
  3765. _proto._getItemIndex = function _getItemIndex(element) {
  3766. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3767. return this._items.indexOf(element);
  3768. };
  3769. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3770. var isNextDirection = direction === Direction.NEXT;
  3771. var isPrevDirection = direction === Direction.PREV;
  3772. var activeIndex = this._getItemIndex(activeElement);
  3773. var lastItemIndex = this._items.length - 1;
  3774. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3775. if (isGoingToWrap && !this._config.wrap) {
  3776. return activeElement;
  3777. }
  3778. var delta = direction === Direction.PREV ? -1 : 1;
  3779. var itemIndex = (activeIndex + delta) % this._items.length;
  3780. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3781. };
  3782. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3783. var targetIndex = this._getItemIndex(relatedTarget);
  3784. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3785. var slideEvent = $.Event(Event$2.SLIDE, {
  3786. relatedTarget: relatedTarget,
  3787. direction: eventDirectionName,
  3788. from: fromIndex,
  3789. to: targetIndex
  3790. });
  3791. $(this._element).trigger(slideEvent);
  3792. return slideEvent;
  3793. };
  3794. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3795. if (this._indicatorsElement) {
  3796. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3797. $(indicators).removeClass(ClassName$2.ACTIVE);
  3798. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3799. if (nextIndicator) {
  3800. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3801. }
  3802. }
  3803. };
  3804. _proto._slide = function _slide(direction, element) {
  3805. var _this4 = this;
  3806. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3807. var activeElementIndex = this._getItemIndex(activeElement);
  3808. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3809. var nextElementIndex = this._getItemIndex(nextElement);
  3810. var isCycling = Boolean(this._interval);
  3811. var directionalClassName;
  3812. var orderClassName;
  3813. var eventDirectionName;
  3814. if (direction === Direction.NEXT) {
  3815. directionalClassName = ClassName$2.LEFT;
  3816. orderClassName = ClassName$2.NEXT;
  3817. eventDirectionName = Direction.LEFT;
  3818. } else {
  3819. directionalClassName = ClassName$2.RIGHT;
  3820. orderClassName = ClassName$2.PREV;
  3821. eventDirectionName = Direction.RIGHT;
  3822. }
  3823. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3824. this._isSliding = false;
  3825. return;
  3826. }
  3827. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3828. if (slideEvent.isDefaultPrevented()) {
  3829. return;
  3830. }
  3831. if (!activeElement || !nextElement) {
  3832. // Some weirdness is happening, so we bail
  3833. return;
  3834. }
  3835. this._isSliding = true;
  3836. if (isCycling) {
  3837. this.pause();
  3838. }
  3839. this._setActiveIndicatorElement(nextElement);
  3840. var slidEvent = $.Event(Event$2.SLID, {
  3841. relatedTarget: nextElement,
  3842. direction: eventDirectionName,
  3843. from: activeElementIndex,
  3844. to: nextElementIndex
  3845. });
  3846. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3847. $(nextElement).addClass(orderClassName);
  3848. Util.reflow(nextElement);
  3849. $(activeElement).addClass(directionalClassName);
  3850. $(nextElement).addClass(directionalClassName);
  3851. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3852. if (nextElementInterval) {
  3853. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3854. this._config.interval = nextElementInterval;
  3855. } else {
  3856. this._config.interval = this._config.defaultInterval || this._config.interval;
  3857. }
  3858. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3859. $(activeElement).one(Util.TRANSITION_END, function () {
  3860. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3861. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3862. _this4._isSliding = false;
  3863. setTimeout(function () {
  3864. return $(_this4._element).trigger(slidEvent);
  3865. }, 0);
  3866. }).emulateTransitionEnd(transitionDuration);
  3867. } else {
  3868. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3869. $(nextElement).addClass(ClassName$2.ACTIVE);
  3870. this._isSliding = false;
  3871. $(this._element).trigger(slidEvent);
  3872. }
  3873. if (isCycling) {
  3874. this.cycle();
  3875. }
  3876. } // Static
  3877. ;
  3878. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3879. return this.each(function () {
  3880. var data = $(this).data(DATA_KEY$2);
  3881. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3882. if (typeof config === 'object') {
  3883. _config = _objectSpread2({}, _config, {}, config);
  3884. }
  3885. var action = typeof config === 'string' ? config : _config.slide;
  3886. if (!data) {
  3887. data = new Carousel(this, _config);
  3888. $(this).data(DATA_KEY$2, data);
  3889. }
  3890. if (typeof config === 'number') {
  3891. data.to(config);
  3892. } else if (typeof action === 'string') {
  3893. if (typeof data[action] === 'undefined') {
  3894. throw new TypeError("No method named \"" + action + "\"");
  3895. }
  3896. data[action]();
  3897. } else if (_config.interval && _config.ride) {
  3898. data.pause();
  3899. data.cycle();
  3900. }
  3901. });
  3902. };
  3903. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3904. var selector = Util.getSelectorFromElement(this);
  3905. if (!selector) {
  3906. return;
  3907. }
  3908. var target = $(selector)[0];
  3909. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3910. return;
  3911. }
  3912. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3913. var slideIndex = this.getAttribute('data-slide-to');
  3914. if (slideIndex) {
  3915. config.interval = false;
  3916. }
  3917. Carousel._jQueryInterface.call($(target), config);
  3918. if (slideIndex) {
  3919. $(target).data(DATA_KEY$2).to(slideIndex);
  3920. }
  3921. event.preventDefault();
  3922. };
  3923. _createClass(Carousel, null, [{
  3924. key: "VERSION",
  3925. get: function get() {
  3926. return VERSION$2;
  3927. }
  3928. }, {
  3929. key: "Default",
  3930. get: function get() {
  3931. return Default;
  3932. }
  3933. }]);
  3934. return Carousel;
  3935. }();
  3936. /**
  3937. * ------------------------------------------------------------------------
  3938. * Data Api implementation
  3939. * ------------------------------------------------------------------------
  3940. */
  3941. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3942. $(window).on(Event$2.LOAD_DATA_API, function () {
  3943. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3944. for (var i = 0, len = carousels.length; i < len; i++) {
  3945. var $carousel = $(carousels[i]);
  3946. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3947. }
  3948. });
  3949. /**
  3950. * ------------------------------------------------------------------------
  3951. * jQuery
  3952. * ------------------------------------------------------------------------
  3953. */
  3954. $.fn[NAME$2] = Carousel._jQueryInterface;
  3955. $.fn[NAME$2].Constructor = Carousel;
  3956. $.fn[NAME$2].noConflict = function () {
  3957. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3958. return Carousel._jQueryInterface;
  3959. };
  3960. /**
  3961. * ------------------------------------------------------------------------
  3962. * Constants
  3963. * ------------------------------------------------------------------------
  3964. */
  3965. var NAME$3 = 'collapse';
  3966. var VERSION$3 = '4.4.1';
  3967. var DATA_KEY$3 = 'bs.collapse';
  3968. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3969. var DATA_API_KEY$3 = '.data-api';
  3970. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3971. var Default$1 = {
  3972. toggle: true,
  3973. parent: ''
  3974. };
  3975. var DefaultType$1 = {
  3976. toggle: 'boolean',
  3977. parent: '(string|element)'
  3978. };
  3979. var Event$3 = {
  3980. SHOW: "show" + EVENT_KEY$3,
  3981. SHOWN: "shown" + EVENT_KEY$3,
  3982. HIDE: "hide" + EVENT_KEY$3,
  3983. HIDDEN: "hidden" + EVENT_KEY$3,
  3984. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3985. };
  3986. var ClassName$3 = {
  3987. SHOW: 'show',
  3988. COLLAPSE: 'collapse',
  3989. COLLAPSING: 'collapsing',
  3990. COLLAPSED: 'collapsed'
  3991. };
  3992. var Dimension = {
  3993. WIDTH: 'width',
  3994. HEIGHT: 'height'
  3995. };
  3996. var Selector$3 = {
  3997. ACTIVES: '.show, .collapsing',
  3998. DATA_TOGGLE: '[data-toggle="collapse"]'
  3999. };
  4000. /**
  4001. * ------------------------------------------------------------------------
  4002. * Class Definition
  4003. * ------------------------------------------------------------------------
  4004. */
  4005. var Collapse =
  4006. /*#__PURE__*/
  4007. function () {
  4008. function Collapse(element, config) {
  4009. this._isTransitioning = false;
  4010. this._element = element;
  4011. this._config = this._getConfig(config);
  4012. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4013. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4014. for (var i = 0, len = toggleList.length; i < len; i++) {
  4015. var elem = toggleList[i];
  4016. var selector = Util.getSelectorFromElement(elem);
  4017. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4018. return foundElem === element;
  4019. });
  4020. if (selector !== null && filterElement.length > 0) {
  4021. this._selector = selector;
  4022. this._triggerArray.push(elem);
  4023. }
  4024. }
  4025. this._parent = this._config.parent ? this._getParent() : null;
  4026. if (!this._config.parent) {
  4027. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4028. }
  4029. if (this._config.toggle) {
  4030. this.toggle();
  4031. }
  4032. } // Getters
  4033. var _proto = Collapse.prototype;
  4034. // Public
  4035. _proto.toggle = function toggle() {
  4036. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4037. this.hide();
  4038. } else {
  4039. this.show();
  4040. }
  4041. };
  4042. _proto.show = function show() {
  4043. var _this = this;
  4044. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4045. return;
  4046. }
  4047. var actives;
  4048. var activesData;
  4049. if (this._parent) {
  4050. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4051. if (typeof _this._config.parent === 'string') {
  4052. return elem.getAttribute('data-parent') === _this._config.parent;
  4053. }
  4054. return elem.classList.contains(ClassName$3.COLLAPSE);
  4055. });
  4056. if (actives.length === 0) {
  4057. actives = null;
  4058. }
  4059. }
  4060. if (actives) {
  4061. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4062. if (activesData && activesData._isTransitioning) {
  4063. return;
  4064. }
  4065. }
  4066. var startEvent = $.Event(Event$3.SHOW);
  4067. $(this._element).trigger(startEvent);
  4068. if (startEvent.isDefaultPrevented()) {
  4069. return;
  4070. }
  4071. if (actives) {
  4072. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4073. if (!activesData) {
  4074. $(actives).data(DATA_KEY$3, null);
  4075. }
  4076. }
  4077. var dimension = this._getDimension();
  4078. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4079. this._element.style[dimension] = 0;
  4080. if (this._triggerArray.length) {
  4081. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4082. }
  4083. this.setTransitioning(true);
  4084. var complete = function complete() {
  4085. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4086. _this._element.style[dimension] = '';
  4087. _this.setTransitioning(false);
  4088. $(_this._element).trigger(Event$3.SHOWN);
  4089. };
  4090. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4091. var scrollSize = "scroll" + capitalizedDimension;
  4092. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4093. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4094. this._element.style[dimension] = this._element[scrollSize] + "px";
  4095. };
  4096. _proto.hide = function hide() {
  4097. var _this2 = this;
  4098. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4099. return;
  4100. }
  4101. var startEvent = $.Event(Event$3.HIDE);
  4102. $(this._element).trigger(startEvent);
  4103. if (startEvent.isDefaultPrevented()) {
  4104. return;
  4105. }
  4106. var dimension = this._getDimension();
  4107. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4108. Util.reflow(this._element);
  4109. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4110. var triggerArrayLength = this._triggerArray.length;
  4111. if (triggerArrayLength > 0) {
  4112. for (var i = 0; i < triggerArrayLength; i++) {
  4113. var trigger = this._triggerArray[i];
  4114. var selector = Util.getSelectorFromElement(trigger);
  4115. if (selector !== null) {
  4116. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4117. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4118. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4119. }
  4120. }
  4121. }
  4122. }
  4123. this.setTransitioning(true);
  4124. var complete = function complete() {
  4125. _this2.setTransitioning(false);
  4126. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4127. };
  4128. this._element.style[dimension] = '';
  4129. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4130. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4131. };
  4132. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4133. this._isTransitioning = isTransitioning;
  4134. };
  4135. _proto.dispose = function dispose() {
  4136. $.removeData(this._element, DATA_KEY$3);
  4137. this._config = null;
  4138. this._parent = null;
  4139. this._element = null;
  4140. this._triggerArray = null;
  4141. this._isTransitioning = null;
  4142. } // Private
  4143. ;
  4144. _proto._getConfig = function _getConfig(config) {
  4145. config = _objectSpread2({}, Default$1, {}, config);
  4146. config.toggle = Boolean(config.toggle); // Coerce string values
  4147. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4148. return config;
  4149. };
  4150. _proto._getDimension = function _getDimension() {
  4151. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4152. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4153. };
  4154. _proto._getParent = function _getParent() {
  4155. var _this3 = this;
  4156. var parent;
  4157. if (Util.isElement(this._config.parent)) {
  4158. parent = this._config.parent; // It's a jQuery object
  4159. if (typeof this._config.parent.jquery !== 'undefined') {
  4160. parent = this._config.parent[0];
  4161. }
  4162. } else {
  4163. parent = document.querySelector(this._config.parent);
  4164. }
  4165. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4166. var children = [].slice.call(parent.querySelectorAll(selector));
  4167. $(children).each(function (i, element) {
  4168. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4169. });
  4170. return parent;
  4171. };
  4172. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4173. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4174. if (triggerArray.length) {
  4175. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4176. }
  4177. } // Static
  4178. ;
  4179. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4180. var selector = Util.getSelectorFromElement(element);
  4181. return selector ? document.querySelector(selector) : null;
  4182. };
  4183. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4184. return this.each(function () {
  4185. var $this = $(this);
  4186. var data = $this.data(DATA_KEY$3);
  4187. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4188. if (!data && _config.toggle && /show|hide/.test(config)) {
  4189. _config.toggle = false;
  4190. }
  4191. if (!data) {
  4192. data = new Collapse(this, _config);
  4193. $this.data(DATA_KEY$3, data);
  4194. }
  4195. if (typeof config === 'string') {
  4196. if (typeof data[config] === 'undefined') {
  4197. throw new TypeError("No method named \"" + config + "\"");
  4198. }
  4199. data[config]();
  4200. }
  4201. });
  4202. };
  4203. _createClass(Collapse, null, [{
  4204. key: "VERSION",
  4205. get: function get() {
  4206. return VERSION$3;
  4207. }
  4208. }, {
  4209. key: "Default",
  4210. get: function get() {
  4211. return Default$1;
  4212. }
  4213. }]);
  4214. return Collapse;
  4215. }();
  4216. /**
  4217. * ------------------------------------------------------------------------
  4218. * Data Api implementation
  4219. * ------------------------------------------------------------------------
  4220. */
  4221. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4222. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4223. if (event.currentTarget.tagName === 'A') {
  4224. event.preventDefault();
  4225. }
  4226. var $trigger = $(this);
  4227. var selector = Util.getSelectorFromElement(this);
  4228. var selectors = [].slice.call(document.querySelectorAll(selector));
  4229. $(selectors).each(function () {
  4230. var $target = $(this);
  4231. var data = $target.data(DATA_KEY$3);
  4232. var config = data ? 'toggle' : $trigger.data();
  4233. Collapse._jQueryInterface.call($target, config);
  4234. });
  4235. });
  4236. /**
  4237. * ------------------------------------------------------------------------
  4238. * jQuery
  4239. * ------------------------------------------------------------------------
  4240. */
  4241. $.fn[NAME$3] = Collapse._jQueryInterface;
  4242. $.fn[NAME$3].Constructor = Collapse;
  4243. $.fn[NAME$3].noConflict = function () {
  4244. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4245. return Collapse._jQueryInterface;
  4246. };
  4247. /**
  4248. * ------------------------------------------------------------------------
  4249. * Constants
  4250. * ------------------------------------------------------------------------
  4251. */
  4252. var NAME$4 = 'dropdown';
  4253. var VERSION$4 = '4.4.1';
  4254. var DATA_KEY$4 = 'bs.dropdown';
  4255. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4256. var DATA_API_KEY$4 = '.data-api';
  4257. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4258. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4259. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4260. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4261. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4262. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4263. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4264. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4265. var Event$4 = {
  4266. HIDE: "hide" + EVENT_KEY$4,
  4267. HIDDEN: "hidden" + EVENT_KEY$4,
  4268. SHOW: "show" + EVENT_KEY$4,
  4269. SHOWN: "shown" + EVENT_KEY$4,
  4270. CLICK: "click" + EVENT_KEY$4,
  4271. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4272. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4273. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4274. };
  4275. var ClassName$4 = {
  4276. DISABLED: 'disabled',
  4277. SHOW: 'show',
  4278. DROPUP: 'dropup',
  4279. DROPRIGHT: 'dropright',
  4280. DROPLEFT: 'dropleft',
  4281. MENURIGHT: 'dropdown-menu-right',
  4282. MENULEFT: 'dropdown-menu-left',
  4283. POSITION_STATIC: 'position-static'
  4284. };
  4285. var Selector$4 = {
  4286. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4287. FORM_CHILD: '.dropdown form',
  4288. MENU: '.dropdown-menu',
  4289. NAVBAR_NAV: '.navbar-nav',
  4290. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4291. };
  4292. var AttachmentMap = {
  4293. TOP: 'top-start',
  4294. TOPEND: 'top-end',
  4295. BOTTOM: 'bottom-start',
  4296. BOTTOMEND: 'bottom-end',
  4297. RIGHT: 'right-start',
  4298. RIGHTEND: 'right-end',
  4299. LEFT: 'left-start',
  4300. LEFTEND: 'left-end'
  4301. };
  4302. var Default$2 = {
  4303. offset: 0,
  4304. flip: true,
  4305. boundary: 'scrollParent',
  4306. reference: 'toggle',
  4307. display: 'dynamic',
  4308. popperConfig: null
  4309. };
  4310. var DefaultType$2 = {
  4311. offset: '(number|string|function)',
  4312. flip: 'boolean',
  4313. boundary: '(string|element)',
  4314. reference: '(string|element)',
  4315. display: 'string',
  4316. popperConfig: '(null|object)'
  4317. };
  4318. /**
  4319. * ------------------------------------------------------------------------
  4320. * Class Definition
  4321. * ------------------------------------------------------------------------
  4322. */
  4323. var Dropdown =
  4324. /*#__PURE__*/
  4325. function () {
  4326. function Dropdown(element, config) {
  4327. this._element = element;
  4328. this._popper = null;
  4329. this._config = this._getConfig(config);
  4330. this._menu = this._getMenuElement();
  4331. this._inNavbar = this._detectNavbar();
  4332. this._addEventListeners();
  4333. } // Getters
  4334. var _proto = Dropdown.prototype;
  4335. // Public
  4336. _proto.toggle = function toggle() {
  4337. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4338. return;
  4339. }
  4340. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4341. Dropdown._clearMenus();
  4342. if (isActive) {
  4343. return;
  4344. }
  4345. this.show(true);
  4346. };
  4347. _proto.show = function show(usePopper) {
  4348. if (usePopper === void 0) {
  4349. usePopper = false;
  4350. }
  4351. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4352. return;
  4353. }
  4354. var relatedTarget = {
  4355. relatedTarget: this._element
  4356. };
  4357. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4358. var parent = Dropdown._getParentFromElement(this._element);
  4359. $(parent).trigger(showEvent);
  4360. if (showEvent.isDefaultPrevented()) {
  4361. return;
  4362. } // Disable totally Popper.js for Dropdown in Navbar
  4363. if (!this._inNavbar && usePopper) {
  4364. /**
  4365. * Check for Popper dependency
  4366. * Popper - https://popper.js.org
  4367. */
  4368. if (typeof Popper === 'undefined') {
  4369. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4370. }
  4371. var referenceElement = this._element;
  4372. if (this._config.reference === 'parent') {
  4373. referenceElement = parent;
  4374. } else if (Util.isElement(this._config.reference)) {
  4375. referenceElement = this._config.reference; // Check if it's jQuery element
  4376. if (typeof this._config.reference.jquery !== 'undefined') {
  4377. referenceElement = this._config.reference[0];
  4378. }
  4379. } // If boundary is not `scrollParent`, then set position to `static`
  4380. // to allow the menu to "escape" the scroll parent's boundaries
  4381. // https://github.com/twbs/bootstrap/issues/24251
  4382. if (this._config.boundary !== 'scrollParent') {
  4383. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4384. }
  4385. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4386. } // If this is a touch-enabled device we add extra
  4387. // empty mouseover listeners to the body's immediate children;
  4388. // only needed because of broken event delegation on iOS
  4389. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4390. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4391. $(document.body).children().on('mouseover', null, $.noop);
  4392. }
  4393. this._element.focus();
  4394. this._element.setAttribute('aria-expanded', true);
  4395. $(this._menu).toggleClass(ClassName$4.SHOW);
  4396. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4397. };
  4398. _proto.hide = function hide() {
  4399. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4400. return;
  4401. }
  4402. var relatedTarget = {
  4403. relatedTarget: this._element
  4404. };
  4405. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4406. var parent = Dropdown._getParentFromElement(this._element);
  4407. $(parent).trigger(hideEvent);
  4408. if (hideEvent.isDefaultPrevented()) {
  4409. return;
  4410. }
  4411. if (this._popper) {
  4412. this._popper.destroy();
  4413. }
  4414. $(this._menu).toggleClass(ClassName$4.SHOW);
  4415. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4416. };
  4417. _proto.dispose = function dispose() {
  4418. $.removeData(this._element, DATA_KEY$4);
  4419. $(this._element).off(EVENT_KEY$4);
  4420. this._element = null;
  4421. this._menu = null;
  4422. if (this._popper !== null) {
  4423. this._popper.destroy();
  4424. this._popper = null;
  4425. }
  4426. };
  4427. _proto.update = function update() {
  4428. this._inNavbar = this._detectNavbar();
  4429. if (this._popper !== null) {
  4430. this._popper.scheduleUpdate();
  4431. }
  4432. } // Private
  4433. ;
  4434. _proto._addEventListeners = function _addEventListeners() {
  4435. var _this = this;
  4436. $(this._element).on(Event$4.CLICK, function (event) {
  4437. event.preventDefault();
  4438. event.stopPropagation();
  4439. _this.toggle();
  4440. });
  4441. };
  4442. _proto._getConfig = function _getConfig(config) {
  4443. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4444. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4445. return config;
  4446. };
  4447. _proto._getMenuElement = function _getMenuElement() {
  4448. if (!this._menu) {
  4449. var parent = Dropdown._getParentFromElement(this._element);
  4450. if (parent) {
  4451. this._menu = parent.querySelector(Selector$4.MENU);
  4452. }
  4453. }
  4454. return this._menu;
  4455. };
  4456. _proto._getPlacement = function _getPlacement() {
  4457. var $parentDropdown = $(this._element.parentNode);
  4458. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4459. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4460. placement = AttachmentMap.TOP;
  4461. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4462. placement = AttachmentMap.TOPEND;
  4463. }
  4464. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4465. placement = AttachmentMap.RIGHT;
  4466. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4467. placement = AttachmentMap.LEFT;
  4468. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4469. placement = AttachmentMap.BOTTOMEND;
  4470. }
  4471. return placement;
  4472. };
  4473. _proto._detectNavbar = function _detectNavbar() {
  4474. return $(this._element).closest('.navbar').length > 0;
  4475. };
  4476. _proto._getOffset = function _getOffset() {
  4477. var _this2 = this;
  4478. var offset = {};
  4479. if (typeof this._config.offset === 'function') {
  4480. offset.fn = function (data) {
  4481. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4482. return data;
  4483. };
  4484. } else {
  4485. offset.offset = this._config.offset;
  4486. }
  4487. return offset;
  4488. };
  4489. _proto._getPopperConfig = function _getPopperConfig() {
  4490. var popperConfig = {
  4491. placement: this._getPlacement(),
  4492. modifiers: {
  4493. offset: this._getOffset(),
  4494. flip: {
  4495. enabled: this._config.flip
  4496. },
  4497. preventOverflow: {
  4498. boundariesElement: this._config.boundary
  4499. }
  4500. }
  4501. }; // Disable Popper.js if we have a static display
  4502. if (this._config.display === 'static') {
  4503. popperConfig.modifiers.applyStyle = {
  4504. enabled: false
  4505. };
  4506. }
  4507. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4508. } // Static
  4509. ;
  4510. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4511. return this.each(function () {
  4512. var data = $(this).data(DATA_KEY$4);
  4513. var _config = typeof config === 'object' ? config : null;
  4514. if (!data) {
  4515. data = new Dropdown(this, _config);
  4516. $(this).data(DATA_KEY$4, data);
  4517. }
  4518. if (typeof config === 'string') {
  4519. if (typeof data[config] === 'undefined') {
  4520. throw new TypeError("No method named \"" + config + "\"");
  4521. }
  4522. data[config]();
  4523. }
  4524. });
  4525. };
  4526. Dropdown._clearMenus = function _clearMenus(event) {
  4527. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4528. return;
  4529. }
  4530. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4531. for (var i = 0, len = toggles.length; i < len; i++) {
  4532. var parent = Dropdown._getParentFromElement(toggles[i]);
  4533. var context = $(toggles[i]).data(DATA_KEY$4);
  4534. var relatedTarget = {
  4535. relatedTarget: toggles[i]
  4536. };
  4537. if (event && event.type === 'click') {
  4538. relatedTarget.clickEvent = event;
  4539. }
  4540. if (!context) {
  4541. continue;
  4542. }
  4543. var dropdownMenu = context._menu;
  4544. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4545. continue;
  4546. }
  4547. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4548. continue;
  4549. }
  4550. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4551. $(parent).trigger(hideEvent);
  4552. if (hideEvent.isDefaultPrevented()) {
  4553. continue;
  4554. } // If this is a touch-enabled device we remove the extra
  4555. // empty mouseover listeners we added for iOS support
  4556. if ('ontouchstart' in document.documentElement) {
  4557. $(document.body).children().off('mouseover', null, $.noop);
  4558. }
  4559. toggles[i].setAttribute('aria-expanded', 'false');
  4560. if (context._popper) {
  4561. context._popper.destroy();
  4562. }
  4563. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4564. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4565. }
  4566. };
  4567. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4568. var parent;
  4569. var selector = Util.getSelectorFromElement(element);
  4570. if (selector) {
  4571. parent = document.querySelector(selector);
  4572. }
  4573. return parent || element.parentNode;
  4574. } // eslint-disable-next-line complexity
  4575. ;
  4576. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4577. // If not input/textarea:
  4578. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4579. // If input/textarea:
  4580. // - If space key => not a dropdown command
  4581. // - If key is other than escape
  4582. // - If key is not up or down => not a dropdown command
  4583. // - If trigger inside the menu => not a dropdown command
  4584. 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)) {
  4585. return;
  4586. }
  4587. event.preventDefault();
  4588. event.stopPropagation();
  4589. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4590. return;
  4591. }
  4592. var parent = Dropdown._getParentFromElement(this);
  4593. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4594. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4595. return;
  4596. }
  4597. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4598. if (event.which === ESCAPE_KEYCODE) {
  4599. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4600. $(toggle).trigger('focus');
  4601. }
  4602. $(this).trigger('click');
  4603. return;
  4604. }
  4605. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4606. return $(item).is(':visible');
  4607. });
  4608. if (items.length === 0) {
  4609. return;
  4610. }
  4611. var index = items.indexOf(event.target);
  4612. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4613. // Up
  4614. index--;
  4615. }
  4616. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4617. // Down
  4618. index++;
  4619. }
  4620. if (index < 0) {
  4621. index = 0;
  4622. }
  4623. items[index].focus();
  4624. };
  4625. _createClass(Dropdown, null, [{
  4626. key: "VERSION",
  4627. get: function get() {
  4628. return VERSION$4;
  4629. }
  4630. }, {
  4631. key: "Default",
  4632. get: function get() {
  4633. return Default$2;
  4634. }
  4635. }, {
  4636. key: "DefaultType",
  4637. get: function get() {
  4638. return DefaultType$2;
  4639. }
  4640. }]);
  4641. return Dropdown;
  4642. }();
  4643. /**
  4644. * ------------------------------------------------------------------------
  4645. * Data Api implementation
  4646. * ------------------------------------------------------------------------
  4647. */
  4648. $(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) {
  4649. event.preventDefault();
  4650. event.stopPropagation();
  4651. Dropdown._jQueryInterface.call($(this), 'toggle');
  4652. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4653. e.stopPropagation();
  4654. });
  4655. /**
  4656. * ------------------------------------------------------------------------
  4657. * jQuery
  4658. * ------------------------------------------------------------------------
  4659. */
  4660. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4661. $.fn[NAME$4].Constructor = Dropdown;
  4662. $.fn[NAME$4].noConflict = function () {
  4663. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4664. return Dropdown._jQueryInterface;
  4665. };
  4666. /**
  4667. * ------------------------------------------------------------------------
  4668. * Constants
  4669. * ------------------------------------------------------------------------
  4670. */
  4671. var NAME$5 = 'modal';
  4672. var VERSION$5 = '4.4.1';
  4673. var DATA_KEY$5 = 'bs.modal';
  4674. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4675. var DATA_API_KEY$5 = '.data-api';
  4676. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4677. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4678. var Default$3 = {
  4679. backdrop: true,
  4680. keyboard: true,
  4681. focus: true,
  4682. show: true
  4683. };
  4684. var DefaultType$3 = {
  4685. backdrop: '(boolean|string)',
  4686. keyboard: 'boolean',
  4687. focus: 'boolean',
  4688. show: 'boolean'
  4689. };
  4690. var Event$5 = {
  4691. HIDE: "hide" + EVENT_KEY$5,
  4692. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4693. HIDDEN: "hidden" + EVENT_KEY$5,
  4694. SHOW: "show" + EVENT_KEY$5,
  4695. SHOWN: "shown" + EVENT_KEY$5,
  4696. FOCUSIN: "focusin" + EVENT_KEY$5,
  4697. RESIZE: "resize" + EVENT_KEY$5,
  4698. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4699. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4700. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4701. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4702. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4703. };
  4704. var ClassName$5 = {
  4705. SCROLLABLE: 'modal-dialog-scrollable',
  4706. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4707. BACKDROP: 'modal-backdrop',
  4708. OPEN: 'modal-open',
  4709. FADE: 'fade',
  4710. SHOW: 'show',
  4711. STATIC: 'modal-static'
  4712. };
  4713. var Selector$5 = {
  4714. DIALOG: '.modal-dialog',
  4715. MODAL_BODY: '.modal-body',
  4716. DATA_TOGGLE: '[data-toggle="modal"]',
  4717. DATA_DISMISS: '[data-dismiss="modal"]',
  4718. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4719. STICKY_CONTENT: '.sticky-top'
  4720. };
  4721. /**
  4722. * ------------------------------------------------------------------------
  4723. * Class Definition
  4724. * ------------------------------------------------------------------------
  4725. */
  4726. var Modal =
  4727. /*#__PURE__*/
  4728. function () {
  4729. function Modal(element, config) {
  4730. this._config = this._getConfig(config);
  4731. this._element = element;
  4732. this._dialog = element.querySelector(Selector$5.DIALOG);
  4733. this._backdrop = null;
  4734. this._isShown = false;
  4735. this._isBodyOverflowing = false;
  4736. this._ignoreBackdropClick = false;
  4737. this._isTransitioning = false;
  4738. this._scrollbarWidth = 0;
  4739. } // Getters
  4740. var _proto = Modal.prototype;
  4741. // Public
  4742. _proto.toggle = function toggle(relatedTarget) {
  4743. return this._isShown ? this.hide() : this.show(relatedTarget);
  4744. };
  4745. _proto.show = function show(relatedTarget) {
  4746. var _this = this;
  4747. if (this._isShown || this._isTransitioning) {
  4748. return;
  4749. }
  4750. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4751. this._isTransitioning = true;
  4752. }
  4753. var showEvent = $.Event(Event$5.SHOW, {
  4754. relatedTarget: relatedTarget
  4755. });
  4756. $(this._element).trigger(showEvent);
  4757. if (this._isShown || showEvent.isDefaultPrevented()) {
  4758. return;
  4759. }
  4760. this._isShown = true;
  4761. this._checkScrollbar();
  4762. this._setScrollbar();
  4763. this._adjustDialog();
  4764. this._setEscapeEvent();
  4765. this._setResizeEvent();
  4766. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4767. return _this.hide(event);
  4768. });
  4769. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4770. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4771. if ($(event.target).is(_this._element)) {
  4772. _this._ignoreBackdropClick = true;
  4773. }
  4774. });
  4775. });
  4776. this._showBackdrop(function () {
  4777. return _this._showElement(relatedTarget);
  4778. });
  4779. };
  4780. _proto.hide = function hide(event) {
  4781. var _this2 = this;
  4782. if (event) {
  4783. event.preventDefault();
  4784. }
  4785. if (!this._isShown || this._isTransitioning) {
  4786. return;
  4787. }
  4788. var hideEvent = $.Event(Event$5.HIDE);
  4789. $(this._element).trigger(hideEvent);
  4790. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4791. return;
  4792. }
  4793. this._isShown = false;
  4794. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4795. if (transition) {
  4796. this._isTransitioning = true;
  4797. }
  4798. this._setEscapeEvent();
  4799. this._setResizeEvent();
  4800. $(document).off(Event$5.FOCUSIN);
  4801. $(this._element).removeClass(ClassName$5.SHOW);
  4802. $(this._element).off(Event$5.CLICK_DISMISS);
  4803. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4804. if (transition) {
  4805. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4806. $(this._element).one(Util.TRANSITION_END, function (event) {
  4807. return _this2._hideModal(event);
  4808. }).emulateTransitionEnd(transitionDuration);
  4809. } else {
  4810. this._hideModal();
  4811. }
  4812. };
  4813. _proto.dispose = function dispose() {
  4814. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4815. return $(htmlElement).off(EVENT_KEY$5);
  4816. });
  4817. /**
  4818. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4819. * Do not move `document` in `htmlElements` array
  4820. * It will remove `Event.CLICK_DATA_API` event that should remain
  4821. */
  4822. $(document).off(Event$5.FOCUSIN);
  4823. $.removeData(this._element, DATA_KEY$5);
  4824. this._config = null;
  4825. this._element = null;
  4826. this._dialog = null;
  4827. this._backdrop = null;
  4828. this._isShown = null;
  4829. this._isBodyOverflowing = null;
  4830. this._ignoreBackdropClick = null;
  4831. this._isTransitioning = null;
  4832. this._scrollbarWidth = null;
  4833. };
  4834. _proto.handleUpdate = function handleUpdate() {
  4835. this._adjustDialog();
  4836. } // Private
  4837. ;
  4838. _proto._getConfig = function _getConfig(config) {
  4839. config = _objectSpread2({}, Default$3, {}, config);
  4840. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4841. return config;
  4842. };
  4843. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4844. var _this3 = this;
  4845. if (this._config.backdrop === 'static') {
  4846. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4847. $(this._element).trigger(hideEventPrevented);
  4848. if (hideEventPrevented.defaultPrevented) {
  4849. return;
  4850. }
  4851. this._element.classList.add(ClassName$5.STATIC);
  4852. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4853. $(this._element).one(Util.TRANSITION_END, function () {
  4854. _this3._element.classList.remove(ClassName$5.STATIC);
  4855. }).emulateTransitionEnd(modalTransitionDuration);
  4856. this._element.focus();
  4857. } else {
  4858. this.hide();
  4859. }
  4860. };
  4861. _proto._showElement = function _showElement(relatedTarget) {
  4862. var _this4 = this;
  4863. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4864. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4865. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4866. // Don't move modal's DOM position
  4867. document.body.appendChild(this._element);
  4868. }
  4869. this._element.style.display = 'block';
  4870. this._element.removeAttribute('aria-hidden');
  4871. this._element.setAttribute('aria-modal', true);
  4872. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4873. modalBody.scrollTop = 0;
  4874. } else {
  4875. this._element.scrollTop = 0;
  4876. }
  4877. if (transition) {
  4878. Util.reflow(this._element);
  4879. }
  4880. $(this._element).addClass(ClassName$5.SHOW);
  4881. if (this._config.focus) {
  4882. this._enforceFocus();
  4883. }
  4884. var shownEvent = $.Event(Event$5.SHOWN, {
  4885. relatedTarget: relatedTarget
  4886. });
  4887. var transitionComplete = function transitionComplete() {
  4888. if (_this4._config.focus) {
  4889. _this4._element.focus();
  4890. }
  4891. _this4._isTransitioning = false;
  4892. $(_this4._element).trigger(shownEvent);
  4893. };
  4894. if (transition) {
  4895. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4896. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4897. } else {
  4898. transitionComplete();
  4899. }
  4900. };
  4901. _proto._enforceFocus = function _enforceFocus() {
  4902. var _this5 = this;
  4903. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4904. .on(Event$5.FOCUSIN, function (event) {
  4905. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4906. _this5._element.focus();
  4907. }
  4908. });
  4909. };
  4910. _proto._setEscapeEvent = function _setEscapeEvent() {
  4911. var _this6 = this;
  4912. if (this._isShown && this._config.keyboard) {
  4913. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4914. if (event.which === ESCAPE_KEYCODE$1) {
  4915. _this6._triggerBackdropTransition();
  4916. }
  4917. });
  4918. } else if (!this._isShown) {
  4919. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4920. }
  4921. };
  4922. _proto._setResizeEvent = function _setResizeEvent() {
  4923. var _this7 = this;
  4924. if (this._isShown) {
  4925. $(window).on(Event$5.RESIZE, function (event) {
  4926. return _this7.handleUpdate(event);
  4927. });
  4928. } else {
  4929. $(window).off(Event$5.RESIZE);
  4930. }
  4931. };
  4932. _proto._hideModal = function _hideModal() {
  4933. var _this8 = this;
  4934. this._element.style.display = 'none';
  4935. this._element.setAttribute('aria-hidden', true);
  4936. this._element.removeAttribute('aria-modal');
  4937. this._isTransitioning = false;
  4938. this._showBackdrop(function () {
  4939. $(document.body).removeClass(ClassName$5.OPEN);
  4940. _this8._resetAdjustments();
  4941. _this8._resetScrollbar();
  4942. $(_this8._element).trigger(Event$5.HIDDEN);
  4943. });
  4944. };
  4945. _proto._removeBackdrop = function _removeBackdrop() {
  4946. if (this._backdrop) {
  4947. $(this._backdrop).remove();
  4948. this._backdrop = null;
  4949. }
  4950. };
  4951. _proto._showBackdrop = function _showBackdrop(callback) {
  4952. var _this9 = this;
  4953. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4954. if (this._isShown && this._config.backdrop) {
  4955. this._backdrop = document.createElement('div');
  4956. this._backdrop.className = ClassName$5.BACKDROP;
  4957. if (animate) {
  4958. this._backdrop.classList.add(animate);
  4959. }
  4960. $(this._backdrop).appendTo(document.body);
  4961. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4962. if (_this9._ignoreBackdropClick) {
  4963. _this9._ignoreBackdropClick = false;
  4964. return;
  4965. }
  4966. if (event.target !== event.currentTarget) {
  4967. return;
  4968. }
  4969. _this9._triggerBackdropTransition();
  4970. });
  4971. if (animate) {
  4972. Util.reflow(this._backdrop);
  4973. }
  4974. $(this._backdrop).addClass(ClassName$5.SHOW);
  4975. if (!callback) {
  4976. return;
  4977. }
  4978. if (!animate) {
  4979. callback();
  4980. return;
  4981. }
  4982. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4983. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4984. } else if (!this._isShown && this._backdrop) {
  4985. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4986. var callbackRemove = function callbackRemove() {
  4987. _this9._removeBackdrop();
  4988. if (callback) {
  4989. callback();
  4990. }
  4991. };
  4992. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4993. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4994. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4995. } else {
  4996. callbackRemove();
  4997. }
  4998. } else if (callback) {
  4999. callback();
  5000. }
  5001. } // ----------------------------------------------------------------------
  5002. // the following methods are used to handle overflowing modals
  5003. // todo (fat): these should probably be refactored out of modal.js
  5004. // ----------------------------------------------------------------------
  5005. ;
  5006. _proto._adjustDialog = function _adjustDialog() {
  5007. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5008. if (!this._isBodyOverflowing && isModalOverflowing) {
  5009. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5010. }
  5011. if (this._isBodyOverflowing && !isModalOverflowing) {
  5012. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5013. }
  5014. };
  5015. _proto._resetAdjustments = function _resetAdjustments() {
  5016. this._element.style.paddingLeft = '';
  5017. this._element.style.paddingRight = '';
  5018. };
  5019. _proto._checkScrollbar = function _checkScrollbar() {
  5020. var rect = document.body.getBoundingClientRect();
  5021. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5022. this._scrollbarWidth = this._getScrollbarWidth();
  5023. };
  5024. _proto._setScrollbar = function _setScrollbar() {
  5025. var _this10 = this;
  5026. if (this._isBodyOverflowing) {
  5027. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5028. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5029. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5030. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5031. $(fixedContent).each(function (index, element) {
  5032. var actualPadding = element.style.paddingRight;
  5033. var calculatedPadding = $(element).css('padding-right');
  5034. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5035. }); // Adjust sticky content margin
  5036. $(stickyContent).each(function (index, element) {
  5037. var actualMargin = element.style.marginRight;
  5038. var calculatedMargin = $(element).css('margin-right');
  5039. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5040. }); // Adjust body padding
  5041. var actualPadding = document.body.style.paddingRight;
  5042. var calculatedPadding = $(document.body).css('padding-right');
  5043. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5044. }
  5045. $(document.body).addClass(ClassName$5.OPEN);
  5046. };
  5047. _proto._resetScrollbar = function _resetScrollbar() {
  5048. // Restore fixed content padding
  5049. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5050. $(fixedContent).each(function (index, element) {
  5051. var padding = $(element).data('padding-right');
  5052. $(element).removeData('padding-right');
  5053. element.style.paddingRight = padding ? padding : '';
  5054. }); // Restore sticky content
  5055. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5056. $(elements).each(function (index, element) {
  5057. var margin = $(element).data('margin-right');
  5058. if (typeof margin !== 'undefined') {
  5059. $(element).css('margin-right', margin).removeData('margin-right');
  5060. }
  5061. }); // Restore body padding
  5062. var padding = $(document.body).data('padding-right');
  5063. $(document.body).removeData('padding-right');
  5064. document.body.style.paddingRight = padding ? padding : '';
  5065. };
  5066. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5067. // thx d.walsh
  5068. var scrollDiv = document.createElement('div');
  5069. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5070. document.body.appendChild(scrollDiv);
  5071. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5072. document.body.removeChild(scrollDiv);
  5073. return scrollbarWidth;
  5074. } // Static
  5075. ;
  5076. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5077. return this.each(function () {
  5078. var data = $(this).data(DATA_KEY$5);
  5079. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5080. if (!data) {
  5081. data = new Modal(this, _config);
  5082. $(this).data(DATA_KEY$5, data);
  5083. }
  5084. if (typeof config === 'string') {
  5085. if (typeof data[config] === 'undefined') {
  5086. throw new TypeError("No method named \"" + config + "\"");
  5087. }
  5088. data[config](relatedTarget);
  5089. } else if (_config.show) {
  5090. data.show(relatedTarget);
  5091. }
  5092. });
  5093. };
  5094. _createClass(Modal, null, [{
  5095. key: "VERSION",
  5096. get: function get() {
  5097. return VERSION$5;
  5098. }
  5099. }, {
  5100. key: "Default",
  5101. get: function get() {
  5102. return Default$3;
  5103. }
  5104. }]);
  5105. return Modal;
  5106. }();
  5107. /**
  5108. * ------------------------------------------------------------------------
  5109. * Data Api implementation
  5110. * ------------------------------------------------------------------------
  5111. */
  5112. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5113. var _this11 = this;
  5114. var target;
  5115. var selector = Util.getSelectorFromElement(this);
  5116. if (selector) {
  5117. target = document.querySelector(selector);
  5118. }
  5119. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5120. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5121. event.preventDefault();
  5122. }
  5123. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5124. if (showEvent.isDefaultPrevented()) {
  5125. // Only register focus restorer if modal will actually get shown
  5126. return;
  5127. }
  5128. $target.one(Event$5.HIDDEN, function () {
  5129. if ($(_this11).is(':visible')) {
  5130. _this11.focus();
  5131. }
  5132. });
  5133. });
  5134. Modal._jQueryInterface.call($(target), config, this);
  5135. });
  5136. /**
  5137. * ------------------------------------------------------------------------
  5138. * jQuery
  5139. * ------------------------------------------------------------------------
  5140. */
  5141. $.fn[NAME$5] = Modal._jQueryInterface;
  5142. $.fn[NAME$5].Constructor = Modal;
  5143. $.fn[NAME$5].noConflict = function () {
  5144. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5145. return Modal._jQueryInterface;
  5146. };
  5147. /**
  5148. * --------------------------------------------------------------------------
  5149. * Bootstrap (v4.4.1): tools/sanitizer.js
  5150. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5151. * --------------------------------------------------------------------------
  5152. */
  5153. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5154. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5155. var DefaultWhitelist = {
  5156. // Global attributes allowed on any supplied element below.
  5157. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5158. a: ['target', 'href', 'title', 'rel'],
  5159. area: [],
  5160. b: [],
  5161. br: [],
  5162. col: [],
  5163. code: [],
  5164. div: [],
  5165. em: [],
  5166. hr: [],
  5167. h1: [],
  5168. h2: [],
  5169. h3: [],
  5170. h4: [],
  5171. h5: [],
  5172. h6: [],
  5173. i: [],
  5174. img: ['src', 'alt', 'title', 'width', 'height'],
  5175. li: [],
  5176. ol: [],
  5177. p: [],
  5178. pre: [],
  5179. s: [],
  5180. small: [],
  5181. span: [],
  5182. sub: [],
  5183. sup: [],
  5184. strong: [],
  5185. u: [],
  5186. ul: []
  5187. };
  5188. /**
  5189. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5190. *
  5191. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5192. */
  5193. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5194. /**
  5195. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5196. *
  5197. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5198. */
  5199. 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;
  5200. function allowedAttribute(attr, allowedAttributeList) {
  5201. var attrName = attr.nodeName.toLowerCase();
  5202. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5203. if (uriAttrs.indexOf(attrName) !== -1) {
  5204. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5205. }
  5206. return true;
  5207. }
  5208. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5209. return attrRegex instanceof RegExp;
  5210. }); // Check if a regular expression validates the attribute.
  5211. for (var i = 0, l = regExp.length; i < l; i++) {
  5212. if (attrName.match(regExp[i])) {
  5213. return true;
  5214. }
  5215. }
  5216. return false;
  5217. }
  5218. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5219. if (unsafeHtml.length === 0) {
  5220. return unsafeHtml;
  5221. }
  5222. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5223. return sanitizeFn(unsafeHtml);
  5224. }
  5225. var domParser = new window.DOMParser();
  5226. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5227. var whitelistKeys = Object.keys(whiteList);
  5228. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5229. var _loop = function _loop(i, len) {
  5230. var el = elements[i];
  5231. var elName = el.nodeName.toLowerCase();
  5232. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5233. el.parentNode.removeChild(el);
  5234. return "continue";
  5235. }
  5236. var attributeList = [].slice.call(el.attributes);
  5237. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5238. attributeList.forEach(function (attr) {
  5239. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5240. el.removeAttribute(attr.nodeName);
  5241. }
  5242. });
  5243. };
  5244. for (var i = 0, len = elements.length; i < len; i++) {
  5245. var _ret = _loop(i);
  5246. if (_ret === "continue") continue;
  5247. }
  5248. return createdDocument.body.innerHTML;
  5249. }
  5250. /**
  5251. * ------------------------------------------------------------------------
  5252. * Constants
  5253. * ------------------------------------------------------------------------
  5254. */
  5255. var NAME$6 = 'tooltip';
  5256. var VERSION$6 = '4.4.1';
  5257. var DATA_KEY$6 = 'bs.tooltip';
  5258. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5259. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5260. var CLASS_PREFIX = 'bs-tooltip';
  5261. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5262. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5263. var DefaultType$4 = {
  5264. animation: 'boolean',
  5265. template: 'string',
  5266. title: '(string|element|function)',
  5267. trigger: 'string',
  5268. delay: '(number|object)',
  5269. html: 'boolean',
  5270. selector: '(string|boolean)',
  5271. placement: '(string|function)',
  5272. offset: '(number|string|function)',
  5273. container: '(string|element|boolean)',
  5274. fallbackPlacement: '(string|array)',
  5275. boundary: '(string|element)',
  5276. sanitize: 'boolean',
  5277. sanitizeFn: '(null|function)',
  5278. whiteList: 'object',
  5279. popperConfig: '(null|object)'
  5280. };
  5281. var AttachmentMap$1 = {
  5282. AUTO: 'auto',
  5283. TOP: 'top',
  5284. RIGHT: 'right',
  5285. BOTTOM: 'bottom',
  5286. LEFT: 'left'
  5287. };
  5288. var Default$4 = {
  5289. animation: true,
  5290. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5291. trigger: 'hover focus',
  5292. title: '',
  5293. delay: 0,
  5294. html: false,
  5295. selector: false,
  5296. placement: 'top',
  5297. offset: 0,
  5298. container: false,
  5299. fallbackPlacement: 'flip',
  5300. boundary: 'scrollParent',
  5301. sanitize: true,
  5302. sanitizeFn: null,
  5303. whiteList: DefaultWhitelist,
  5304. popperConfig: null
  5305. };
  5306. var HoverState = {
  5307. SHOW: 'show',
  5308. OUT: 'out'
  5309. };
  5310. var Event$6 = {
  5311. HIDE: "hide" + EVENT_KEY$6,
  5312. HIDDEN: "hidden" + EVENT_KEY$6,
  5313. SHOW: "show" + EVENT_KEY$6,
  5314. SHOWN: "shown" + EVENT_KEY$6,
  5315. INSERTED: "inserted" + EVENT_KEY$6,
  5316. CLICK: "click" + EVENT_KEY$6,
  5317. FOCUSIN: "focusin" + EVENT_KEY$6,
  5318. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5319. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5320. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5321. };
  5322. var ClassName$6 = {
  5323. FADE: 'fade',
  5324. SHOW: 'show'
  5325. };
  5326. var Selector$6 = {
  5327. TOOLTIP: '.tooltip',
  5328. TOOLTIP_INNER: '.tooltip-inner',
  5329. ARROW: '.arrow'
  5330. };
  5331. var Trigger = {
  5332. HOVER: 'hover',
  5333. FOCUS: 'focus',
  5334. CLICK: 'click',
  5335. MANUAL: 'manual'
  5336. };
  5337. /**
  5338. * ------------------------------------------------------------------------
  5339. * Class Definition
  5340. * ------------------------------------------------------------------------
  5341. */
  5342. var Tooltip =
  5343. /*#__PURE__*/
  5344. function () {
  5345. function Tooltip(element, config) {
  5346. if (typeof Popper === 'undefined') {
  5347. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5348. } // private
  5349. this._isEnabled = true;
  5350. this._timeout = 0;
  5351. this._hoverState = '';
  5352. this._activeTrigger = {};
  5353. this._popper = null; // Protected
  5354. this.element = element;
  5355. this.config = this._getConfig(config);
  5356. this.tip = null;
  5357. this._setListeners();
  5358. } // Getters
  5359. var _proto = Tooltip.prototype;
  5360. // Public
  5361. _proto.enable = function enable() {
  5362. this._isEnabled = true;
  5363. };
  5364. _proto.disable = function disable() {
  5365. this._isEnabled = false;
  5366. };
  5367. _proto.toggleEnabled = function toggleEnabled() {
  5368. this._isEnabled = !this._isEnabled;
  5369. };
  5370. _proto.toggle = function toggle(event) {
  5371. if (!this._isEnabled) {
  5372. return;
  5373. }
  5374. if (event) {
  5375. var dataKey = this.constructor.DATA_KEY;
  5376. var context = $(event.currentTarget).data(dataKey);
  5377. if (!context) {
  5378. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5379. $(event.currentTarget).data(dataKey, context);
  5380. }
  5381. context._activeTrigger.click = !context._activeTrigger.click;
  5382. if (context._isWithActiveTrigger()) {
  5383. context._enter(null, context);
  5384. } else {
  5385. context._leave(null, context);
  5386. }
  5387. } else {
  5388. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5389. this._leave(null, this);
  5390. return;
  5391. }
  5392. this._enter(null, this);
  5393. }
  5394. };
  5395. _proto.dispose = function dispose() {
  5396. clearTimeout(this._timeout);
  5397. $.removeData(this.element, this.constructor.DATA_KEY);
  5398. $(this.element).off(this.constructor.EVENT_KEY);
  5399. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5400. if (this.tip) {
  5401. $(this.tip).remove();
  5402. }
  5403. this._isEnabled = null;
  5404. this._timeout = null;
  5405. this._hoverState = null;
  5406. this._activeTrigger = null;
  5407. if (this._popper) {
  5408. this._popper.destroy();
  5409. }
  5410. this._popper = null;
  5411. this.element = null;
  5412. this.config = null;
  5413. this.tip = null;
  5414. };
  5415. _proto.show = function show() {
  5416. var _this = this;
  5417. if ($(this.element).css('display') === 'none') {
  5418. throw new Error('Please use show on visible elements');
  5419. }
  5420. var showEvent = $.Event(this.constructor.Event.SHOW);
  5421. if (this.isWithContent() && this._isEnabled) {
  5422. $(this.element).trigger(showEvent);
  5423. var shadowRoot = Util.findShadowRoot(this.element);
  5424. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5425. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5426. return;
  5427. }
  5428. var tip = this.getTipElement();
  5429. var tipId = Util.getUID(this.constructor.NAME);
  5430. tip.setAttribute('id', tipId);
  5431. this.element.setAttribute('aria-describedby', tipId);
  5432. this.setContent();
  5433. if (this.config.animation) {
  5434. $(tip).addClass(ClassName$6.FADE);
  5435. }
  5436. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5437. var attachment = this._getAttachment(placement);
  5438. this.addAttachmentClass(attachment);
  5439. var container = this._getContainer();
  5440. $(tip).data(this.constructor.DATA_KEY, this);
  5441. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5442. $(tip).appendTo(container);
  5443. }
  5444. $(this.element).trigger(this.constructor.Event.INSERTED);
  5445. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5446. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5447. // empty mouseover listeners to the body's immediate children;
  5448. // only needed because of broken event delegation on iOS
  5449. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5450. if ('ontouchstart' in document.documentElement) {
  5451. $(document.body).children().on('mouseover', null, $.noop);
  5452. }
  5453. var complete = function complete() {
  5454. if (_this.config.animation) {
  5455. _this._fixTransition();
  5456. }
  5457. var prevHoverState = _this._hoverState;
  5458. _this._hoverState = null;
  5459. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5460. if (prevHoverState === HoverState.OUT) {
  5461. _this._leave(null, _this);
  5462. }
  5463. };
  5464. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5465. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5466. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5467. } else {
  5468. complete();
  5469. }
  5470. }
  5471. };
  5472. _proto.hide = function hide(callback) {
  5473. var _this2 = this;
  5474. var tip = this.getTipElement();
  5475. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5476. var complete = function complete() {
  5477. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5478. tip.parentNode.removeChild(tip);
  5479. }
  5480. _this2._cleanTipClass();
  5481. _this2.element.removeAttribute('aria-describedby');
  5482. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5483. if (_this2._popper !== null) {
  5484. _this2._popper.destroy();
  5485. }
  5486. if (callback) {
  5487. callback();
  5488. }
  5489. };
  5490. $(this.element).trigger(hideEvent);
  5491. if (hideEvent.isDefaultPrevented()) {
  5492. return;
  5493. }
  5494. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5495. // empty mouseover listeners we added for iOS support
  5496. if ('ontouchstart' in document.documentElement) {
  5497. $(document.body).children().off('mouseover', null, $.noop);
  5498. }
  5499. this._activeTrigger[Trigger.CLICK] = false;
  5500. this._activeTrigger[Trigger.FOCUS] = false;
  5501. this._activeTrigger[Trigger.HOVER] = false;
  5502. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5503. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5504. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5505. } else {
  5506. complete();
  5507. }
  5508. this._hoverState = '';
  5509. };
  5510. _proto.update = function update() {
  5511. if (this._popper !== null) {
  5512. this._popper.scheduleUpdate();
  5513. }
  5514. } // Protected
  5515. ;
  5516. _proto.isWithContent = function isWithContent() {
  5517. return Boolean(this.getTitle());
  5518. };
  5519. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5520. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5521. };
  5522. _proto.getTipElement = function getTipElement() {
  5523. this.tip = this.tip || $(this.config.template)[0];
  5524. return this.tip;
  5525. };
  5526. _proto.setContent = function setContent() {
  5527. var tip = this.getTipElement();
  5528. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5529. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5530. };
  5531. _proto.setElementContent = function setElementContent($element, content) {
  5532. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5533. // Content is a DOM node or a jQuery
  5534. if (this.config.html) {
  5535. if (!$(content).parent().is($element)) {
  5536. $element.empty().append(content);
  5537. }
  5538. } else {
  5539. $element.text($(content).text());
  5540. }
  5541. return;
  5542. }
  5543. if (this.config.html) {
  5544. if (this.config.sanitize) {
  5545. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5546. }
  5547. $element.html(content);
  5548. } else {
  5549. $element.text(content);
  5550. }
  5551. };
  5552. _proto.getTitle = function getTitle() {
  5553. var title = this.element.getAttribute('data-original-title');
  5554. if (!title) {
  5555. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5556. }
  5557. return title;
  5558. } // Private
  5559. ;
  5560. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5561. var _this3 = this;
  5562. var defaultBsConfig = {
  5563. placement: attachment,
  5564. modifiers: {
  5565. offset: this._getOffset(),
  5566. flip: {
  5567. behavior: this.config.fallbackPlacement
  5568. },
  5569. arrow: {
  5570. element: Selector$6.ARROW
  5571. },
  5572. preventOverflow: {
  5573. boundariesElement: this.config.boundary
  5574. }
  5575. },
  5576. onCreate: function onCreate(data) {
  5577. if (data.originalPlacement !== data.placement) {
  5578. _this3._handlePopperPlacementChange(data);
  5579. }
  5580. },
  5581. onUpdate: function onUpdate(data) {
  5582. return _this3._handlePopperPlacementChange(data);
  5583. }
  5584. };
  5585. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5586. };
  5587. _proto._getOffset = function _getOffset() {
  5588. var _this4 = this;
  5589. var offset = {};
  5590. if (typeof this.config.offset === 'function') {
  5591. offset.fn = function (data) {
  5592. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5593. return data;
  5594. };
  5595. } else {
  5596. offset.offset = this.config.offset;
  5597. }
  5598. return offset;
  5599. };
  5600. _proto._getContainer = function _getContainer() {
  5601. if (this.config.container === false) {
  5602. return document.body;
  5603. }
  5604. if (Util.isElement(this.config.container)) {
  5605. return $(this.config.container);
  5606. }
  5607. return $(document).find(this.config.container);
  5608. };
  5609. _proto._getAttachment = function _getAttachment(placement) {
  5610. return AttachmentMap$1[placement.toUpperCase()];
  5611. };
  5612. _proto._setListeners = function _setListeners() {
  5613. var _this5 = this;
  5614. var triggers = this.config.trigger.split(' ');
  5615. triggers.forEach(function (trigger) {
  5616. if (trigger === 'click') {
  5617. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5618. return _this5.toggle(event);
  5619. });
  5620. } else if (trigger !== Trigger.MANUAL) {
  5621. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5622. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5623. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5624. return _this5._enter(event);
  5625. }).on(eventOut, _this5.config.selector, function (event) {
  5626. return _this5._leave(event);
  5627. });
  5628. }
  5629. });
  5630. this._hideModalHandler = function () {
  5631. if (_this5.element) {
  5632. _this5.hide();
  5633. }
  5634. };
  5635. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5636. if (this.config.selector) {
  5637. this.config = _objectSpread2({}, this.config, {
  5638. trigger: 'manual',
  5639. selector: ''
  5640. });
  5641. } else {
  5642. this._fixTitle();
  5643. }
  5644. };
  5645. _proto._fixTitle = function _fixTitle() {
  5646. var titleType = typeof this.element.getAttribute('data-original-title');
  5647. if (this.element.getAttribute('title') || titleType !== 'string') {
  5648. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5649. this.element.setAttribute('title', '');
  5650. }
  5651. };
  5652. _proto._enter = function _enter(event, context) {
  5653. var dataKey = this.constructor.DATA_KEY;
  5654. context = context || $(event.currentTarget).data(dataKey);
  5655. if (!context) {
  5656. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5657. $(event.currentTarget).data(dataKey, context);
  5658. }
  5659. if (event) {
  5660. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5661. }
  5662. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5663. context._hoverState = HoverState.SHOW;
  5664. return;
  5665. }
  5666. clearTimeout(context._timeout);
  5667. context._hoverState = HoverState.SHOW;
  5668. if (!context.config.delay || !context.config.delay.show) {
  5669. context.show();
  5670. return;
  5671. }
  5672. context._timeout = setTimeout(function () {
  5673. if (context._hoverState === HoverState.SHOW) {
  5674. context.show();
  5675. }
  5676. }, context.config.delay.show);
  5677. };
  5678. _proto._leave = function _leave(event, context) {
  5679. var dataKey = this.constructor.DATA_KEY;
  5680. context = context || $(event.currentTarget).data(dataKey);
  5681. if (!context) {
  5682. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5683. $(event.currentTarget).data(dataKey, context);
  5684. }
  5685. if (event) {
  5686. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5687. }
  5688. if (context._isWithActiveTrigger()) {
  5689. return;
  5690. }
  5691. clearTimeout(context._timeout);
  5692. context._hoverState = HoverState.OUT;
  5693. if (!context.config.delay || !context.config.delay.hide) {
  5694. context.hide();
  5695. return;
  5696. }
  5697. context._timeout = setTimeout(function () {
  5698. if (context._hoverState === HoverState.OUT) {
  5699. context.hide();
  5700. }
  5701. }, context.config.delay.hide);
  5702. };
  5703. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5704. for (var trigger in this._activeTrigger) {
  5705. if (this._activeTrigger[trigger]) {
  5706. return true;
  5707. }
  5708. }
  5709. return false;
  5710. };
  5711. _proto._getConfig = function _getConfig(config) {
  5712. var dataAttributes = $(this.element).data();
  5713. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5714. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5715. delete dataAttributes[dataAttr];
  5716. }
  5717. });
  5718. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5719. if (typeof config.delay === 'number') {
  5720. config.delay = {
  5721. show: config.delay,
  5722. hide: config.delay
  5723. };
  5724. }
  5725. if (typeof config.title === 'number') {
  5726. config.title = config.title.toString();
  5727. }
  5728. if (typeof config.content === 'number') {
  5729. config.content = config.content.toString();
  5730. }
  5731. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5732. if (config.sanitize) {
  5733. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5734. }
  5735. return config;
  5736. };
  5737. _proto._getDelegateConfig = function _getDelegateConfig() {
  5738. var config = {};
  5739. if (this.config) {
  5740. for (var key in this.config) {
  5741. if (this.constructor.Default[key] !== this.config[key]) {
  5742. config[key] = this.config[key];
  5743. }
  5744. }
  5745. }
  5746. return config;
  5747. };
  5748. _proto._cleanTipClass = function _cleanTipClass() {
  5749. var $tip = $(this.getTipElement());
  5750. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5751. if (tabClass !== null && tabClass.length) {
  5752. $tip.removeClass(tabClass.join(''));
  5753. }
  5754. };
  5755. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5756. var popperInstance = popperData.instance;
  5757. this.tip = popperInstance.popper;
  5758. this._cleanTipClass();
  5759. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5760. };
  5761. _proto._fixTransition = function _fixTransition() {
  5762. var tip = this.getTipElement();
  5763. var initConfigAnimation = this.config.animation;
  5764. if (tip.getAttribute('x-placement') !== null) {
  5765. return;
  5766. }
  5767. $(tip).removeClass(ClassName$6.FADE);
  5768. this.config.animation = false;
  5769. this.hide();
  5770. this.show();
  5771. this.config.animation = initConfigAnimation;
  5772. } // Static
  5773. ;
  5774. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5775. return this.each(function () {
  5776. var data = $(this).data(DATA_KEY$6);
  5777. var _config = typeof config === 'object' && config;
  5778. if (!data && /dispose|hide/.test(config)) {
  5779. return;
  5780. }
  5781. if (!data) {
  5782. data = new Tooltip(this, _config);
  5783. $(this).data(DATA_KEY$6, data);
  5784. }
  5785. if (typeof config === 'string') {
  5786. if (typeof data[config] === 'undefined') {
  5787. throw new TypeError("No method named \"" + config + "\"");
  5788. }
  5789. data[config]();
  5790. }
  5791. });
  5792. };
  5793. _createClass(Tooltip, null, [{
  5794. key: "VERSION",
  5795. get: function get() {
  5796. return VERSION$6;
  5797. }
  5798. }, {
  5799. key: "Default",
  5800. get: function get() {
  5801. return Default$4;
  5802. }
  5803. }, {
  5804. key: "NAME",
  5805. get: function get() {
  5806. return NAME$6;
  5807. }
  5808. }, {
  5809. key: "DATA_KEY",
  5810. get: function get() {
  5811. return DATA_KEY$6;
  5812. }
  5813. }, {
  5814. key: "Event",
  5815. get: function get() {
  5816. return Event$6;
  5817. }
  5818. }, {
  5819. key: "EVENT_KEY",
  5820. get: function get() {
  5821. return EVENT_KEY$6;
  5822. }
  5823. }, {
  5824. key: "DefaultType",
  5825. get: function get() {
  5826. return DefaultType$4;
  5827. }
  5828. }]);
  5829. return Tooltip;
  5830. }();
  5831. /**
  5832. * ------------------------------------------------------------------------
  5833. * jQuery
  5834. * ------------------------------------------------------------------------
  5835. */
  5836. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5837. $.fn[NAME$6].Constructor = Tooltip;
  5838. $.fn[NAME$6].noConflict = function () {
  5839. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5840. return Tooltip._jQueryInterface;
  5841. };
  5842. /**
  5843. * ------------------------------------------------------------------------
  5844. * Constants
  5845. * ------------------------------------------------------------------------
  5846. */
  5847. var NAME$7 = 'popover';
  5848. var VERSION$7 = '4.4.1';
  5849. var DATA_KEY$7 = 'bs.popover';
  5850. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5851. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5852. var CLASS_PREFIX$1 = 'bs-popover';
  5853. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5854. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5855. placement: 'right',
  5856. trigger: 'click',
  5857. content: '',
  5858. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5859. });
  5860. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5861. content: '(string|element|function)'
  5862. });
  5863. var ClassName$7 = {
  5864. FADE: 'fade',
  5865. SHOW: 'show'
  5866. };
  5867. var Selector$7 = {
  5868. TITLE: '.popover-header',
  5869. CONTENT: '.popover-body'
  5870. };
  5871. var Event$7 = {
  5872. HIDE: "hide" + EVENT_KEY$7,
  5873. HIDDEN: "hidden" + EVENT_KEY$7,
  5874. SHOW: "show" + EVENT_KEY$7,
  5875. SHOWN: "shown" + EVENT_KEY$7,
  5876. INSERTED: "inserted" + EVENT_KEY$7,
  5877. CLICK: "click" + EVENT_KEY$7,
  5878. FOCUSIN: "focusin" + EVENT_KEY$7,
  5879. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5880. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5881. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5882. };
  5883. /**
  5884. * ------------------------------------------------------------------------
  5885. * Class Definition
  5886. * ------------------------------------------------------------------------
  5887. */
  5888. var Popover =
  5889. /*#__PURE__*/
  5890. function (_Tooltip) {
  5891. _inheritsLoose(Popover, _Tooltip);
  5892. function Popover() {
  5893. return _Tooltip.apply(this, arguments) || this;
  5894. }
  5895. var _proto = Popover.prototype;
  5896. // Overrides
  5897. _proto.isWithContent = function isWithContent() {
  5898. return this.getTitle() || this._getContent();
  5899. };
  5900. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5901. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5902. };
  5903. _proto.getTipElement = function getTipElement() {
  5904. this.tip = this.tip || $(this.config.template)[0];
  5905. return this.tip;
  5906. };
  5907. _proto.setContent = function setContent() {
  5908. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5909. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5910. var content = this._getContent();
  5911. if (typeof content === 'function') {
  5912. content = content.call(this.element);
  5913. }
  5914. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5915. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5916. } // Private
  5917. ;
  5918. _proto._getContent = function _getContent() {
  5919. return this.element.getAttribute('data-content') || this.config.content;
  5920. };
  5921. _proto._cleanTipClass = function _cleanTipClass() {
  5922. var $tip = $(this.getTipElement());
  5923. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5924. if (tabClass !== null && tabClass.length > 0) {
  5925. $tip.removeClass(tabClass.join(''));
  5926. }
  5927. } // Static
  5928. ;
  5929. Popover._jQueryInterface = function _jQueryInterface(config) {
  5930. return this.each(function () {
  5931. var data = $(this).data(DATA_KEY$7);
  5932. var _config = typeof config === 'object' ? config : null;
  5933. if (!data && /dispose|hide/.test(config)) {
  5934. return;
  5935. }
  5936. if (!data) {
  5937. data = new Popover(this, _config);
  5938. $(this).data(DATA_KEY$7, data);
  5939. }
  5940. if (typeof config === 'string') {
  5941. if (typeof data[config] === 'undefined') {
  5942. throw new TypeError("No method named \"" + config + "\"");
  5943. }
  5944. data[config]();
  5945. }
  5946. });
  5947. };
  5948. _createClass(Popover, null, [{
  5949. key: "VERSION",
  5950. // Getters
  5951. get: function get() {
  5952. return VERSION$7;
  5953. }
  5954. }, {
  5955. key: "Default",
  5956. get: function get() {
  5957. return Default$5;
  5958. }
  5959. }, {
  5960. key: "NAME",
  5961. get: function get() {
  5962. return NAME$7;
  5963. }
  5964. }, {
  5965. key: "DATA_KEY",
  5966. get: function get() {
  5967. return DATA_KEY$7;
  5968. }
  5969. }, {
  5970. key: "Event",
  5971. get: function get() {
  5972. return Event$7;
  5973. }
  5974. }, {
  5975. key: "EVENT_KEY",
  5976. get: function get() {
  5977. return EVENT_KEY$7;
  5978. }
  5979. }, {
  5980. key: "DefaultType",
  5981. get: function get() {
  5982. return DefaultType$5;
  5983. }
  5984. }]);
  5985. return Popover;
  5986. }(Tooltip);
  5987. /**
  5988. * ------------------------------------------------------------------------
  5989. * jQuery
  5990. * ------------------------------------------------------------------------
  5991. */
  5992. $.fn[NAME$7] = Popover._jQueryInterface;
  5993. $.fn[NAME$7].Constructor = Popover;
  5994. $.fn[NAME$7].noConflict = function () {
  5995. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5996. return Popover._jQueryInterface;
  5997. };
  5998. /**
  5999. * ------------------------------------------------------------------------
  6000. * Constants
  6001. * ------------------------------------------------------------------------
  6002. */
  6003. var NAME$8 = 'scrollspy';
  6004. var VERSION$8 = '4.4.1';
  6005. var DATA_KEY$8 = 'bs.scrollspy';
  6006. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6007. var DATA_API_KEY$6 = '.data-api';
  6008. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6009. var Default$6 = {
  6010. offset: 10,
  6011. method: 'auto',
  6012. target: ''
  6013. };
  6014. var DefaultType$6 = {
  6015. offset: 'number',
  6016. method: 'string',
  6017. target: '(string|element)'
  6018. };
  6019. var Event$8 = {
  6020. ACTIVATE: "activate" + EVENT_KEY$8,
  6021. SCROLL: "scroll" + EVENT_KEY$8,
  6022. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6023. };
  6024. var ClassName$8 = {
  6025. DROPDOWN_ITEM: 'dropdown-item',
  6026. DROPDOWN_MENU: 'dropdown-menu',
  6027. ACTIVE: 'active'
  6028. };
  6029. var Selector$8 = {
  6030. DATA_SPY: '[data-spy="scroll"]',
  6031. ACTIVE: '.active',
  6032. NAV_LIST_GROUP: '.nav, .list-group',
  6033. NAV_LINKS: '.nav-link',
  6034. NAV_ITEMS: '.nav-item',
  6035. LIST_ITEMS: '.list-group-item',
  6036. DROPDOWN: '.dropdown',
  6037. DROPDOWN_ITEMS: '.dropdown-item',
  6038. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6039. };
  6040. var OffsetMethod = {
  6041. OFFSET: 'offset',
  6042. POSITION: 'position'
  6043. };
  6044. /**
  6045. * ------------------------------------------------------------------------
  6046. * Class Definition
  6047. * ------------------------------------------------------------------------
  6048. */
  6049. var ScrollSpy =
  6050. /*#__PURE__*/
  6051. function () {
  6052. function ScrollSpy(element, config) {
  6053. var _this = this;
  6054. this._element = element;
  6055. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6056. this._config = this._getConfig(config);
  6057. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6058. this._offsets = [];
  6059. this._targets = [];
  6060. this._activeTarget = null;
  6061. this._scrollHeight = 0;
  6062. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6063. return _this._process(event);
  6064. });
  6065. this.refresh();
  6066. this._process();
  6067. } // Getters
  6068. var _proto = ScrollSpy.prototype;
  6069. // Public
  6070. _proto.refresh = function refresh() {
  6071. var _this2 = this;
  6072. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6073. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6074. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6075. this._offsets = [];
  6076. this._targets = [];
  6077. this._scrollHeight = this._getScrollHeight();
  6078. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6079. targets.map(function (element) {
  6080. var target;
  6081. var targetSelector = Util.getSelectorFromElement(element);
  6082. if (targetSelector) {
  6083. target = document.querySelector(targetSelector);
  6084. }
  6085. if (target) {
  6086. var targetBCR = target.getBoundingClientRect();
  6087. if (targetBCR.width || targetBCR.height) {
  6088. // TODO (fat): remove sketch reliance on jQuery position/offset
  6089. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6090. }
  6091. }
  6092. return null;
  6093. }).filter(function (item) {
  6094. return item;
  6095. }).sort(function (a, b) {
  6096. return a[0] - b[0];
  6097. }).forEach(function (item) {
  6098. _this2._offsets.push(item[0]);
  6099. _this2._targets.push(item[1]);
  6100. });
  6101. };
  6102. _proto.dispose = function dispose() {
  6103. $.removeData(this._element, DATA_KEY$8);
  6104. $(this._scrollElement).off(EVENT_KEY$8);
  6105. this._element = null;
  6106. this._scrollElement = null;
  6107. this._config = null;
  6108. this._selector = null;
  6109. this._offsets = null;
  6110. this._targets = null;
  6111. this._activeTarget = null;
  6112. this._scrollHeight = null;
  6113. } // Private
  6114. ;
  6115. _proto._getConfig = function _getConfig(config) {
  6116. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6117. if (typeof config.target !== 'string') {
  6118. var id = $(config.target).attr('id');
  6119. if (!id) {
  6120. id = Util.getUID(NAME$8);
  6121. $(config.target).attr('id', id);
  6122. }
  6123. config.target = "#" + id;
  6124. }
  6125. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6126. return config;
  6127. };
  6128. _proto._getScrollTop = function _getScrollTop() {
  6129. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6130. };
  6131. _proto._getScrollHeight = function _getScrollHeight() {
  6132. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6133. };
  6134. _proto._getOffsetHeight = function _getOffsetHeight() {
  6135. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6136. };
  6137. _proto._process = function _process() {
  6138. var scrollTop = this._getScrollTop() + this._config.offset;
  6139. var scrollHeight = this._getScrollHeight();
  6140. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6141. if (this._scrollHeight !== scrollHeight) {
  6142. this.refresh();
  6143. }
  6144. if (scrollTop >= maxScroll) {
  6145. var target = this._targets[this._targets.length - 1];
  6146. if (this._activeTarget !== target) {
  6147. this._activate(target);
  6148. }
  6149. return;
  6150. }
  6151. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6152. this._activeTarget = null;
  6153. this._clear();
  6154. return;
  6155. }
  6156. var offsetLength = this._offsets.length;
  6157. for (var i = offsetLength; i--;) {
  6158. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6159. if (isActiveTarget) {
  6160. this._activate(this._targets[i]);
  6161. }
  6162. }
  6163. };
  6164. _proto._activate = function _activate(target) {
  6165. this._activeTarget = target;
  6166. this._clear();
  6167. var queries = this._selector.split(',').map(function (selector) {
  6168. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6169. });
  6170. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6171. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6172. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6173. $link.addClass(ClassName$8.ACTIVE);
  6174. } else {
  6175. // Set triggered link as active
  6176. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6177. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6178. $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
  6179. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6180. }
  6181. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6182. relatedTarget: target
  6183. });
  6184. };
  6185. _proto._clear = function _clear() {
  6186. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6187. return node.classList.contains(ClassName$8.ACTIVE);
  6188. }).forEach(function (node) {
  6189. return node.classList.remove(ClassName$8.ACTIVE);
  6190. });
  6191. } // Static
  6192. ;
  6193. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6194. return this.each(function () {
  6195. var data = $(this).data(DATA_KEY$8);
  6196. var _config = typeof config === 'object' && config;
  6197. if (!data) {
  6198. data = new ScrollSpy(this, _config);
  6199. $(this).data(DATA_KEY$8, data);
  6200. }
  6201. if (typeof config === 'string') {
  6202. if (typeof data[config] === 'undefined') {
  6203. throw new TypeError("No method named \"" + config + "\"");
  6204. }
  6205. data[config]();
  6206. }
  6207. });
  6208. };
  6209. _createClass(ScrollSpy, null, [{
  6210. key: "VERSION",
  6211. get: function get() {
  6212. return VERSION$8;
  6213. }
  6214. }, {
  6215. key: "Default",
  6216. get: function get() {
  6217. return Default$6;
  6218. }
  6219. }]);
  6220. return ScrollSpy;
  6221. }();
  6222. /**
  6223. * ------------------------------------------------------------------------
  6224. * Data Api implementation
  6225. * ------------------------------------------------------------------------
  6226. */
  6227. $(window).on(Event$8.LOAD_DATA_API, function () {
  6228. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6229. var scrollSpysLength = scrollSpys.length;
  6230. for (var i = scrollSpysLength; i--;) {
  6231. var $spy = $(scrollSpys[i]);
  6232. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6233. }
  6234. });
  6235. /**
  6236. * ------------------------------------------------------------------------
  6237. * jQuery
  6238. * ------------------------------------------------------------------------
  6239. */
  6240. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6241. $.fn[NAME$8].Constructor = ScrollSpy;
  6242. $.fn[NAME$8].noConflict = function () {
  6243. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6244. return ScrollSpy._jQueryInterface;
  6245. };
  6246. /**
  6247. * ------------------------------------------------------------------------
  6248. * Constants
  6249. * ------------------------------------------------------------------------
  6250. */
  6251. var NAME$9 = 'tab';
  6252. var VERSION$9 = '4.4.1';
  6253. var DATA_KEY$9 = 'bs.tab';
  6254. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6255. var DATA_API_KEY$7 = '.data-api';
  6256. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6257. var Event$9 = {
  6258. HIDE: "hide" + EVENT_KEY$9,
  6259. HIDDEN: "hidden" + EVENT_KEY$9,
  6260. SHOW: "show" + EVENT_KEY$9,
  6261. SHOWN: "shown" + EVENT_KEY$9,
  6262. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6263. };
  6264. var ClassName$9 = {
  6265. DROPDOWN_MENU: 'dropdown-menu',
  6266. ACTIVE: 'active',
  6267. DISABLED: 'disabled',
  6268. FADE: 'fade',
  6269. SHOW: 'show'
  6270. };
  6271. var Selector$9 = {
  6272. DROPDOWN: '.dropdown',
  6273. NAV_LIST_GROUP: '.nav, .list-group',
  6274. ACTIVE: '.active',
  6275. ACTIVE_UL: '> li > .active',
  6276. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6277. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6278. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6279. };
  6280. /**
  6281. * ------------------------------------------------------------------------
  6282. * Class Definition
  6283. * ------------------------------------------------------------------------
  6284. */
  6285. var Tab =
  6286. /*#__PURE__*/
  6287. function () {
  6288. function Tab(element) {
  6289. this._element = element;
  6290. } // Getters
  6291. var _proto = Tab.prototype;
  6292. // Public
  6293. _proto.show = function show() {
  6294. var _this = this;
  6295. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6296. return;
  6297. }
  6298. var target;
  6299. var previous;
  6300. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6301. var selector = Util.getSelectorFromElement(this._element);
  6302. if (listElement) {
  6303. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6304. previous = $.makeArray($(listElement).find(itemSelector));
  6305. previous = previous[previous.length - 1];
  6306. }
  6307. var hideEvent = $.Event(Event$9.HIDE, {
  6308. relatedTarget: this._element
  6309. });
  6310. var showEvent = $.Event(Event$9.SHOW, {
  6311. relatedTarget: previous
  6312. });
  6313. if (previous) {
  6314. $(previous).trigger(hideEvent);
  6315. }
  6316. $(this._element).trigger(showEvent);
  6317. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6318. return;
  6319. }
  6320. if (selector) {
  6321. target = document.querySelector(selector);
  6322. }
  6323. this._activate(this._element, listElement);
  6324. var complete = function complete() {
  6325. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6326. relatedTarget: _this._element
  6327. });
  6328. var shownEvent = $.Event(Event$9.SHOWN, {
  6329. relatedTarget: previous
  6330. });
  6331. $(previous).trigger(hiddenEvent);
  6332. $(_this._element).trigger(shownEvent);
  6333. };
  6334. if (target) {
  6335. this._activate(target, target.parentNode, complete);
  6336. } else {
  6337. complete();
  6338. }
  6339. };
  6340. _proto.dispose = function dispose() {
  6341. $.removeData(this._element, DATA_KEY$9);
  6342. this._element = null;
  6343. } // Private
  6344. ;
  6345. _proto._activate = function _activate(element, container, callback) {
  6346. var _this2 = this;
  6347. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6348. var active = activeElements[0];
  6349. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6350. var complete = function complete() {
  6351. return _this2._transitionComplete(element, active, callback);
  6352. };
  6353. if (active && isTransitioning) {
  6354. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6355. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6356. } else {
  6357. complete();
  6358. }
  6359. };
  6360. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6361. if (active) {
  6362. $(active).removeClass(ClassName$9.ACTIVE);
  6363. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6364. if (dropdownChild) {
  6365. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6366. }
  6367. if (active.getAttribute('role') === 'tab') {
  6368. active.setAttribute('aria-selected', false);
  6369. }
  6370. }
  6371. $(element).addClass(ClassName$9.ACTIVE);
  6372. if (element.getAttribute('role') === 'tab') {
  6373. element.setAttribute('aria-selected', true);
  6374. }
  6375. Util.reflow(element);
  6376. if (element.classList.contains(ClassName$9.FADE)) {
  6377. element.classList.add(ClassName$9.SHOW);
  6378. }
  6379. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6380. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6381. if (dropdownElement) {
  6382. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6383. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6384. }
  6385. element.setAttribute('aria-expanded', true);
  6386. }
  6387. if (callback) {
  6388. callback();
  6389. }
  6390. } // Static
  6391. ;
  6392. Tab._jQueryInterface = function _jQueryInterface(config) {
  6393. return this.each(function () {
  6394. var $this = $(this);
  6395. var data = $this.data(DATA_KEY$9);
  6396. if (!data) {
  6397. data = new Tab(this);
  6398. $this.data(DATA_KEY$9, data);
  6399. }
  6400. if (typeof config === 'string') {
  6401. if (typeof data[config] === 'undefined') {
  6402. throw new TypeError("No method named \"" + config + "\"");
  6403. }
  6404. data[config]();
  6405. }
  6406. });
  6407. };
  6408. _createClass(Tab, null, [{
  6409. key: "VERSION",
  6410. get: function get() {
  6411. return VERSION$9;
  6412. }
  6413. }]);
  6414. return Tab;
  6415. }();
  6416. /**
  6417. * ------------------------------------------------------------------------
  6418. * Data Api implementation
  6419. * ------------------------------------------------------------------------
  6420. */
  6421. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6422. event.preventDefault();
  6423. Tab._jQueryInterface.call($(this), 'show');
  6424. });
  6425. /**
  6426. * ------------------------------------------------------------------------
  6427. * jQuery
  6428. * ------------------------------------------------------------------------
  6429. */
  6430. $.fn[NAME$9] = Tab._jQueryInterface;
  6431. $.fn[NAME$9].Constructor = Tab;
  6432. $.fn[NAME$9].noConflict = function () {
  6433. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6434. return Tab._jQueryInterface;
  6435. };
  6436. /**
  6437. * ------------------------------------------------------------------------
  6438. * Constants
  6439. * ------------------------------------------------------------------------
  6440. */
  6441. var NAME$a = 'toast';
  6442. var VERSION$a = '4.4.1';
  6443. var DATA_KEY$a = 'bs.toast';
  6444. var EVENT_KEY$a = "." + DATA_KEY$a;
  6445. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6446. var Event$a = {
  6447. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6448. HIDE: "hide" + EVENT_KEY$a,
  6449. HIDDEN: "hidden" + EVENT_KEY$a,
  6450. SHOW: "show" + EVENT_KEY$a,
  6451. SHOWN: "shown" + EVENT_KEY$a
  6452. };
  6453. var ClassName$a = {
  6454. FADE: 'fade',
  6455. HIDE: 'hide',
  6456. SHOW: 'show',
  6457. SHOWING: 'showing'
  6458. };
  6459. var DefaultType$7 = {
  6460. animation: 'boolean',
  6461. autohide: 'boolean',
  6462. delay: 'number'
  6463. };
  6464. var Default$7 = {
  6465. animation: true,
  6466. autohide: true,
  6467. delay: 500
  6468. };
  6469. var Selector$a = {
  6470. DATA_DISMISS: '[data-dismiss="toast"]'
  6471. };
  6472. /**
  6473. * ------------------------------------------------------------------------
  6474. * Class Definition
  6475. * ------------------------------------------------------------------------
  6476. */
  6477. var Toast =
  6478. /*#__PURE__*/
  6479. function () {
  6480. function Toast(element, config) {
  6481. this._element = element;
  6482. this._config = this._getConfig(config);
  6483. this._timeout = null;
  6484. this._setListeners();
  6485. } // Getters
  6486. var _proto = Toast.prototype;
  6487. // Public
  6488. _proto.show = function show() {
  6489. var _this = this;
  6490. var showEvent = $.Event(Event$a.SHOW);
  6491. $(this._element).trigger(showEvent);
  6492. if (showEvent.isDefaultPrevented()) {
  6493. return;
  6494. }
  6495. if (this._config.animation) {
  6496. this._element.classList.add(ClassName$a.FADE);
  6497. }
  6498. var complete = function complete() {
  6499. _this._element.classList.remove(ClassName$a.SHOWING);
  6500. _this._element.classList.add(ClassName$a.SHOW);
  6501. $(_this._element).trigger(Event$a.SHOWN);
  6502. if (_this._config.autohide) {
  6503. _this._timeout = setTimeout(function () {
  6504. _this.hide();
  6505. }, _this._config.delay);
  6506. }
  6507. };
  6508. this._element.classList.remove(ClassName$a.HIDE);
  6509. Util.reflow(this._element);
  6510. this._element.classList.add(ClassName$a.SHOWING);
  6511. if (this._config.animation) {
  6512. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6513. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6514. } else {
  6515. complete();
  6516. }
  6517. };
  6518. _proto.hide = function hide() {
  6519. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6520. return;
  6521. }
  6522. var hideEvent = $.Event(Event$a.HIDE);
  6523. $(this._element).trigger(hideEvent);
  6524. if (hideEvent.isDefaultPrevented()) {
  6525. return;
  6526. }
  6527. this._close();
  6528. };
  6529. _proto.dispose = function dispose() {
  6530. clearTimeout(this._timeout);
  6531. this._timeout = null;
  6532. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6533. this._element.classList.remove(ClassName$a.SHOW);
  6534. }
  6535. $(this._element).off(Event$a.CLICK_DISMISS);
  6536. $.removeData(this._element, DATA_KEY$a);
  6537. this._element = null;
  6538. this._config = null;
  6539. } // Private
  6540. ;
  6541. _proto._getConfig = function _getConfig(config) {
  6542. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6543. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6544. return config;
  6545. };
  6546. _proto._setListeners = function _setListeners() {
  6547. var _this2 = this;
  6548. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6549. return _this2.hide();
  6550. });
  6551. };
  6552. _proto._close = function _close() {
  6553. var _this3 = this;
  6554. var complete = function complete() {
  6555. _this3._element.classList.add(ClassName$a.HIDE);
  6556. $(_this3._element).trigger(Event$a.HIDDEN);
  6557. };
  6558. this._element.classList.remove(ClassName$a.SHOW);
  6559. if (this._config.animation) {
  6560. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6561. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6562. } else {
  6563. complete();
  6564. }
  6565. } // Static
  6566. ;
  6567. Toast._jQueryInterface = function _jQueryInterface(config) {
  6568. return this.each(function () {
  6569. var $element = $(this);
  6570. var data = $element.data(DATA_KEY$a);
  6571. var _config = typeof config === 'object' && config;
  6572. if (!data) {
  6573. data = new Toast(this, _config);
  6574. $element.data(DATA_KEY$a, data);
  6575. }
  6576. if (typeof config === 'string') {
  6577. if (typeof data[config] === 'undefined') {
  6578. throw new TypeError("No method named \"" + config + "\"");
  6579. }
  6580. data[config](this);
  6581. }
  6582. });
  6583. };
  6584. _createClass(Toast, null, [{
  6585. key: "VERSION",
  6586. get: function get() {
  6587. return VERSION$a;
  6588. }
  6589. }, {
  6590. key: "DefaultType",
  6591. get: function get() {
  6592. return DefaultType$7;
  6593. }
  6594. }, {
  6595. key: "Default",
  6596. get: function get() {
  6597. return Default$7;
  6598. }
  6599. }]);
  6600. return Toast;
  6601. }();
  6602. /**
  6603. * ------------------------------------------------------------------------
  6604. * jQuery
  6605. * ------------------------------------------------------------------------
  6606. */
  6607. $.fn[NAME$a] = Toast._jQueryInterface;
  6608. $.fn[NAME$a].Constructor = Toast;
  6609. $.fn[NAME$a].noConflict = function () {
  6610. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6611. return Toast._jQueryInterface;
  6612. };
  6613. exports.Alert = Alert;
  6614. exports.Button = Button;
  6615. exports.Carousel = Carousel;
  6616. exports.Collapse = Collapse;
  6617. exports.Dropdown = Dropdown;
  6618. exports.Modal = Modal;
  6619. exports.Popover = Popover;
  6620. exports.Scrollspy = ScrollSpy;
  6621. exports.Tab = Tab;
  6622. exports.Toast = Toast;
  6623. exports.Tooltip = Tooltip;
  6624. exports.Util = Util;
  6625. Object.defineProperty(exports, '__esModule', { value: true });
  6626. })));
  6627. //# sourceMappingURL=bootstrap.js.map
  6628. /***/ }),
  6629. /***/ "./node_modules/buffer/index.js":
  6630. /*!**************************************!*\
  6631. !*** ./node_modules/buffer/index.js ***!
  6632. \**************************************/
  6633. /*! no static exports found */
  6634. /***/ (function(module, exports, __webpack_require__) {
  6635. "use strict";
  6636. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6637. * The buffer module from node.js, for the browser.
  6638. *
  6639. * @author Feross Aboukhadijeh <http://feross.org>
  6640. * @license MIT
  6641. */
  6642. /* eslint-disable no-proto */
  6643. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6644. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6645. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6646. exports.Buffer = Buffer
  6647. exports.SlowBuffer = SlowBuffer
  6648. exports.INSPECT_MAX_BYTES = 50
  6649. /**
  6650. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6651. * === true Use Uint8Array implementation (fastest)
  6652. * === false Use Object implementation (most compatible, even IE6)
  6653. *
  6654. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6655. * Opera 11.6+, iOS 4.2+.
  6656. *
  6657. * Due to various browser bugs, sometimes the Object implementation will be used even
  6658. * when the browser supports typed arrays.
  6659. *
  6660. * Note:
  6661. *
  6662. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6663. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6664. *
  6665. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6666. *
  6667. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6668. * incorrect length in some situations.
  6669. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6670. * get the Object implementation, which is slower but behaves correctly.
  6671. */
  6672. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6673. ? global.TYPED_ARRAY_SUPPORT
  6674. : typedArraySupport()
  6675. /*
  6676. * Export kMaxLength after typed array support is determined.
  6677. */
  6678. exports.kMaxLength = kMaxLength()
  6679. function typedArraySupport () {
  6680. try {
  6681. var arr = new Uint8Array(1)
  6682. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6683. return arr.foo() === 42 && // typed array instances can be augmented
  6684. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6685. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6686. } catch (e) {
  6687. return false
  6688. }
  6689. }
  6690. function kMaxLength () {
  6691. return Buffer.TYPED_ARRAY_SUPPORT
  6692. ? 0x7fffffff
  6693. : 0x3fffffff
  6694. }
  6695. function createBuffer (that, length) {
  6696. if (kMaxLength() < length) {
  6697. throw new RangeError('Invalid typed array length')
  6698. }
  6699. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6700. // Return an augmented `Uint8Array` instance, for best performance
  6701. that = new Uint8Array(length)
  6702. that.__proto__ = Buffer.prototype
  6703. } else {
  6704. // Fallback: Return an object instance of the Buffer class
  6705. if (that === null) {
  6706. that = new Buffer(length)
  6707. }
  6708. that.length = length
  6709. }
  6710. return that
  6711. }
  6712. /**
  6713. * The Buffer constructor returns instances of `Uint8Array` that have their
  6714. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6715. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6716. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6717. * returns a single octet.
  6718. *
  6719. * The `Uint8Array` prototype remains unmodified.
  6720. */
  6721. function Buffer (arg, encodingOrOffset, length) {
  6722. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6723. return new Buffer(arg, encodingOrOffset, length)
  6724. }
  6725. // Common case.
  6726. if (typeof arg === 'number') {
  6727. if (typeof encodingOrOffset === 'string') {
  6728. throw new Error(
  6729. 'If encoding is specified then the first argument must be a string'
  6730. )
  6731. }
  6732. return allocUnsafe(this, arg)
  6733. }
  6734. return from(this, arg, encodingOrOffset, length)
  6735. }
  6736. Buffer.poolSize = 8192 // not used by this implementation
  6737. // TODO: Legacy, not needed anymore. Remove in next major version.
  6738. Buffer._augment = function (arr) {
  6739. arr.__proto__ = Buffer.prototype
  6740. return arr
  6741. }
  6742. function from (that, value, encodingOrOffset, length) {
  6743. if (typeof value === 'number') {
  6744. throw new TypeError('"value" argument must not be a number')
  6745. }
  6746. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6747. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6748. }
  6749. if (typeof value === 'string') {
  6750. return fromString(that, value, encodingOrOffset)
  6751. }
  6752. return fromObject(that, value)
  6753. }
  6754. /**
  6755. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6756. * if value is a number.
  6757. * Buffer.from(str[, encoding])
  6758. * Buffer.from(array)
  6759. * Buffer.from(buffer)
  6760. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6761. **/
  6762. Buffer.from = function (value, encodingOrOffset, length) {
  6763. return from(null, value, encodingOrOffset, length)
  6764. }
  6765. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6766. Buffer.prototype.__proto__ = Uint8Array.prototype
  6767. Buffer.__proto__ = Uint8Array
  6768. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6769. Buffer[Symbol.species] === Buffer) {
  6770. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6771. Object.defineProperty(Buffer, Symbol.species, {
  6772. value: null,
  6773. configurable: true
  6774. })
  6775. }
  6776. }
  6777. function assertSize (size) {
  6778. if (typeof size !== 'number') {
  6779. throw new TypeError('"size" argument must be a number')
  6780. } else if (size < 0) {
  6781. throw new RangeError('"size" argument must not be negative')
  6782. }
  6783. }
  6784. function alloc (that, size, fill, encoding) {
  6785. assertSize(size)
  6786. if (size <= 0) {
  6787. return createBuffer(that, size)
  6788. }
  6789. if (fill !== undefined) {
  6790. // Only pay attention to encoding if it's a string. This
  6791. // prevents accidentally sending in a number that would
  6792. // be interpretted as a start offset.
  6793. return typeof encoding === 'string'
  6794. ? createBuffer(that, size).fill(fill, encoding)
  6795. : createBuffer(that, size).fill(fill)
  6796. }
  6797. return createBuffer(that, size)
  6798. }
  6799. /**
  6800. * Creates a new filled Buffer instance.
  6801. * alloc(size[, fill[, encoding]])
  6802. **/
  6803. Buffer.alloc = function (size, fill, encoding) {
  6804. return alloc(null, size, fill, encoding)
  6805. }
  6806. function allocUnsafe (that, size) {
  6807. assertSize(size)
  6808. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6809. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6810. for (var i = 0; i < size; ++i) {
  6811. that[i] = 0
  6812. }
  6813. }
  6814. return that
  6815. }
  6816. /**
  6817. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6818. * */
  6819. Buffer.allocUnsafe = function (size) {
  6820. return allocUnsafe(null, size)
  6821. }
  6822. /**
  6823. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6824. */
  6825. Buffer.allocUnsafeSlow = function (size) {
  6826. return allocUnsafe(null, size)
  6827. }
  6828. function fromString (that, string, encoding) {
  6829. if (typeof encoding !== 'string' || encoding === '') {
  6830. encoding = 'utf8'
  6831. }
  6832. if (!Buffer.isEncoding(encoding)) {
  6833. throw new TypeError('"encoding" must be a valid string encoding')
  6834. }
  6835. var length = byteLength(string, encoding) | 0
  6836. that = createBuffer(that, length)
  6837. var actual = that.write(string, encoding)
  6838. if (actual !== length) {
  6839. // Writing a hex string, for example, that contains invalid characters will
  6840. // cause everything after the first invalid character to be ignored. (e.g.
  6841. // 'abxxcd' will be treated as 'ab')
  6842. that = that.slice(0, actual)
  6843. }
  6844. return that
  6845. }
  6846. function fromArrayLike (that, array) {
  6847. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6848. that = createBuffer(that, length)
  6849. for (var i = 0; i < length; i += 1) {
  6850. that[i] = array[i] & 255
  6851. }
  6852. return that
  6853. }
  6854. function fromArrayBuffer (that, array, byteOffset, length) {
  6855. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6856. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6857. throw new RangeError('\'offset\' is out of bounds')
  6858. }
  6859. if (array.byteLength < byteOffset + (length || 0)) {
  6860. throw new RangeError('\'length\' is out of bounds')
  6861. }
  6862. if (byteOffset === undefined && length === undefined) {
  6863. array = new Uint8Array(array)
  6864. } else if (length === undefined) {
  6865. array = new Uint8Array(array, byteOffset)
  6866. } else {
  6867. array = new Uint8Array(array, byteOffset, length)
  6868. }
  6869. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6870. // Return an augmented `Uint8Array` instance, for best performance
  6871. that = array
  6872. that.__proto__ = Buffer.prototype
  6873. } else {
  6874. // Fallback: Return an object instance of the Buffer class
  6875. that = fromArrayLike(that, array)
  6876. }
  6877. return that
  6878. }
  6879. function fromObject (that, obj) {
  6880. if (Buffer.isBuffer(obj)) {
  6881. var len = checked(obj.length) | 0
  6882. that = createBuffer(that, len)
  6883. if (that.length === 0) {
  6884. return that
  6885. }
  6886. obj.copy(that, 0, 0, len)
  6887. return that
  6888. }
  6889. if (obj) {
  6890. if ((typeof ArrayBuffer !== 'undefined' &&
  6891. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6892. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6893. return createBuffer(that, 0)
  6894. }
  6895. return fromArrayLike(that, obj)
  6896. }
  6897. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6898. return fromArrayLike(that, obj.data)
  6899. }
  6900. }
  6901. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6902. }
  6903. function checked (length) {
  6904. // Note: cannot use `length < kMaxLength()` here because that fails when
  6905. // length is NaN (which is otherwise coerced to zero.)
  6906. if (length >= kMaxLength()) {
  6907. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6908. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6909. }
  6910. return length | 0
  6911. }
  6912. function SlowBuffer (length) {
  6913. if (+length != length) { // eslint-disable-line eqeqeq
  6914. length = 0
  6915. }
  6916. return Buffer.alloc(+length)
  6917. }
  6918. Buffer.isBuffer = function isBuffer (b) {
  6919. return !!(b != null && b._isBuffer)
  6920. }
  6921. Buffer.compare = function compare (a, b) {
  6922. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6923. throw new TypeError('Arguments must be Buffers')
  6924. }
  6925. if (a === b) return 0
  6926. var x = a.length
  6927. var y = b.length
  6928. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6929. if (a[i] !== b[i]) {
  6930. x = a[i]
  6931. y = b[i]
  6932. break
  6933. }
  6934. }
  6935. if (x < y) return -1
  6936. if (y < x) return 1
  6937. return 0
  6938. }
  6939. Buffer.isEncoding = function isEncoding (encoding) {
  6940. switch (String(encoding).toLowerCase()) {
  6941. case 'hex':
  6942. case 'utf8':
  6943. case 'utf-8':
  6944. case 'ascii':
  6945. case 'latin1':
  6946. case 'binary':
  6947. case 'base64':
  6948. case 'ucs2':
  6949. case 'ucs-2':
  6950. case 'utf16le':
  6951. case 'utf-16le':
  6952. return true
  6953. default:
  6954. return false
  6955. }
  6956. }
  6957. Buffer.concat = function concat (list, length) {
  6958. if (!isArray(list)) {
  6959. throw new TypeError('"list" argument must be an Array of Buffers')
  6960. }
  6961. if (list.length === 0) {
  6962. return Buffer.alloc(0)
  6963. }
  6964. var i
  6965. if (length === undefined) {
  6966. length = 0
  6967. for (i = 0; i < list.length; ++i) {
  6968. length += list[i].length
  6969. }
  6970. }
  6971. var buffer = Buffer.allocUnsafe(length)
  6972. var pos = 0
  6973. for (i = 0; i < list.length; ++i) {
  6974. var buf = list[i]
  6975. if (!Buffer.isBuffer(buf)) {
  6976. throw new TypeError('"list" argument must be an Array of Buffers')
  6977. }
  6978. buf.copy(buffer, pos)
  6979. pos += buf.length
  6980. }
  6981. return buffer
  6982. }
  6983. function byteLength (string, encoding) {
  6984. if (Buffer.isBuffer(string)) {
  6985. return string.length
  6986. }
  6987. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6988. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6989. return string.byteLength
  6990. }
  6991. if (typeof string !== 'string') {
  6992. string = '' + string
  6993. }
  6994. var len = string.length
  6995. if (len === 0) return 0
  6996. // Use a for loop to avoid recursion
  6997. var loweredCase = false
  6998. for (;;) {
  6999. switch (encoding) {
  7000. case 'ascii':
  7001. case 'latin1':
  7002. case 'binary':
  7003. return len
  7004. case 'utf8':
  7005. case 'utf-8':
  7006. case undefined:
  7007. return utf8ToBytes(string).length
  7008. case 'ucs2':
  7009. case 'ucs-2':
  7010. case 'utf16le':
  7011. case 'utf-16le':
  7012. return len * 2
  7013. case 'hex':
  7014. return len >>> 1
  7015. case 'base64':
  7016. return base64ToBytes(string).length
  7017. default:
  7018. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7019. encoding = ('' + encoding).toLowerCase()
  7020. loweredCase = true
  7021. }
  7022. }
  7023. }
  7024. Buffer.byteLength = byteLength
  7025. function slowToString (encoding, start, end) {
  7026. var loweredCase = false
  7027. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7028. // property of a typed array.
  7029. // This behaves neither like String nor Uint8Array in that we set start/end
  7030. // to their upper/lower bounds if the value passed is out of range.
  7031. // undefined is handled specially as per ECMA-262 6th Edition,
  7032. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7033. if (start === undefined || start < 0) {
  7034. start = 0
  7035. }
  7036. // Return early if start > this.length. Done here to prevent potential uint32
  7037. // coercion fail below.
  7038. if (start > this.length) {
  7039. return ''
  7040. }
  7041. if (end === undefined || end > this.length) {
  7042. end = this.length
  7043. }
  7044. if (end <= 0) {
  7045. return ''
  7046. }
  7047. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7048. end >>>= 0
  7049. start >>>= 0
  7050. if (end <= start) {
  7051. return ''
  7052. }
  7053. if (!encoding) encoding = 'utf8'
  7054. while (true) {
  7055. switch (encoding) {
  7056. case 'hex':
  7057. return hexSlice(this, start, end)
  7058. case 'utf8':
  7059. case 'utf-8':
  7060. return utf8Slice(this, start, end)
  7061. case 'ascii':
  7062. return asciiSlice(this, start, end)
  7063. case 'latin1':
  7064. case 'binary':
  7065. return latin1Slice(this, start, end)
  7066. case 'base64':
  7067. return base64Slice(this, start, end)
  7068. case 'ucs2':
  7069. case 'ucs-2':
  7070. case 'utf16le':
  7071. case 'utf-16le':
  7072. return utf16leSlice(this, start, end)
  7073. default:
  7074. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7075. encoding = (encoding + '').toLowerCase()
  7076. loweredCase = true
  7077. }
  7078. }
  7079. }
  7080. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7081. // Buffer instances.
  7082. Buffer.prototype._isBuffer = true
  7083. function swap (b, n, m) {
  7084. var i = b[n]
  7085. b[n] = b[m]
  7086. b[m] = i
  7087. }
  7088. Buffer.prototype.swap16 = function swap16 () {
  7089. var len = this.length
  7090. if (len % 2 !== 0) {
  7091. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7092. }
  7093. for (var i = 0; i < len; i += 2) {
  7094. swap(this, i, i + 1)
  7095. }
  7096. return this
  7097. }
  7098. Buffer.prototype.swap32 = function swap32 () {
  7099. var len = this.length
  7100. if (len % 4 !== 0) {
  7101. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7102. }
  7103. for (var i = 0; i < len; i += 4) {
  7104. swap(this, i, i + 3)
  7105. swap(this, i + 1, i + 2)
  7106. }
  7107. return this
  7108. }
  7109. Buffer.prototype.swap64 = function swap64 () {
  7110. var len = this.length
  7111. if (len % 8 !== 0) {
  7112. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7113. }
  7114. for (var i = 0; i < len; i += 8) {
  7115. swap(this, i, i + 7)
  7116. swap(this, i + 1, i + 6)
  7117. swap(this, i + 2, i + 5)
  7118. swap(this, i + 3, i + 4)
  7119. }
  7120. return this
  7121. }
  7122. Buffer.prototype.toString = function toString () {
  7123. var length = this.length | 0
  7124. if (length === 0) return ''
  7125. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7126. return slowToString.apply(this, arguments)
  7127. }
  7128. Buffer.prototype.equals = function equals (b) {
  7129. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7130. if (this === b) return true
  7131. return Buffer.compare(this, b) === 0
  7132. }
  7133. Buffer.prototype.inspect = function inspect () {
  7134. var str = ''
  7135. var max = exports.INSPECT_MAX_BYTES
  7136. if (this.length > 0) {
  7137. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7138. if (this.length > max) str += ' ... '
  7139. }
  7140. return '<Buffer ' + str + '>'
  7141. }
  7142. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7143. if (!Buffer.isBuffer(target)) {
  7144. throw new TypeError('Argument must be a Buffer')
  7145. }
  7146. if (start === undefined) {
  7147. start = 0
  7148. }
  7149. if (end === undefined) {
  7150. end = target ? target.length : 0
  7151. }
  7152. if (thisStart === undefined) {
  7153. thisStart = 0
  7154. }
  7155. if (thisEnd === undefined) {
  7156. thisEnd = this.length
  7157. }
  7158. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7159. throw new RangeError('out of range index')
  7160. }
  7161. if (thisStart >= thisEnd && start >= end) {
  7162. return 0
  7163. }
  7164. if (thisStart >= thisEnd) {
  7165. return -1
  7166. }
  7167. if (start >= end) {
  7168. return 1
  7169. }
  7170. start >>>= 0
  7171. end >>>= 0
  7172. thisStart >>>= 0
  7173. thisEnd >>>= 0
  7174. if (this === target) return 0
  7175. var x = thisEnd - thisStart
  7176. var y = end - start
  7177. var len = Math.min(x, y)
  7178. var thisCopy = this.slice(thisStart, thisEnd)
  7179. var targetCopy = target.slice(start, end)
  7180. for (var i = 0; i < len; ++i) {
  7181. if (thisCopy[i] !== targetCopy[i]) {
  7182. x = thisCopy[i]
  7183. y = targetCopy[i]
  7184. break
  7185. }
  7186. }
  7187. if (x < y) return -1
  7188. if (y < x) return 1
  7189. return 0
  7190. }
  7191. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7192. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7193. //
  7194. // Arguments:
  7195. // - buffer - a Buffer to search
  7196. // - val - a string, Buffer, or number
  7197. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7198. // - encoding - an optional encoding, relevant is val is a string
  7199. // - dir - true for indexOf, false for lastIndexOf
  7200. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7201. // Empty buffer means no match
  7202. if (buffer.length === 0) return -1
  7203. // Normalize byteOffset
  7204. if (typeof byteOffset === 'string') {
  7205. encoding = byteOffset
  7206. byteOffset = 0
  7207. } else if (byteOffset > 0x7fffffff) {
  7208. byteOffset = 0x7fffffff
  7209. } else if (byteOffset < -0x80000000) {
  7210. byteOffset = -0x80000000
  7211. }
  7212. byteOffset = +byteOffset // Coerce to Number.
  7213. if (isNaN(byteOffset)) {
  7214. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7215. byteOffset = dir ? 0 : (buffer.length - 1)
  7216. }
  7217. // Normalize byteOffset: negative offsets start from the end of the buffer
  7218. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7219. if (byteOffset >= buffer.length) {
  7220. if (dir) return -1
  7221. else byteOffset = buffer.length - 1
  7222. } else if (byteOffset < 0) {
  7223. if (dir) byteOffset = 0
  7224. else return -1
  7225. }
  7226. // Normalize val
  7227. if (typeof val === 'string') {
  7228. val = Buffer.from(val, encoding)
  7229. }
  7230. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7231. if (Buffer.isBuffer(val)) {
  7232. // Special case: looking for empty string/buffer always fails
  7233. if (val.length === 0) {
  7234. return -1
  7235. }
  7236. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7237. } else if (typeof val === 'number') {
  7238. val = val & 0xFF // Search for a byte value [0-255]
  7239. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7240. typeof Uint8Array.prototype.indexOf === 'function') {
  7241. if (dir) {
  7242. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7243. } else {
  7244. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7245. }
  7246. }
  7247. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7248. }
  7249. throw new TypeError('val must be string, number or Buffer')
  7250. }
  7251. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7252. var indexSize = 1
  7253. var arrLength = arr.length
  7254. var valLength = val.length
  7255. if (encoding !== undefined) {
  7256. encoding = String(encoding).toLowerCase()
  7257. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7258. encoding === 'utf16le' || encoding === 'utf-16le') {
  7259. if (arr.length < 2 || val.length < 2) {
  7260. return -1
  7261. }
  7262. indexSize = 2
  7263. arrLength /= 2
  7264. valLength /= 2
  7265. byteOffset /= 2
  7266. }
  7267. }
  7268. function read (buf, i) {
  7269. if (indexSize === 1) {
  7270. return buf[i]
  7271. } else {
  7272. return buf.readUInt16BE(i * indexSize)
  7273. }
  7274. }
  7275. var i
  7276. if (dir) {
  7277. var foundIndex = -1
  7278. for (i = byteOffset; i < arrLength; i++) {
  7279. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7280. if (foundIndex === -1) foundIndex = i
  7281. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7282. } else {
  7283. if (foundIndex !== -1) i -= i - foundIndex
  7284. foundIndex = -1
  7285. }
  7286. }
  7287. } else {
  7288. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7289. for (i = byteOffset; i >= 0; i--) {
  7290. var found = true
  7291. for (var j = 0; j < valLength; j++) {
  7292. if (read(arr, i + j) !== read(val, j)) {
  7293. found = false
  7294. break
  7295. }
  7296. }
  7297. if (found) return i
  7298. }
  7299. }
  7300. return -1
  7301. }
  7302. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7303. return this.indexOf(val, byteOffset, encoding) !== -1
  7304. }
  7305. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7306. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7307. }
  7308. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7309. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7310. }
  7311. function hexWrite (buf, string, offset, length) {
  7312. offset = Number(offset) || 0
  7313. var remaining = buf.length - offset
  7314. if (!length) {
  7315. length = remaining
  7316. } else {
  7317. length = Number(length)
  7318. if (length > remaining) {
  7319. length = remaining
  7320. }
  7321. }
  7322. // must be an even number of digits
  7323. var strLen = string.length
  7324. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7325. if (length > strLen / 2) {
  7326. length = strLen / 2
  7327. }
  7328. for (var i = 0; i < length; ++i) {
  7329. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7330. if (isNaN(parsed)) return i
  7331. buf[offset + i] = parsed
  7332. }
  7333. return i
  7334. }
  7335. function utf8Write (buf, string, offset, length) {
  7336. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7337. }
  7338. function asciiWrite (buf, string, offset, length) {
  7339. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7340. }
  7341. function latin1Write (buf, string, offset, length) {
  7342. return asciiWrite(buf, string, offset, length)
  7343. }
  7344. function base64Write (buf, string, offset, length) {
  7345. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7346. }
  7347. function ucs2Write (buf, string, offset, length) {
  7348. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7349. }
  7350. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7351. // Buffer#write(string)
  7352. if (offset === undefined) {
  7353. encoding = 'utf8'
  7354. length = this.length
  7355. offset = 0
  7356. // Buffer#write(string, encoding)
  7357. } else if (length === undefined && typeof offset === 'string') {
  7358. encoding = offset
  7359. length = this.length
  7360. offset = 0
  7361. // Buffer#write(string, offset[, length][, encoding])
  7362. } else if (isFinite(offset)) {
  7363. offset = offset | 0
  7364. if (isFinite(length)) {
  7365. length = length | 0
  7366. if (encoding === undefined) encoding = 'utf8'
  7367. } else {
  7368. encoding = length
  7369. length = undefined
  7370. }
  7371. // legacy write(string, encoding, offset, length) - remove in v0.13
  7372. } else {
  7373. throw new Error(
  7374. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7375. )
  7376. }
  7377. var remaining = this.length - offset
  7378. if (length === undefined || length > remaining) length = remaining
  7379. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7380. throw new RangeError('Attempt to write outside buffer bounds')
  7381. }
  7382. if (!encoding) encoding = 'utf8'
  7383. var loweredCase = false
  7384. for (;;) {
  7385. switch (encoding) {
  7386. case 'hex':
  7387. return hexWrite(this, string, offset, length)
  7388. case 'utf8':
  7389. case 'utf-8':
  7390. return utf8Write(this, string, offset, length)
  7391. case 'ascii':
  7392. return asciiWrite(this, string, offset, length)
  7393. case 'latin1':
  7394. case 'binary':
  7395. return latin1Write(this, string, offset, length)
  7396. case 'base64':
  7397. // Warning: maxLength not taken into account in base64Write
  7398. return base64Write(this, string, offset, length)
  7399. case 'ucs2':
  7400. case 'ucs-2':
  7401. case 'utf16le':
  7402. case 'utf-16le':
  7403. return ucs2Write(this, string, offset, length)
  7404. default:
  7405. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7406. encoding = ('' + encoding).toLowerCase()
  7407. loweredCase = true
  7408. }
  7409. }
  7410. }
  7411. Buffer.prototype.toJSON = function toJSON () {
  7412. return {
  7413. type: 'Buffer',
  7414. data: Array.prototype.slice.call(this._arr || this, 0)
  7415. }
  7416. }
  7417. function base64Slice (buf, start, end) {
  7418. if (start === 0 && end === buf.length) {
  7419. return base64.fromByteArray(buf)
  7420. } else {
  7421. return base64.fromByteArray(buf.slice(start, end))
  7422. }
  7423. }
  7424. function utf8Slice (buf, start, end) {
  7425. end = Math.min(buf.length, end)
  7426. var res = []
  7427. var i = start
  7428. while (i < end) {
  7429. var firstByte = buf[i]
  7430. var codePoint = null
  7431. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7432. : (firstByte > 0xDF) ? 3
  7433. : (firstByte > 0xBF) ? 2
  7434. : 1
  7435. if (i + bytesPerSequence <= end) {
  7436. var secondByte, thirdByte, fourthByte, tempCodePoint
  7437. switch (bytesPerSequence) {
  7438. case 1:
  7439. if (firstByte < 0x80) {
  7440. codePoint = firstByte
  7441. }
  7442. break
  7443. case 2:
  7444. secondByte = buf[i + 1]
  7445. if ((secondByte & 0xC0) === 0x80) {
  7446. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7447. if (tempCodePoint > 0x7F) {
  7448. codePoint = tempCodePoint
  7449. }
  7450. }
  7451. break
  7452. case 3:
  7453. secondByte = buf[i + 1]
  7454. thirdByte = buf[i + 2]
  7455. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7456. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7457. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7458. codePoint = tempCodePoint
  7459. }
  7460. }
  7461. break
  7462. case 4:
  7463. secondByte = buf[i + 1]
  7464. thirdByte = buf[i + 2]
  7465. fourthByte = buf[i + 3]
  7466. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7467. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7468. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7469. codePoint = tempCodePoint
  7470. }
  7471. }
  7472. }
  7473. }
  7474. if (codePoint === null) {
  7475. // we did not generate a valid codePoint so insert a
  7476. // replacement char (U+FFFD) and advance only 1 byte
  7477. codePoint = 0xFFFD
  7478. bytesPerSequence = 1
  7479. } else if (codePoint > 0xFFFF) {
  7480. // encode to utf16 (surrogate pair dance)
  7481. codePoint -= 0x10000
  7482. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7483. codePoint = 0xDC00 | codePoint & 0x3FF
  7484. }
  7485. res.push(codePoint)
  7486. i += bytesPerSequence
  7487. }
  7488. return decodeCodePointsArray(res)
  7489. }
  7490. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7491. // the lowest limit is Chrome, with 0x10000 args.
  7492. // We go 1 magnitude less, for safety
  7493. var MAX_ARGUMENTS_LENGTH = 0x1000
  7494. function decodeCodePointsArray (codePoints) {
  7495. var len = codePoints.length
  7496. if (len <= MAX_ARGUMENTS_LENGTH) {
  7497. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7498. }
  7499. // Decode in chunks to avoid "call stack size exceeded".
  7500. var res = ''
  7501. var i = 0
  7502. while (i < len) {
  7503. res += String.fromCharCode.apply(
  7504. String,
  7505. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7506. )
  7507. }
  7508. return res
  7509. }
  7510. function asciiSlice (buf, start, end) {
  7511. var ret = ''
  7512. end = Math.min(buf.length, end)
  7513. for (var i = start; i < end; ++i) {
  7514. ret += String.fromCharCode(buf[i] & 0x7F)
  7515. }
  7516. return ret
  7517. }
  7518. function latin1Slice (buf, start, end) {
  7519. var ret = ''
  7520. end = Math.min(buf.length, end)
  7521. for (var i = start; i < end; ++i) {
  7522. ret += String.fromCharCode(buf[i])
  7523. }
  7524. return ret
  7525. }
  7526. function hexSlice (buf, start, end) {
  7527. var len = buf.length
  7528. if (!start || start < 0) start = 0
  7529. if (!end || end < 0 || end > len) end = len
  7530. var out = ''
  7531. for (var i = start; i < end; ++i) {
  7532. out += toHex(buf[i])
  7533. }
  7534. return out
  7535. }
  7536. function utf16leSlice (buf, start, end) {
  7537. var bytes = buf.slice(start, end)
  7538. var res = ''
  7539. for (var i = 0; i < bytes.length; i += 2) {
  7540. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7541. }
  7542. return res
  7543. }
  7544. Buffer.prototype.slice = function slice (start, end) {
  7545. var len = this.length
  7546. start = ~~start
  7547. end = end === undefined ? len : ~~end
  7548. if (start < 0) {
  7549. start += len
  7550. if (start < 0) start = 0
  7551. } else if (start > len) {
  7552. start = len
  7553. }
  7554. if (end < 0) {
  7555. end += len
  7556. if (end < 0) end = 0
  7557. } else if (end > len) {
  7558. end = len
  7559. }
  7560. if (end < start) end = start
  7561. var newBuf
  7562. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7563. newBuf = this.subarray(start, end)
  7564. newBuf.__proto__ = Buffer.prototype
  7565. } else {
  7566. var sliceLen = end - start
  7567. newBuf = new Buffer(sliceLen, undefined)
  7568. for (var i = 0; i < sliceLen; ++i) {
  7569. newBuf[i] = this[i + start]
  7570. }
  7571. }
  7572. return newBuf
  7573. }
  7574. /*
  7575. * Need to make sure that buffer isn't trying to write out of bounds.
  7576. */
  7577. function checkOffset (offset, ext, length) {
  7578. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7579. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7580. }
  7581. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7582. offset = offset | 0
  7583. byteLength = byteLength | 0
  7584. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7585. var val = this[offset]
  7586. var mul = 1
  7587. var i = 0
  7588. while (++i < byteLength && (mul *= 0x100)) {
  7589. val += this[offset + i] * mul
  7590. }
  7591. return val
  7592. }
  7593. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7594. offset = offset | 0
  7595. byteLength = byteLength | 0
  7596. if (!noAssert) {
  7597. checkOffset(offset, byteLength, this.length)
  7598. }
  7599. var val = this[offset + --byteLength]
  7600. var mul = 1
  7601. while (byteLength > 0 && (mul *= 0x100)) {
  7602. val += this[offset + --byteLength] * mul
  7603. }
  7604. return val
  7605. }
  7606. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7607. if (!noAssert) checkOffset(offset, 1, this.length)
  7608. return this[offset]
  7609. }
  7610. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7611. if (!noAssert) checkOffset(offset, 2, this.length)
  7612. return this[offset] | (this[offset + 1] << 8)
  7613. }
  7614. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7615. if (!noAssert) checkOffset(offset, 2, this.length)
  7616. return (this[offset] << 8) | this[offset + 1]
  7617. }
  7618. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7619. if (!noAssert) checkOffset(offset, 4, this.length)
  7620. return ((this[offset]) |
  7621. (this[offset + 1] << 8) |
  7622. (this[offset + 2] << 16)) +
  7623. (this[offset + 3] * 0x1000000)
  7624. }
  7625. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7626. if (!noAssert) checkOffset(offset, 4, this.length)
  7627. return (this[offset] * 0x1000000) +
  7628. ((this[offset + 1] << 16) |
  7629. (this[offset + 2] << 8) |
  7630. this[offset + 3])
  7631. }
  7632. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7633. offset = offset | 0
  7634. byteLength = byteLength | 0
  7635. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7636. var val = this[offset]
  7637. var mul = 1
  7638. var i = 0
  7639. while (++i < byteLength && (mul *= 0x100)) {
  7640. val += this[offset + i] * mul
  7641. }
  7642. mul *= 0x80
  7643. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7644. return val
  7645. }
  7646. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7647. offset = offset | 0
  7648. byteLength = byteLength | 0
  7649. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7650. var i = byteLength
  7651. var mul = 1
  7652. var val = this[offset + --i]
  7653. while (i > 0 && (mul *= 0x100)) {
  7654. val += this[offset + --i] * mul
  7655. }
  7656. mul *= 0x80
  7657. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7658. return val
  7659. }
  7660. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7661. if (!noAssert) checkOffset(offset, 1, this.length)
  7662. if (!(this[offset] & 0x80)) return (this[offset])
  7663. return ((0xff - this[offset] + 1) * -1)
  7664. }
  7665. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7666. if (!noAssert) checkOffset(offset, 2, this.length)
  7667. var val = this[offset] | (this[offset + 1] << 8)
  7668. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7669. }
  7670. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7671. if (!noAssert) checkOffset(offset, 2, this.length)
  7672. var val = this[offset + 1] | (this[offset] << 8)
  7673. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7674. }
  7675. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7676. if (!noAssert) checkOffset(offset, 4, this.length)
  7677. return (this[offset]) |
  7678. (this[offset + 1] << 8) |
  7679. (this[offset + 2] << 16) |
  7680. (this[offset + 3] << 24)
  7681. }
  7682. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7683. if (!noAssert) checkOffset(offset, 4, this.length)
  7684. return (this[offset] << 24) |
  7685. (this[offset + 1] << 16) |
  7686. (this[offset + 2] << 8) |
  7687. (this[offset + 3])
  7688. }
  7689. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7690. if (!noAssert) checkOffset(offset, 4, this.length)
  7691. return ieee754.read(this, offset, true, 23, 4)
  7692. }
  7693. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7694. if (!noAssert) checkOffset(offset, 4, this.length)
  7695. return ieee754.read(this, offset, false, 23, 4)
  7696. }
  7697. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7698. if (!noAssert) checkOffset(offset, 8, this.length)
  7699. return ieee754.read(this, offset, true, 52, 8)
  7700. }
  7701. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7702. if (!noAssert) checkOffset(offset, 8, this.length)
  7703. return ieee754.read(this, offset, false, 52, 8)
  7704. }
  7705. function checkInt (buf, value, offset, ext, max, min) {
  7706. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7707. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7708. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7709. }
  7710. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7711. value = +value
  7712. offset = offset | 0
  7713. byteLength = byteLength | 0
  7714. if (!noAssert) {
  7715. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7716. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7717. }
  7718. var mul = 1
  7719. var i = 0
  7720. this[offset] = value & 0xFF
  7721. while (++i < byteLength && (mul *= 0x100)) {
  7722. this[offset + i] = (value / mul) & 0xFF
  7723. }
  7724. return offset + byteLength
  7725. }
  7726. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7727. value = +value
  7728. offset = offset | 0
  7729. byteLength = byteLength | 0
  7730. if (!noAssert) {
  7731. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7732. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7733. }
  7734. var i = byteLength - 1
  7735. var mul = 1
  7736. this[offset + i] = value & 0xFF
  7737. while (--i >= 0 && (mul *= 0x100)) {
  7738. this[offset + i] = (value / mul) & 0xFF
  7739. }
  7740. return offset + byteLength
  7741. }
  7742. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7743. value = +value
  7744. offset = offset | 0
  7745. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7746. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7747. this[offset] = (value & 0xff)
  7748. return offset + 1
  7749. }
  7750. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7751. if (value < 0) value = 0xffff + value + 1
  7752. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7753. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7754. (littleEndian ? i : 1 - i) * 8
  7755. }
  7756. }
  7757. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7758. value = +value
  7759. offset = offset | 0
  7760. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7761. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7762. this[offset] = (value & 0xff)
  7763. this[offset + 1] = (value >>> 8)
  7764. } else {
  7765. objectWriteUInt16(this, value, offset, true)
  7766. }
  7767. return offset + 2
  7768. }
  7769. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7770. value = +value
  7771. offset = offset | 0
  7772. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7773. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7774. this[offset] = (value >>> 8)
  7775. this[offset + 1] = (value & 0xff)
  7776. } else {
  7777. objectWriteUInt16(this, value, offset, false)
  7778. }
  7779. return offset + 2
  7780. }
  7781. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7782. if (value < 0) value = 0xffffffff + value + 1
  7783. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7784. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7785. }
  7786. }
  7787. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7788. value = +value
  7789. offset = offset | 0
  7790. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7791. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7792. this[offset + 3] = (value >>> 24)
  7793. this[offset + 2] = (value >>> 16)
  7794. this[offset + 1] = (value >>> 8)
  7795. this[offset] = (value & 0xff)
  7796. } else {
  7797. objectWriteUInt32(this, value, offset, true)
  7798. }
  7799. return offset + 4
  7800. }
  7801. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7802. value = +value
  7803. offset = offset | 0
  7804. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7805. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7806. this[offset] = (value >>> 24)
  7807. this[offset + 1] = (value >>> 16)
  7808. this[offset + 2] = (value >>> 8)
  7809. this[offset + 3] = (value & 0xff)
  7810. } else {
  7811. objectWriteUInt32(this, value, offset, false)
  7812. }
  7813. return offset + 4
  7814. }
  7815. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7816. value = +value
  7817. offset = offset | 0
  7818. if (!noAssert) {
  7819. var limit = Math.pow(2, 8 * byteLength - 1)
  7820. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7821. }
  7822. var i = 0
  7823. var mul = 1
  7824. var sub = 0
  7825. this[offset] = value & 0xFF
  7826. while (++i < byteLength && (mul *= 0x100)) {
  7827. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7828. sub = 1
  7829. }
  7830. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7831. }
  7832. return offset + byteLength
  7833. }
  7834. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7835. value = +value
  7836. offset = offset | 0
  7837. if (!noAssert) {
  7838. var limit = Math.pow(2, 8 * byteLength - 1)
  7839. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7840. }
  7841. var i = byteLength - 1
  7842. var mul = 1
  7843. var sub = 0
  7844. this[offset + i] = value & 0xFF
  7845. while (--i >= 0 && (mul *= 0x100)) {
  7846. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7847. sub = 1
  7848. }
  7849. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7850. }
  7851. return offset + byteLength
  7852. }
  7853. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7854. value = +value
  7855. offset = offset | 0
  7856. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7857. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7858. if (value < 0) value = 0xff + value + 1
  7859. this[offset] = (value & 0xff)
  7860. return offset + 1
  7861. }
  7862. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7863. value = +value
  7864. offset = offset | 0
  7865. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7866. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7867. this[offset] = (value & 0xff)
  7868. this[offset + 1] = (value >>> 8)
  7869. } else {
  7870. objectWriteUInt16(this, value, offset, true)
  7871. }
  7872. return offset + 2
  7873. }
  7874. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7875. value = +value
  7876. offset = offset | 0
  7877. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7878. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7879. this[offset] = (value >>> 8)
  7880. this[offset + 1] = (value & 0xff)
  7881. } else {
  7882. objectWriteUInt16(this, value, offset, false)
  7883. }
  7884. return offset + 2
  7885. }
  7886. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7887. value = +value
  7888. offset = offset | 0
  7889. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7890. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7891. this[offset] = (value & 0xff)
  7892. this[offset + 1] = (value >>> 8)
  7893. this[offset + 2] = (value >>> 16)
  7894. this[offset + 3] = (value >>> 24)
  7895. } else {
  7896. objectWriteUInt32(this, value, offset, true)
  7897. }
  7898. return offset + 4
  7899. }
  7900. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7901. value = +value
  7902. offset = offset | 0
  7903. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7904. if (value < 0) value = 0xffffffff + value + 1
  7905. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7906. this[offset] = (value >>> 24)
  7907. this[offset + 1] = (value >>> 16)
  7908. this[offset + 2] = (value >>> 8)
  7909. this[offset + 3] = (value & 0xff)
  7910. } else {
  7911. objectWriteUInt32(this, value, offset, false)
  7912. }
  7913. return offset + 4
  7914. }
  7915. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7916. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7917. if (offset < 0) throw new RangeError('Index out of range')
  7918. }
  7919. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7920. if (!noAssert) {
  7921. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7922. }
  7923. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7924. return offset + 4
  7925. }
  7926. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7927. return writeFloat(this, value, offset, true, noAssert)
  7928. }
  7929. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7930. return writeFloat(this, value, offset, false, noAssert)
  7931. }
  7932. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7933. if (!noAssert) {
  7934. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7935. }
  7936. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7937. return offset + 8
  7938. }
  7939. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7940. return writeDouble(this, value, offset, true, noAssert)
  7941. }
  7942. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7943. return writeDouble(this, value, offset, false, noAssert)
  7944. }
  7945. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7946. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7947. if (!start) start = 0
  7948. if (!end && end !== 0) end = this.length
  7949. if (targetStart >= target.length) targetStart = target.length
  7950. if (!targetStart) targetStart = 0
  7951. if (end > 0 && end < start) end = start
  7952. // Copy 0 bytes; we're done
  7953. if (end === start) return 0
  7954. if (target.length === 0 || this.length === 0) return 0
  7955. // Fatal error conditions
  7956. if (targetStart < 0) {
  7957. throw new RangeError('targetStart out of bounds')
  7958. }
  7959. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7960. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7961. // Are we oob?
  7962. if (end > this.length) end = this.length
  7963. if (target.length - targetStart < end - start) {
  7964. end = target.length - targetStart + start
  7965. }
  7966. var len = end - start
  7967. var i
  7968. if (this === target && start < targetStart && targetStart < end) {
  7969. // descending copy from end
  7970. for (i = len - 1; i >= 0; --i) {
  7971. target[i + targetStart] = this[i + start]
  7972. }
  7973. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7974. // ascending copy from start
  7975. for (i = 0; i < len; ++i) {
  7976. target[i + targetStart] = this[i + start]
  7977. }
  7978. } else {
  7979. Uint8Array.prototype.set.call(
  7980. target,
  7981. this.subarray(start, start + len),
  7982. targetStart
  7983. )
  7984. }
  7985. return len
  7986. }
  7987. // Usage:
  7988. // buffer.fill(number[, offset[, end]])
  7989. // buffer.fill(buffer[, offset[, end]])
  7990. // buffer.fill(string[, offset[, end]][, encoding])
  7991. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7992. // Handle string cases:
  7993. if (typeof val === 'string') {
  7994. if (typeof start === 'string') {
  7995. encoding = start
  7996. start = 0
  7997. end = this.length
  7998. } else if (typeof end === 'string') {
  7999. encoding = end
  8000. end = this.length
  8001. }
  8002. if (val.length === 1) {
  8003. var code = val.charCodeAt(0)
  8004. if (code < 256) {
  8005. val = code
  8006. }
  8007. }
  8008. if (encoding !== undefined && typeof encoding !== 'string') {
  8009. throw new TypeError('encoding must be a string')
  8010. }
  8011. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8012. throw new TypeError('Unknown encoding: ' + encoding)
  8013. }
  8014. } else if (typeof val === 'number') {
  8015. val = val & 255
  8016. }
  8017. // Invalid ranges are not set to a default, so can range check early.
  8018. if (start < 0 || this.length < start || this.length < end) {
  8019. throw new RangeError('Out of range index')
  8020. }
  8021. if (end <= start) {
  8022. return this
  8023. }
  8024. start = start >>> 0
  8025. end = end === undefined ? this.length : end >>> 0
  8026. if (!val) val = 0
  8027. var i
  8028. if (typeof val === 'number') {
  8029. for (i = start; i < end; ++i) {
  8030. this[i] = val
  8031. }
  8032. } else {
  8033. var bytes = Buffer.isBuffer(val)
  8034. ? val
  8035. : utf8ToBytes(new Buffer(val, encoding).toString())
  8036. var len = bytes.length
  8037. for (i = 0; i < end - start; ++i) {
  8038. this[i + start] = bytes[i % len]
  8039. }
  8040. }
  8041. return this
  8042. }
  8043. // HELPER FUNCTIONS
  8044. // ================
  8045. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8046. function base64clean (str) {
  8047. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8048. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8049. // Node converts strings with length < 2 to ''
  8050. if (str.length < 2) return ''
  8051. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8052. while (str.length % 4 !== 0) {
  8053. str = str + '='
  8054. }
  8055. return str
  8056. }
  8057. function stringtrim (str) {
  8058. if (str.trim) return str.trim()
  8059. return str.replace(/^\s+|\s+$/g, '')
  8060. }
  8061. function toHex (n) {
  8062. if (n < 16) return '0' + n.toString(16)
  8063. return n.toString(16)
  8064. }
  8065. function utf8ToBytes (string, units) {
  8066. units = units || Infinity
  8067. var codePoint
  8068. var length = string.length
  8069. var leadSurrogate = null
  8070. var bytes = []
  8071. for (var i = 0; i < length; ++i) {
  8072. codePoint = string.charCodeAt(i)
  8073. // is surrogate component
  8074. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8075. // last char was a lead
  8076. if (!leadSurrogate) {
  8077. // no lead yet
  8078. if (codePoint > 0xDBFF) {
  8079. // unexpected trail
  8080. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8081. continue
  8082. } else if (i + 1 === length) {
  8083. // unpaired lead
  8084. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8085. continue
  8086. }
  8087. // valid lead
  8088. leadSurrogate = codePoint
  8089. continue
  8090. }
  8091. // 2 leads in a row
  8092. if (codePoint < 0xDC00) {
  8093. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8094. leadSurrogate = codePoint
  8095. continue
  8096. }
  8097. // valid surrogate pair
  8098. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8099. } else if (leadSurrogate) {
  8100. // valid bmp char, but last char was a lead
  8101. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8102. }
  8103. leadSurrogate = null
  8104. // encode utf8
  8105. if (codePoint < 0x80) {
  8106. if ((units -= 1) < 0) break
  8107. bytes.push(codePoint)
  8108. } else if (codePoint < 0x800) {
  8109. if ((units -= 2) < 0) break
  8110. bytes.push(
  8111. codePoint >> 0x6 | 0xC0,
  8112. codePoint & 0x3F | 0x80
  8113. )
  8114. } else if (codePoint < 0x10000) {
  8115. if ((units -= 3) < 0) break
  8116. bytes.push(
  8117. codePoint >> 0xC | 0xE0,
  8118. codePoint >> 0x6 & 0x3F | 0x80,
  8119. codePoint & 0x3F | 0x80
  8120. )
  8121. } else if (codePoint < 0x110000) {
  8122. if ((units -= 4) < 0) break
  8123. bytes.push(
  8124. codePoint >> 0x12 | 0xF0,
  8125. codePoint >> 0xC & 0x3F | 0x80,
  8126. codePoint >> 0x6 & 0x3F | 0x80,
  8127. codePoint & 0x3F | 0x80
  8128. )
  8129. } else {
  8130. throw new Error('Invalid code point')
  8131. }
  8132. }
  8133. return bytes
  8134. }
  8135. function asciiToBytes (str) {
  8136. var byteArray = []
  8137. for (var i = 0; i < str.length; ++i) {
  8138. // Node's code seems to be doing this and not & 0x7F..
  8139. byteArray.push(str.charCodeAt(i) & 0xFF)
  8140. }
  8141. return byteArray
  8142. }
  8143. function utf16leToBytes (str, units) {
  8144. var c, hi, lo
  8145. var byteArray = []
  8146. for (var i = 0; i < str.length; ++i) {
  8147. if ((units -= 2) < 0) break
  8148. c = str.charCodeAt(i)
  8149. hi = c >> 8
  8150. lo = c % 256
  8151. byteArray.push(lo)
  8152. byteArray.push(hi)
  8153. }
  8154. return byteArray
  8155. }
  8156. function base64ToBytes (str) {
  8157. return base64.toByteArray(base64clean(str))
  8158. }
  8159. function blitBuffer (src, dst, offset, length) {
  8160. for (var i = 0; i < length; ++i) {
  8161. if ((i + offset >= dst.length) || (i >= src.length)) break
  8162. dst[i + offset] = src[i]
  8163. }
  8164. return i
  8165. }
  8166. function isnan (val) {
  8167. return val !== val // eslint-disable-line no-self-compare
  8168. }
  8169. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8170. /***/ }),
  8171. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8172. /*!**************************************************!*\
  8173. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8174. \**************************************************/
  8175. /*! no static exports found */
  8176. /***/ (function(module, exports, __webpack_require__) {
  8177. /*!
  8178. * clipboard.js v2.0.4
  8179. * https://zenorocha.github.io/clipboard.js
  8180. *
  8181. * Licensed MIT © Zeno Rocha
  8182. */
  8183. (function webpackUniversalModuleDefinition(root, factory) {
  8184. if(true)
  8185. module.exports = factory();
  8186. else {}
  8187. })(this, function() {
  8188. return /******/ (function(modules) { // webpackBootstrap
  8189. /******/ // The module cache
  8190. /******/ var installedModules = {};
  8191. /******/
  8192. /******/ // The require function
  8193. /******/ function __webpack_require__(moduleId) {
  8194. /******/
  8195. /******/ // Check if module is in cache
  8196. /******/ if(installedModules[moduleId]) {
  8197. /******/ return installedModules[moduleId].exports;
  8198. /******/ }
  8199. /******/ // Create a new module (and put it into the cache)
  8200. /******/ var module = installedModules[moduleId] = {
  8201. /******/ i: moduleId,
  8202. /******/ l: false,
  8203. /******/ exports: {}
  8204. /******/ };
  8205. /******/
  8206. /******/ // Execute the module function
  8207. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8208. /******/
  8209. /******/ // Flag the module as loaded
  8210. /******/ module.l = true;
  8211. /******/
  8212. /******/ // Return the exports of the module
  8213. /******/ return module.exports;
  8214. /******/ }
  8215. /******/
  8216. /******/
  8217. /******/ // expose the modules object (__webpack_modules__)
  8218. /******/ __webpack_require__.m = modules;
  8219. /******/
  8220. /******/ // expose the module cache
  8221. /******/ __webpack_require__.c = installedModules;
  8222. /******/
  8223. /******/ // define getter function for harmony exports
  8224. /******/ __webpack_require__.d = function(exports, name, getter) {
  8225. /******/ if(!__webpack_require__.o(exports, name)) {
  8226. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8227. /******/ }
  8228. /******/ };
  8229. /******/
  8230. /******/ // define __esModule on exports
  8231. /******/ __webpack_require__.r = function(exports) {
  8232. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8233. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8234. /******/ }
  8235. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8236. /******/ };
  8237. /******/
  8238. /******/ // create a fake namespace object
  8239. /******/ // mode & 1: value is a module id, require it
  8240. /******/ // mode & 2: merge all properties of value into the ns
  8241. /******/ // mode & 4: return value when already ns object
  8242. /******/ // mode & 8|1: behave like require
  8243. /******/ __webpack_require__.t = function(value, mode) {
  8244. /******/ if(mode & 1) value = __webpack_require__(value);
  8245. /******/ if(mode & 8) return value;
  8246. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8247. /******/ var ns = Object.create(null);
  8248. /******/ __webpack_require__.r(ns);
  8249. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8250. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8251. /******/ return ns;
  8252. /******/ };
  8253. /******/
  8254. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8255. /******/ __webpack_require__.n = function(module) {
  8256. /******/ var getter = module && module.__esModule ?
  8257. /******/ function getDefault() { return module['default']; } :
  8258. /******/ function getModuleExports() { return module; };
  8259. /******/ __webpack_require__.d(getter, 'a', getter);
  8260. /******/ return getter;
  8261. /******/ };
  8262. /******/
  8263. /******/ // Object.prototype.hasOwnProperty.call
  8264. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8265. /******/
  8266. /******/ // __webpack_public_path__
  8267. /******/ __webpack_require__.p = "";
  8268. /******/
  8269. /******/
  8270. /******/ // Load entry module and return exports
  8271. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8272. /******/ })
  8273. /************************************************************************/
  8274. /******/ ([
  8275. /* 0 */
  8276. /***/ (function(module, exports, __webpack_require__) {
  8277. "use strict";
  8278. 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; };
  8279. 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; }; }();
  8280. var _clipboardAction = __webpack_require__(1);
  8281. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8282. var _tinyEmitter = __webpack_require__(3);
  8283. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8284. var _goodListener = __webpack_require__(4);
  8285. var _goodListener2 = _interopRequireDefault(_goodListener);
  8286. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8287. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8288. 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; }
  8289. 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; }
  8290. /**
  8291. * Base class which takes one or more elements, adds event listeners to them,
  8292. * and instantiates a new `ClipboardAction` on each click.
  8293. */
  8294. var Clipboard = function (_Emitter) {
  8295. _inherits(Clipboard, _Emitter);
  8296. /**
  8297. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8298. * @param {Object} options
  8299. */
  8300. function Clipboard(trigger, options) {
  8301. _classCallCheck(this, Clipboard);
  8302. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8303. _this.resolveOptions(options);
  8304. _this.listenClick(trigger);
  8305. return _this;
  8306. }
  8307. /**
  8308. * Defines if attributes would be resolved using internal setter functions
  8309. * or custom functions that were passed in the constructor.
  8310. * @param {Object} options
  8311. */
  8312. _createClass(Clipboard, [{
  8313. key: 'resolveOptions',
  8314. value: function resolveOptions() {
  8315. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8316. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8317. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8318. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8319. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8320. }
  8321. /**
  8322. * Adds a click event listener to the passed trigger.
  8323. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8324. */
  8325. }, {
  8326. key: 'listenClick',
  8327. value: function listenClick(trigger) {
  8328. var _this2 = this;
  8329. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8330. return _this2.onClick(e);
  8331. });
  8332. }
  8333. /**
  8334. * Defines a new `ClipboardAction` on each click event.
  8335. * @param {Event} e
  8336. */
  8337. }, {
  8338. key: 'onClick',
  8339. value: function onClick(e) {
  8340. var trigger = e.delegateTarget || e.currentTarget;
  8341. if (this.clipboardAction) {
  8342. this.clipboardAction = null;
  8343. }
  8344. this.clipboardAction = new _clipboardAction2.default({
  8345. action: this.action(trigger),
  8346. target: this.target(trigger),
  8347. text: this.text(trigger),
  8348. container: this.container,
  8349. trigger: trigger,
  8350. emitter: this
  8351. });
  8352. }
  8353. /**
  8354. * Default `action` lookup function.
  8355. * @param {Element} trigger
  8356. */
  8357. }, {
  8358. key: 'defaultAction',
  8359. value: function defaultAction(trigger) {
  8360. return getAttributeValue('action', trigger);
  8361. }
  8362. /**
  8363. * Default `target` lookup function.
  8364. * @param {Element} trigger
  8365. */
  8366. }, {
  8367. key: 'defaultTarget',
  8368. value: function defaultTarget(trigger) {
  8369. var selector = getAttributeValue('target', trigger);
  8370. if (selector) {
  8371. return document.querySelector(selector);
  8372. }
  8373. }
  8374. /**
  8375. * Returns the support of the given action, or all actions if no action is
  8376. * given.
  8377. * @param {String} [action]
  8378. */
  8379. }, {
  8380. key: 'defaultText',
  8381. /**
  8382. * Default `text` lookup function.
  8383. * @param {Element} trigger
  8384. */
  8385. value: function defaultText(trigger) {
  8386. return getAttributeValue('text', trigger);
  8387. }
  8388. /**
  8389. * Destroy lifecycle.
  8390. */
  8391. }, {
  8392. key: 'destroy',
  8393. value: function destroy() {
  8394. this.listener.destroy();
  8395. if (this.clipboardAction) {
  8396. this.clipboardAction.destroy();
  8397. this.clipboardAction = null;
  8398. }
  8399. }
  8400. }], [{
  8401. key: 'isSupported',
  8402. value: function isSupported() {
  8403. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8404. var actions = typeof action === 'string' ? [action] : action;
  8405. var support = !!document.queryCommandSupported;
  8406. actions.forEach(function (action) {
  8407. support = support && !!document.queryCommandSupported(action);
  8408. });
  8409. return support;
  8410. }
  8411. }]);
  8412. return Clipboard;
  8413. }(_tinyEmitter2.default);
  8414. /**
  8415. * Helper function to retrieve attribute value.
  8416. * @param {String} suffix
  8417. * @param {Element} element
  8418. */
  8419. function getAttributeValue(suffix, element) {
  8420. var attribute = 'data-clipboard-' + suffix;
  8421. if (!element.hasAttribute(attribute)) {
  8422. return;
  8423. }
  8424. return element.getAttribute(attribute);
  8425. }
  8426. module.exports = Clipboard;
  8427. /***/ }),
  8428. /* 1 */
  8429. /***/ (function(module, exports, __webpack_require__) {
  8430. "use strict";
  8431. 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; };
  8432. 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; }; }();
  8433. var _select = __webpack_require__(2);
  8434. var _select2 = _interopRequireDefault(_select);
  8435. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8436. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8437. /**
  8438. * Inner class which performs selection from either `text` or `target`
  8439. * properties and then executes copy or cut operations.
  8440. */
  8441. var ClipboardAction = function () {
  8442. /**
  8443. * @param {Object} options
  8444. */
  8445. function ClipboardAction(options) {
  8446. _classCallCheck(this, ClipboardAction);
  8447. this.resolveOptions(options);
  8448. this.initSelection();
  8449. }
  8450. /**
  8451. * Defines base properties passed from constructor.
  8452. * @param {Object} options
  8453. */
  8454. _createClass(ClipboardAction, [{
  8455. key: 'resolveOptions',
  8456. value: function resolveOptions() {
  8457. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8458. this.action = options.action;
  8459. this.container = options.container;
  8460. this.emitter = options.emitter;
  8461. this.target = options.target;
  8462. this.text = options.text;
  8463. this.trigger = options.trigger;
  8464. this.selectedText = '';
  8465. }
  8466. /**
  8467. * Decides which selection strategy is going to be applied based
  8468. * on the existence of `text` and `target` properties.
  8469. */
  8470. }, {
  8471. key: 'initSelection',
  8472. value: function initSelection() {
  8473. if (this.text) {
  8474. this.selectFake();
  8475. } else if (this.target) {
  8476. this.selectTarget();
  8477. }
  8478. }
  8479. /**
  8480. * Creates a fake textarea element, sets its value from `text` property,
  8481. * and makes a selection on it.
  8482. */
  8483. }, {
  8484. key: 'selectFake',
  8485. value: function selectFake() {
  8486. var _this = this;
  8487. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8488. this.removeFake();
  8489. this.fakeHandlerCallback = function () {
  8490. return _this.removeFake();
  8491. };
  8492. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8493. this.fakeElem = document.createElement('textarea');
  8494. // Prevent zooming on iOS
  8495. this.fakeElem.style.fontSize = '12pt';
  8496. // Reset box model
  8497. this.fakeElem.style.border = '0';
  8498. this.fakeElem.style.padding = '0';
  8499. this.fakeElem.style.margin = '0';
  8500. // Move element out of screen horizontally
  8501. this.fakeElem.style.position = 'absolute';
  8502. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8503. // Move element to the same position vertically
  8504. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8505. this.fakeElem.style.top = yPosition + 'px';
  8506. this.fakeElem.setAttribute('readonly', '');
  8507. this.fakeElem.value = this.text;
  8508. this.container.appendChild(this.fakeElem);
  8509. this.selectedText = (0, _select2.default)(this.fakeElem);
  8510. this.copyText();
  8511. }
  8512. /**
  8513. * Only removes the fake element after another click event, that way
  8514. * a user can hit `Ctrl+C` to copy because selection still exists.
  8515. */
  8516. }, {
  8517. key: 'removeFake',
  8518. value: function removeFake() {
  8519. if (this.fakeHandler) {
  8520. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8521. this.fakeHandler = null;
  8522. this.fakeHandlerCallback = null;
  8523. }
  8524. if (this.fakeElem) {
  8525. this.container.removeChild(this.fakeElem);
  8526. this.fakeElem = null;
  8527. }
  8528. }
  8529. /**
  8530. * Selects the content from element passed on `target` property.
  8531. */
  8532. }, {
  8533. key: 'selectTarget',
  8534. value: function selectTarget() {
  8535. this.selectedText = (0, _select2.default)(this.target);
  8536. this.copyText();
  8537. }
  8538. /**
  8539. * Executes the copy operation based on the current selection.
  8540. */
  8541. }, {
  8542. key: 'copyText',
  8543. value: function copyText() {
  8544. var succeeded = void 0;
  8545. try {
  8546. succeeded = document.execCommand(this.action);
  8547. } catch (err) {
  8548. succeeded = false;
  8549. }
  8550. this.handleResult(succeeded);
  8551. }
  8552. /**
  8553. * Fires an event based on the copy operation result.
  8554. * @param {Boolean} succeeded
  8555. */
  8556. }, {
  8557. key: 'handleResult',
  8558. value: function handleResult(succeeded) {
  8559. this.emitter.emit(succeeded ? 'success' : 'error', {
  8560. action: this.action,
  8561. text: this.selectedText,
  8562. trigger: this.trigger,
  8563. clearSelection: this.clearSelection.bind(this)
  8564. });
  8565. }
  8566. /**
  8567. * Moves focus away from `target` and back to the trigger, removes current selection.
  8568. */
  8569. }, {
  8570. key: 'clearSelection',
  8571. value: function clearSelection() {
  8572. if (this.trigger) {
  8573. this.trigger.focus();
  8574. }
  8575. window.getSelection().removeAllRanges();
  8576. }
  8577. /**
  8578. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8579. * @param {String} action
  8580. */
  8581. }, {
  8582. key: 'destroy',
  8583. /**
  8584. * Destroy lifecycle.
  8585. */
  8586. value: function destroy() {
  8587. this.removeFake();
  8588. }
  8589. }, {
  8590. key: 'action',
  8591. set: function set() {
  8592. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8593. this._action = action;
  8594. if (this._action !== 'copy' && this._action !== 'cut') {
  8595. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8596. }
  8597. }
  8598. /**
  8599. * Gets the `action` property.
  8600. * @return {String}
  8601. */
  8602. ,
  8603. get: function get() {
  8604. return this._action;
  8605. }
  8606. /**
  8607. * Sets the `target` property using an element
  8608. * that will be have its content copied.
  8609. * @param {Element} target
  8610. */
  8611. }, {
  8612. key: 'target',
  8613. set: function set(target) {
  8614. if (target !== undefined) {
  8615. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8616. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8617. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8618. }
  8619. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8620. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8621. }
  8622. this._target = target;
  8623. } else {
  8624. throw new Error('Invalid "target" value, use a valid Element');
  8625. }
  8626. }
  8627. }
  8628. /**
  8629. * Gets the `target` property.
  8630. * @return {String|HTMLElement}
  8631. */
  8632. ,
  8633. get: function get() {
  8634. return this._target;
  8635. }
  8636. }]);
  8637. return ClipboardAction;
  8638. }();
  8639. module.exports = ClipboardAction;
  8640. /***/ }),
  8641. /* 2 */
  8642. /***/ (function(module, exports) {
  8643. function select(element) {
  8644. var selectedText;
  8645. if (element.nodeName === 'SELECT') {
  8646. element.focus();
  8647. selectedText = element.value;
  8648. }
  8649. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8650. var isReadOnly = element.hasAttribute('readonly');
  8651. if (!isReadOnly) {
  8652. element.setAttribute('readonly', '');
  8653. }
  8654. element.select();
  8655. element.setSelectionRange(0, element.value.length);
  8656. if (!isReadOnly) {
  8657. element.removeAttribute('readonly');
  8658. }
  8659. selectedText = element.value;
  8660. }
  8661. else {
  8662. if (element.hasAttribute('contenteditable')) {
  8663. element.focus();
  8664. }
  8665. var selection = window.getSelection();
  8666. var range = document.createRange();
  8667. range.selectNodeContents(element);
  8668. selection.removeAllRanges();
  8669. selection.addRange(range);
  8670. selectedText = selection.toString();
  8671. }
  8672. return selectedText;
  8673. }
  8674. module.exports = select;
  8675. /***/ }),
  8676. /* 3 */
  8677. /***/ (function(module, exports) {
  8678. function E () {
  8679. // Keep this empty so it's easier to inherit from
  8680. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8681. }
  8682. E.prototype = {
  8683. on: function (name, callback, ctx) {
  8684. var e = this.e || (this.e = {});
  8685. (e[name] || (e[name] = [])).push({
  8686. fn: callback,
  8687. ctx: ctx
  8688. });
  8689. return this;
  8690. },
  8691. once: function (name, callback, ctx) {
  8692. var self = this;
  8693. function listener () {
  8694. self.off(name, listener);
  8695. callback.apply(ctx, arguments);
  8696. };
  8697. listener._ = callback
  8698. return this.on(name, listener, ctx);
  8699. },
  8700. emit: function (name) {
  8701. var data = [].slice.call(arguments, 1);
  8702. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8703. var i = 0;
  8704. var len = evtArr.length;
  8705. for (i; i < len; i++) {
  8706. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8707. }
  8708. return this;
  8709. },
  8710. off: function (name, callback) {
  8711. var e = this.e || (this.e = {});
  8712. var evts = e[name];
  8713. var liveEvents = [];
  8714. if (evts && callback) {
  8715. for (var i = 0, len = evts.length; i < len; i++) {
  8716. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8717. liveEvents.push(evts[i]);
  8718. }
  8719. }
  8720. // Remove event from queue to prevent memory leak
  8721. // Suggested by https://github.com/lazd
  8722. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8723. (liveEvents.length)
  8724. ? e[name] = liveEvents
  8725. : delete e[name];
  8726. return this;
  8727. }
  8728. };
  8729. module.exports = E;
  8730. /***/ }),
  8731. /* 4 */
  8732. /***/ (function(module, exports, __webpack_require__) {
  8733. var is = __webpack_require__(5);
  8734. var delegate = __webpack_require__(6);
  8735. /**
  8736. * Validates all params and calls the right
  8737. * listener function based on its target type.
  8738. *
  8739. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8740. * @param {String} type
  8741. * @param {Function} callback
  8742. * @return {Object}
  8743. */
  8744. function listen(target, type, callback) {
  8745. if (!target && !type && !callback) {
  8746. throw new Error('Missing required arguments');
  8747. }
  8748. if (!is.string(type)) {
  8749. throw new TypeError('Second argument must be a String');
  8750. }
  8751. if (!is.fn(callback)) {
  8752. throw new TypeError('Third argument must be a Function');
  8753. }
  8754. if (is.node(target)) {
  8755. return listenNode(target, type, callback);
  8756. }
  8757. else if (is.nodeList(target)) {
  8758. return listenNodeList(target, type, callback);
  8759. }
  8760. else if (is.string(target)) {
  8761. return listenSelector(target, type, callback);
  8762. }
  8763. else {
  8764. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8765. }
  8766. }
  8767. /**
  8768. * Adds an event listener to a HTML element
  8769. * and returns a remove listener function.
  8770. *
  8771. * @param {HTMLElement} node
  8772. * @param {String} type
  8773. * @param {Function} callback
  8774. * @return {Object}
  8775. */
  8776. function listenNode(node, type, callback) {
  8777. node.addEventListener(type, callback);
  8778. return {
  8779. destroy: function() {
  8780. node.removeEventListener(type, callback);
  8781. }
  8782. }
  8783. }
  8784. /**
  8785. * Add an event listener to a list of HTML elements
  8786. * and returns a remove listener function.
  8787. *
  8788. * @param {NodeList|HTMLCollection} nodeList
  8789. * @param {String} type
  8790. * @param {Function} callback
  8791. * @return {Object}
  8792. */
  8793. function listenNodeList(nodeList, type, callback) {
  8794. Array.prototype.forEach.call(nodeList, function(node) {
  8795. node.addEventListener(type, callback);
  8796. });
  8797. return {
  8798. destroy: function() {
  8799. Array.prototype.forEach.call(nodeList, function(node) {
  8800. node.removeEventListener(type, callback);
  8801. });
  8802. }
  8803. }
  8804. }
  8805. /**
  8806. * Add an event listener to a selector
  8807. * and returns a remove listener function.
  8808. *
  8809. * @param {String} selector
  8810. * @param {String} type
  8811. * @param {Function} callback
  8812. * @return {Object}
  8813. */
  8814. function listenSelector(selector, type, callback) {
  8815. return delegate(document.body, selector, type, callback);
  8816. }
  8817. module.exports = listen;
  8818. /***/ }),
  8819. /* 5 */
  8820. /***/ (function(module, exports) {
  8821. /**
  8822. * Check if argument is a HTML element.
  8823. *
  8824. * @param {Object} value
  8825. * @return {Boolean}
  8826. */
  8827. exports.node = function(value) {
  8828. return value !== undefined
  8829. && value instanceof HTMLElement
  8830. && value.nodeType === 1;
  8831. };
  8832. /**
  8833. * Check if argument is a list of HTML elements.
  8834. *
  8835. * @param {Object} value
  8836. * @return {Boolean}
  8837. */
  8838. exports.nodeList = function(value) {
  8839. var type = Object.prototype.toString.call(value);
  8840. return value !== undefined
  8841. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8842. && ('length' in value)
  8843. && (value.length === 0 || exports.node(value[0]));
  8844. };
  8845. /**
  8846. * Check if argument is a string.
  8847. *
  8848. * @param {Object} value
  8849. * @return {Boolean}
  8850. */
  8851. exports.string = function(value) {
  8852. return typeof value === 'string'
  8853. || value instanceof String;
  8854. };
  8855. /**
  8856. * Check if argument is a function.
  8857. *
  8858. * @param {Object} value
  8859. * @return {Boolean}
  8860. */
  8861. exports.fn = function(value) {
  8862. var type = Object.prototype.toString.call(value);
  8863. return type === '[object Function]';
  8864. };
  8865. /***/ }),
  8866. /* 6 */
  8867. /***/ (function(module, exports, __webpack_require__) {
  8868. var closest = __webpack_require__(7);
  8869. /**
  8870. * Delegates event to a selector.
  8871. *
  8872. * @param {Element} element
  8873. * @param {String} selector
  8874. * @param {String} type
  8875. * @param {Function} callback
  8876. * @param {Boolean} useCapture
  8877. * @return {Object}
  8878. */
  8879. function _delegate(element, selector, type, callback, useCapture) {
  8880. var listenerFn = listener.apply(this, arguments);
  8881. element.addEventListener(type, listenerFn, useCapture);
  8882. return {
  8883. destroy: function() {
  8884. element.removeEventListener(type, listenerFn, useCapture);
  8885. }
  8886. }
  8887. }
  8888. /**
  8889. * Delegates event to a selector.
  8890. *
  8891. * @param {Element|String|Array} [elements]
  8892. * @param {String} selector
  8893. * @param {String} type
  8894. * @param {Function} callback
  8895. * @param {Boolean} useCapture
  8896. * @return {Object}
  8897. */
  8898. function delegate(elements, selector, type, callback, useCapture) {
  8899. // Handle the regular Element usage
  8900. if (typeof elements.addEventListener === 'function') {
  8901. return _delegate.apply(null, arguments);
  8902. }
  8903. // Handle Element-less usage, it defaults to global delegation
  8904. if (typeof type === 'function') {
  8905. // Use `document` as the first parameter, then apply arguments
  8906. // This is a short way to .unshift `arguments` without running into deoptimizations
  8907. return _delegate.bind(null, document).apply(null, arguments);
  8908. }
  8909. // Handle Selector-based usage
  8910. if (typeof elements === 'string') {
  8911. elements = document.querySelectorAll(elements);
  8912. }
  8913. // Handle Array-like based usage
  8914. return Array.prototype.map.call(elements, function (element) {
  8915. return _delegate(element, selector, type, callback, useCapture);
  8916. });
  8917. }
  8918. /**
  8919. * Finds closest match and invokes callback.
  8920. *
  8921. * @param {Element} element
  8922. * @param {String} selector
  8923. * @param {String} type
  8924. * @param {Function} callback
  8925. * @return {Function}
  8926. */
  8927. function listener(element, selector, type, callback) {
  8928. return function(e) {
  8929. e.delegateTarget = closest(e.target, selector);
  8930. if (e.delegateTarget) {
  8931. callback.call(element, e);
  8932. }
  8933. }
  8934. }
  8935. module.exports = delegate;
  8936. /***/ }),
  8937. /* 7 */
  8938. /***/ (function(module, exports) {
  8939. var DOCUMENT_NODE_TYPE = 9;
  8940. /**
  8941. * A polyfill for Element.matches()
  8942. */
  8943. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8944. var proto = Element.prototype;
  8945. proto.matches = proto.matchesSelector ||
  8946. proto.mozMatchesSelector ||
  8947. proto.msMatchesSelector ||
  8948. proto.oMatchesSelector ||
  8949. proto.webkitMatchesSelector;
  8950. }
  8951. /**
  8952. * Finds the closest parent that matches a selector.
  8953. *
  8954. * @param {Element} element
  8955. * @param {String} selector
  8956. * @return {Function}
  8957. */
  8958. function closest (element, selector) {
  8959. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8960. if (typeof element.matches === 'function' &&
  8961. element.matches(selector)) {
  8962. return element;
  8963. }
  8964. element = element.parentNode;
  8965. }
  8966. }
  8967. module.exports = closest;
  8968. /***/ })
  8969. /******/ ]);
  8970. });
  8971. /***/ }),
  8972. /***/ "./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&":
  8973. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  8974. !*** ./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& ***!
  8975. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  8976. /*! no static exports found */
  8977. /***/ (function(module, exports, __webpack_require__) {
  8978. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8979. // imports
  8980. // module
  8981. 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 overflow: hidden;\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", ""]);
  8982. // exports
  8983. /***/ }),
  8984. /***/ "./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&":
  8985. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8986. !*** ./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& ***!
  8987. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8988. /*! no static exports found */
  8989. /***/ (function(module, exports, __webpack_require__) {
  8990. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8991. // imports
  8992. // module
  8993. 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", ""]);
  8994. // exports
  8995. /***/ }),
  8996. /***/ "./node_modules/css-loader/lib/css-base.js":
  8997. /*!*************************************************!*\
  8998. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8999. \*************************************************/
  9000. /*! no static exports found */
  9001. /***/ (function(module, exports) {
  9002. /*
  9003. MIT License http://www.opensource.org/licenses/mit-license.php
  9004. Author Tobias Koppers @sokra
  9005. */
  9006. // css base code, injected by the css-loader
  9007. module.exports = function(useSourceMap) {
  9008. var list = [];
  9009. // return the list of modules as css string
  9010. list.toString = function toString() {
  9011. return this.map(function (item) {
  9012. var content = cssWithMappingToString(item, useSourceMap);
  9013. if(item[2]) {
  9014. return "@media " + item[2] + "{" + content + "}";
  9015. } else {
  9016. return content;
  9017. }
  9018. }).join("");
  9019. };
  9020. // import a list of modules into the list
  9021. list.i = function(modules, mediaQuery) {
  9022. if(typeof modules === "string")
  9023. modules = [[null, modules, ""]];
  9024. var alreadyImportedModules = {};
  9025. for(var i = 0; i < this.length; i++) {
  9026. var id = this[i][0];
  9027. if(typeof id === "number")
  9028. alreadyImportedModules[id] = true;
  9029. }
  9030. for(i = 0; i < modules.length; i++) {
  9031. var item = modules[i];
  9032. // skip already imported module
  9033. // this implementation is not 100% perfect for weird media query combinations
  9034. // when a module is imported multiple times with different media queries.
  9035. // I hope this will never occur (Hey this way we have smaller bundles)
  9036. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9037. if(mediaQuery && !item[2]) {
  9038. item[2] = mediaQuery;
  9039. } else if(mediaQuery) {
  9040. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9041. }
  9042. list.push(item);
  9043. }
  9044. }
  9045. };
  9046. return list;
  9047. };
  9048. function cssWithMappingToString(item, useSourceMap) {
  9049. var content = item[1] || '';
  9050. var cssMapping = item[3];
  9051. if (!cssMapping) {
  9052. return content;
  9053. }
  9054. if (useSourceMap && typeof btoa === 'function') {
  9055. var sourceMapping = toComment(cssMapping);
  9056. var sourceURLs = cssMapping.sources.map(function (source) {
  9057. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9058. });
  9059. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9060. }
  9061. return [content].join('\n');
  9062. }
  9063. // Adapted from convert-source-map (MIT)
  9064. function toComment(sourceMap) {
  9065. // eslint-disable-next-line no-undef
  9066. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9067. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9068. return '/*# ' + data + ' */';
  9069. }
  9070. /***/ }),
  9071. /***/ "./node_modules/ieee754/index.js":
  9072. /*!***************************************!*\
  9073. !*** ./node_modules/ieee754/index.js ***!
  9074. \***************************************/
  9075. /*! no static exports found */
  9076. /***/ (function(module, exports) {
  9077. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9078. var e, m
  9079. var eLen = (nBytes * 8) - mLen - 1
  9080. var eMax = (1 << eLen) - 1
  9081. var eBias = eMax >> 1
  9082. var nBits = -7
  9083. var i = isLE ? (nBytes - 1) : 0
  9084. var d = isLE ? -1 : 1
  9085. var s = buffer[offset + i]
  9086. i += d
  9087. e = s & ((1 << (-nBits)) - 1)
  9088. s >>= (-nBits)
  9089. nBits += eLen
  9090. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9091. m = e & ((1 << (-nBits)) - 1)
  9092. e >>= (-nBits)
  9093. nBits += mLen
  9094. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9095. if (e === 0) {
  9096. e = 1 - eBias
  9097. } else if (e === eMax) {
  9098. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9099. } else {
  9100. m = m + Math.pow(2, mLen)
  9101. e = e - eBias
  9102. }
  9103. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9104. }
  9105. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9106. var e, m, c
  9107. var eLen = (nBytes * 8) - mLen - 1
  9108. var eMax = (1 << eLen) - 1
  9109. var eBias = eMax >> 1
  9110. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9111. var i = isLE ? 0 : (nBytes - 1)
  9112. var d = isLE ? 1 : -1
  9113. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9114. value = Math.abs(value)
  9115. if (isNaN(value) || value === Infinity) {
  9116. m = isNaN(value) ? 1 : 0
  9117. e = eMax
  9118. } else {
  9119. e = Math.floor(Math.log(value) / Math.LN2)
  9120. if (value * (c = Math.pow(2, -e)) < 1) {
  9121. e--
  9122. c *= 2
  9123. }
  9124. if (e + eBias >= 1) {
  9125. value += rt / c
  9126. } else {
  9127. value += rt * Math.pow(2, 1 - eBias)
  9128. }
  9129. if (value * c >= 2) {
  9130. e++
  9131. c /= 2
  9132. }
  9133. if (e + eBias >= eMax) {
  9134. m = 0
  9135. e = eMax
  9136. } else if (e + eBias >= 1) {
  9137. m = ((value * c) - 1) * Math.pow(2, mLen)
  9138. e = e + eBias
  9139. } else {
  9140. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9141. e = 0
  9142. }
  9143. }
  9144. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9145. e = (e << mLen) | m
  9146. eLen += mLen
  9147. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9148. buffer[offset + i - d] |= s * 128
  9149. }
  9150. /***/ }),
  9151. /***/ "./node_modules/isarray/index.js":
  9152. /*!***************************************!*\
  9153. !*** ./node_modules/isarray/index.js ***!
  9154. \***************************************/
  9155. /*! no static exports found */
  9156. /***/ (function(module, exports) {
  9157. var toString = {}.toString;
  9158. module.exports = Array.isArray || function (arr) {
  9159. return toString.call(arr) == '[object Array]';
  9160. };
  9161. /***/ }),
  9162. /***/ "./node_modules/jquery/dist/jquery.js":
  9163. /*!********************************************!*\
  9164. !*** ./node_modules/jquery/dist/jquery.js ***!
  9165. \********************************************/
  9166. /*! no static exports found */
  9167. /***/ (function(module, exports, __webpack_require__) {
  9168. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9169. * jQuery JavaScript Library v3.4.1
  9170. * https://jquery.com/
  9171. *
  9172. * Includes Sizzle.js
  9173. * https://sizzlejs.com/
  9174. *
  9175. * Copyright JS Foundation and other contributors
  9176. * Released under the MIT license
  9177. * https://jquery.org/license
  9178. *
  9179. * Date: 2019-05-01T21:04Z
  9180. */
  9181. ( function( global, factory ) {
  9182. "use strict";
  9183. if ( true && typeof module.exports === "object" ) {
  9184. // For CommonJS and CommonJS-like environments where a proper `window`
  9185. // is present, execute the factory and get jQuery.
  9186. // For environments that do not have a `window` with a `document`
  9187. // (such as Node.js), expose a factory as module.exports.
  9188. // This accentuates the need for the creation of a real `window`.
  9189. // e.g. var jQuery = require("jquery")(window);
  9190. // See ticket #14549 for more info.
  9191. module.exports = global.document ?
  9192. factory( global, true ) :
  9193. function( w ) {
  9194. if ( !w.document ) {
  9195. throw new Error( "jQuery requires a window with a document" );
  9196. }
  9197. return factory( w );
  9198. };
  9199. } else {
  9200. factory( global );
  9201. }
  9202. // Pass this if window is not defined yet
  9203. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9204. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9205. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9206. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9207. // enough that all such attempts are guarded in a try block.
  9208. "use strict";
  9209. var arr = [];
  9210. var document = window.document;
  9211. var getProto = Object.getPrototypeOf;
  9212. var slice = arr.slice;
  9213. var concat = arr.concat;
  9214. var push = arr.push;
  9215. var indexOf = arr.indexOf;
  9216. var class2type = {};
  9217. var toString = class2type.toString;
  9218. var hasOwn = class2type.hasOwnProperty;
  9219. var fnToString = hasOwn.toString;
  9220. var ObjectFunctionString = fnToString.call( Object );
  9221. var support = {};
  9222. var isFunction = function isFunction( obj ) {
  9223. // Support: Chrome <=57, Firefox <=52
  9224. // In some browsers, typeof returns "function" for HTML <object> elements
  9225. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9226. // We don't want to classify *any* DOM node as a function.
  9227. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9228. };
  9229. var isWindow = function isWindow( obj ) {
  9230. return obj != null && obj === obj.window;
  9231. };
  9232. var preservedScriptAttributes = {
  9233. type: true,
  9234. src: true,
  9235. nonce: true,
  9236. noModule: true
  9237. };
  9238. function DOMEval( code, node, doc ) {
  9239. doc = doc || document;
  9240. var i, val,
  9241. script = doc.createElement( "script" );
  9242. script.text = code;
  9243. if ( node ) {
  9244. for ( i in preservedScriptAttributes ) {
  9245. // Support: Firefox 64+, Edge 18+
  9246. // Some browsers don't support the "nonce" property on scripts.
  9247. // On the other hand, just using `getAttribute` is not enough as
  9248. // the `nonce` attribute is reset to an empty string whenever it
  9249. // becomes browsing-context connected.
  9250. // See https://github.com/whatwg/html/issues/2369
  9251. // See https://html.spec.whatwg.org/#nonce-attributes
  9252. // The `node.getAttribute` check was added for the sake of
  9253. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9254. // via an object.
  9255. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9256. if ( val ) {
  9257. script.setAttribute( i, val );
  9258. }
  9259. }
  9260. }
  9261. doc.head.appendChild( script ).parentNode.removeChild( script );
  9262. }
  9263. function toType( obj ) {
  9264. if ( obj == null ) {
  9265. return obj + "";
  9266. }
  9267. // Support: Android <=2.3 only (functionish RegExp)
  9268. return typeof obj === "object" || typeof obj === "function" ?
  9269. class2type[ toString.call( obj ) ] || "object" :
  9270. typeof obj;
  9271. }
  9272. /* global Symbol */
  9273. // Defining this global in .eslintrc.json would create a danger of using the global
  9274. // unguarded in another place, it seems safer to define global only for this module
  9275. var
  9276. version = "3.4.1",
  9277. // Define a local copy of jQuery
  9278. jQuery = function( selector, context ) {
  9279. // The jQuery object is actually just the init constructor 'enhanced'
  9280. // Need init if jQuery is called (just allow error to be thrown if not included)
  9281. return new jQuery.fn.init( selector, context );
  9282. },
  9283. // Support: Android <=4.0 only
  9284. // Make sure we trim BOM and NBSP
  9285. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9286. jQuery.fn = jQuery.prototype = {
  9287. // The current version of jQuery being used
  9288. jquery: version,
  9289. constructor: jQuery,
  9290. // The default length of a jQuery object is 0
  9291. length: 0,
  9292. toArray: function() {
  9293. return slice.call( this );
  9294. },
  9295. // Get the Nth element in the matched element set OR
  9296. // Get the whole matched element set as a clean array
  9297. get: function( num ) {
  9298. // Return all the elements in a clean array
  9299. if ( num == null ) {
  9300. return slice.call( this );
  9301. }
  9302. // Return just the one element from the set
  9303. return num < 0 ? this[ num + this.length ] : this[ num ];
  9304. },
  9305. // Take an array of elements and push it onto the stack
  9306. // (returning the new matched element set)
  9307. pushStack: function( elems ) {
  9308. // Build a new jQuery matched element set
  9309. var ret = jQuery.merge( this.constructor(), elems );
  9310. // Add the old object onto the stack (as a reference)
  9311. ret.prevObject = this;
  9312. // Return the newly-formed element set
  9313. return ret;
  9314. },
  9315. // Execute a callback for every element in the matched set.
  9316. each: function( callback ) {
  9317. return jQuery.each( this, callback );
  9318. },
  9319. map: function( callback ) {
  9320. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9321. return callback.call( elem, i, elem );
  9322. } ) );
  9323. },
  9324. slice: function() {
  9325. return this.pushStack( slice.apply( this, arguments ) );
  9326. },
  9327. first: function() {
  9328. return this.eq( 0 );
  9329. },
  9330. last: function() {
  9331. return this.eq( -1 );
  9332. },
  9333. eq: function( i ) {
  9334. var len = this.length,
  9335. j = +i + ( i < 0 ? len : 0 );
  9336. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9337. },
  9338. end: function() {
  9339. return this.prevObject || this.constructor();
  9340. },
  9341. // For internal use only.
  9342. // Behaves like an Array's method, not like a jQuery method.
  9343. push: push,
  9344. sort: arr.sort,
  9345. splice: arr.splice
  9346. };
  9347. jQuery.extend = jQuery.fn.extend = function() {
  9348. var options, name, src, copy, copyIsArray, clone,
  9349. target = arguments[ 0 ] || {},
  9350. i = 1,
  9351. length = arguments.length,
  9352. deep = false;
  9353. // Handle a deep copy situation
  9354. if ( typeof target === "boolean" ) {
  9355. deep = target;
  9356. // Skip the boolean and the target
  9357. target = arguments[ i ] || {};
  9358. i++;
  9359. }
  9360. // Handle case when target is a string or something (possible in deep copy)
  9361. if ( typeof target !== "object" && !isFunction( target ) ) {
  9362. target = {};
  9363. }
  9364. // Extend jQuery itself if only one argument is passed
  9365. if ( i === length ) {
  9366. target = this;
  9367. i--;
  9368. }
  9369. for ( ; i < length; i++ ) {
  9370. // Only deal with non-null/undefined values
  9371. if ( ( options = arguments[ i ] ) != null ) {
  9372. // Extend the base object
  9373. for ( name in options ) {
  9374. copy = options[ name ];
  9375. // Prevent Object.prototype pollution
  9376. // Prevent never-ending loop
  9377. if ( name === "__proto__" || target === copy ) {
  9378. continue;
  9379. }
  9380. // Recurse if we're merging plain objects or arrays
  9381. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9382. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9383. src = target[ name ];
  9384. // Ensure proper type for the source value
  9385. if ( copyIsArray && !Array.isArray( src ) ) {
  9386. clone = [];
  9387. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9388. clone = {};
  9389. } else {
  9390. clone = src;
  9391. }
  9392. copyIsArray = false;
  9393. // Never move original objects, clone them
  9394. target[ name ] = jQuery.extend( deep, clone, copy );
  9395. // Don't bring in undefined values
  9396. } else if ( copy !== undefined ) {
  9397. target[ name ] = copy;
  9398. }
  9399. }
  9400. }
  9401. }
  9402. // Return the modified object
  9403. return target;
  9404. };
  9405. jQuery.extend( {
  9406. // Unique for each copy of jQuery on the page
  9407. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9408. // Assume jQuery is ready without the ready module
  9409. isReady: true,
  9410. error: function( msg ) {
  9411. throw new Error( msg );
  9412. },
  9413. noop: function() {},
  9414. isPlainObject: function( obj ) {
  9415. var proto, Ctor;
  9416. // Detect obvious negatives
  9417. // Use toString instead of jQuery.type to catch host objects
  9418. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9419. return false;
  9420. }
  9421. proto = getProto( obj );
  9422. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9423. if ( !proto ) {
  9424. return true;
  9425. }
  9426. // Objects with prototype are plain iff they were constructed by a global Object function
  9427. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9428. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9429. },
  9430. isEmptyObject: function( obj ) {
  9431. var name;
  9432. for ( name in obj ) {
  9433. return false;
  9434. }
  9435. return true;
  9436. },
  9437. // Evaluates a script in a global context
  9438. globalEval: function( code, options ) {
  9439. DOMEval( code, { nonce: options && options.nonce } );
  9440. },
  9441. each: function( obj, callback ) {
  9442. var length, i = 0;
  9443. if ( isArrayLike( obj ) ) {
  9444. length = obj.length;
  9445. for ( ; i < length; i++ ) {
  9446. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9447. break;
  9448. }
  9449. }
  9450. } else {
  9451. for ( i in obj ) {
  9452. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9453. break;
  9454. }
  9455. }
  9456. }
  9457. return obj;
  9458. },
  9459. // Support: Android <=4.0 only
  9460. trim: function( text ) {
  9461. return text == null ?
  9462. "" :
  9463. ( text + "" ).replace( rtrim, "" );
  9464. },
  9465. // results is for internal usage only
  9466. makeArray: function( arr, results ) {
  9467. var ret = results || [];
  9468. if ( arr != null ) {
  9469. if ( isArrayLike( Object( arr ) ) ) {
  9470. jQuery.merge( ret,
  9471. typeof arr === "string" ?
  9472. [ arr ] : arr
  9473. );
  9474. } else {
  9475. push.call( ret, arr );
  9476. }
  9477. }
  9478. return ret;
  9479. },
  9480. inArray: function( elem, arr, i ) {
  9481. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9482. },
  9483. // Support: Android <=4.0 only, PhantomJS 1 only
  9484. // push.apply(_, arraylike) throws on ancient WebKit
  9485. merge: function( first, second ) {
  9486. var len = +second.length,
  9487. j = 0,
  9488. i = first.length;
  9489. for ( ; j < len; j++ ) {
  9490. first[ i++ ] = second[ j ];
  9491. }
  9492. first.length = i;
  9493. return first;
  9494. },
  9495. grep: function( elems, callback, invert ) {
  9496. var callbackInverse,
  9497. matches = [],
  9498. i = 0,
  9499. length = elems.length,
  9500. callbackExpect = !invert;
  9501. // Go through the array, only saving the items
  9502. // that pass the validator function
  9503. for ( ; i < length; i++ ) {
  9504. callbackInverse = !callback( elems[ i ], i );
  9505. if ( callbackInverse !== callbackExpect ) {
  9506. matches.push( elems[ i ] );
  9507. }
  9508. }
  9509. return matches;
  9510. },
  9511. // arg is for internal usage only
  9512. map: function( elems, callback, arg ) {
  9513. var length, value,
  9514. i = 0,
  9515. ret = [];
  9516. // Go through the array, translating each of the items to their new values
  9517. if ( isArrayLike( elems ) ) {
  9518. length = elems.length;
  9519. for ( ; i < length; i++ ) {
  9520. value = callback( elems[ i ], i, arg );
  9521. if ( value != null ) {
  9522. ret.push( value );
  9523. }
  9524. }
  9525. // Go through every key on the object,
  9526. } else {
  9527. for ( i in elems ) {
  9528. value = callback( elems[ i ], i, arg );
  9529. if ( value != null ) {
  9530. ret.push( value );
  9531. }
  9532. }
  9533. }
  9534. // Flatten any nested arrays
  9535. return concat.apply( [], ret );
  9536. },
  9537. // A global GUID counter for objects
  9538. guid: 1,
  9539. // jQuery.support is not used in Core but other projects attach their
  9540. // properties to it so it needs to exist.
  9541. support: support
  9542. } );
  9543. if ( typeof Symbol === "function" ) {
  9544. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9545. }
  9546. // Populate the class2type map
  9547. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9548. function( i, name ) {
  9549. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9550. } );
  9551. function isArrayLike( obj ) {
  9552. // Support: real iOS 8.2 only (not reproducible in simulator)
  9553. // `in` check used to prevent JIT error (gh-2145)
  9554. // hasOwn isn't used here due to false negatives
  9555. // regarding Nodelist length in IE
  9556. var length = !!obj && "length" in obj && obj.length,
  9557. type = toType( obj );
  9558. if ( isFunction( obj ) || isWindow( obj ) ) {
  9559. return false;
  9560. }
  9561. return type === "array" || length === 0 ||
  9562. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9563. }
  9564. var Sizzle =
  9565. /*!
  9566. * Sizzle CSS Selector Engine v2.3.4
  9567. * https://sizzlejs.com/
  9568. *
  9569. * Copyright JS Foundation and other contributors
  9570. * Released under the MIT license
  9571. * https://js.foundation/
  9572. *
  9573. * Date: 2019-04-08
  9574. */
  9575. (function( window ) {
  9576. var i,
  9577. support,
  9578. Expr,
  9579. getText,
  9580. isXML,
  9581. tokenize,
  9582. compile,
  9583. select,
  9584. outermostContext,
  9585. sortInput,
  9586. hasDuplicate,
  9587. // Local document vars
  9588. setDocument,
  9589. document,
  9590. docElem,
  9591. documentIsHTML,
  9592. rbuggyQSA,
  9593. rbuggyMatches,
  9594. matches,
  9595. contains,
  9596. // Instance-specific data
  9597. expando = "sizzle" + 1 * new Date(),
  9598. preferredDoc = window.document,
  9599. dirruns = 0,
  9600. done = 0,
  9601. classCache = createCache(),
  9602. tokenCache = createCache(),
  9603. compilerCache = createCache(),
  9604. nonnativeSelectorCache = createCache(),
  9605. sortOrder = function( a, b ) {
  9606. if ( a === b ) {
  9607. hasDuplicate = true;
  9608. }
  9609. return 0;
  9610. },
  9611. // Instance methods
  9612. hasOwn = ({}).hasOwnProperty,
  9613. arr = [],
  9614. pop = arr.pop,
  9615. push_native = arr.push,
  9616. push = arr.push,
  9617. slice = arr.slice,
  9618. // Use a stripped-down indexOf as it's faster than native
  9619. // https://jsperf.com/thor-indexof-vs-for/5
  9620. indexOf = function( list, elem ) {
  9621. var i = 0,
  9622. len = list.length;
  9623. for ( ; i < len; i++ ) {
  9624. if ( list[i] === elem ) {
  9625. return i;
  9626. }
  9627. }
  9628. return -1;
  9629. },
  9630. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9631. // Regular expressions
  9632. // http://www.w3.org/TR/css3-selectors/#whitespace
  9633. whitespace = "[\\x20\\t\\r\\n\\f]",
  9634. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9635. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9636. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9637. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9638. // Operator (capture 2)
  9639. "*([*^$|!~]?=)" + whitespace +
  9640. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9641. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9642. "*\\]",
  9643. pseudos = ":(" + identifier + ")(?:\\((" +
  9644. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9645. // 1. quoted (capture 3; capture 4 or capture 5)
  9646. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9647. // 2. simple (capture 6)
  9648. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9649. // 3. anything else (capture 2)
  9650. ".*" +
  9651. ")\\)|)",
  9652. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9653. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9654. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9655. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9656. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9657. rdescend = new RegExp( whitespace + "|>" ),
  9658. rpseudo = new RegExp( pseudos ),
  9659. ridentifier = new RegExp( "^" + identifier + "$" ),
  9660. matchExpr = {
  9661. "ID": new RegExp( "^#(" + identifier + ")" ),
  9662. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9663. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9664. "ATTR": new RegExp( "^" + attributes ),
  9665. "PSEUDO": new RegExp( "^" + pseudos ),
  9666. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9667. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9668. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9669. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9670. // For use in libraries implementing .is()
  9671. // We use this for POS matching in `select`
  9672. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9673. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9674. },
  9675. rhtml = /HTML$/i,
  9676. rinputs = /^(?:input|select|textarea|button)$/i,
  9677. rheader = /^h\d$/i,
  9678. rnative = /^[^{]+\{\s*\[native \w/,
  9679. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9680. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9681. rsibling = /[+~]/,
  9682. // CSS escapes
  9683. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9684. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9685. funescape = function( _, escaped, escapedWhitespace ) {
  9686. var high = "0x" + escaped - 0x10000;
  9687. // NaN means non-codepoint
  9688. // Support: Firefox<24
  9689. // Workaround erroneous numeric interpretation of +"0x"
  9690. return high !== high || escapedWhitespace ?
  9691. escaped :
  9692. high < 0 ?
  9693. // BMP codepoint
  9694. String.fromCharCode( high + 0x10000 ) :
  9695. // Supplemental Plane codepoint (surrogate pair)
  9696. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9697. },
  9698. // CSS string/identifier serialization
  9699. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9700. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9701. fcssescape = function( ch, asCodePoint ) {
  9702. if ( asCodePoint ) {
  9703. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9704. if ( ch === "\0" ) {
  9705. return "\uFFFD";
  9706. }
  9707. // Control characters and (dependent upon position) numbers get escaped as code points
  9708. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9709. }
  9710. // Other potentially-special ASCII characters get backslash-escaped
  9711. return "\\" + ch;
  9712. },
  9713. // Used for iframes
  9714. // See setDocument()
  9715. // Removing the function wrapper causes a "Permission Denied"
  9716. // error in IE
  9717. unloadHandler = function() {
  9718. setDocument();
  9719. },
  9720. inDisabledFieldset = addCombinator(
  9721. function( elem ) {
  9722. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9723. },
  9724. { dir: "parentNode", next: "legend" }
  9725. );
  9726. // Optimize for push.apply( _, NodeList )
  9727. try {
  9728. push.apply(
  9729. (arr = slice.call( preferredDoc.childNodes )),
  9730. preferredDoc.childNodes
  9731. );
  9732. // Support: Android<4.0
  9733. // Detect silently failing push.apply
  9734. arr[ preferredDoc.childNodes.length ].nodeType;
  9735. } catch ( e ) {
  9736. push = { apply: arr.length ?
  9737. // Leverage slice if possible
  9738. function( target, els ) {
  9739. push_native.apply( target, slice.call(els) );
  9740. } :
  9741. // Support: IE<9
  9742. // Otherwise append directly
  9743. function( target, els ) {
  9744. var j = target.length,
  9745. i = 0;
  9746. // Can't trust NodeList.length
  9747. while ( (target[j++] = els[i++]) ) {}
  9748. target.length = j - 1;
  9749. }
  9750. };
  9751. }
  9752. function Sizzle( selector, context, results, seed ) {
  9753. var m, i, elem, nid, match, groups, newSelector,
  9754. newContext = context && context.ownerDocument,
  9755. // nodeType defaults to 9, since context defaults to document
  9756. nodeType = context ? context.nodeType : 9;
  9757. results = results || [];
  9758. // Return early from calls with invalid selector or context
  9759. if ( typeof selector !== "string" || !selector ||
  9760. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9761. return results;
  9762. }
  9763. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9764. if ( !seed ) {
  9765. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9766. setDocument( context );
  9767. }
  9768. context = context || document;
  9769. if ( documentIsHTML ) {
  9770. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9771. // (excepting DocumentFragment context, where the methods don't exist)
  9772. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9773. // ID selector
  9774. if ( (m = match[1]) ) {
  9775. // Document context
  9776. if ( nodeType === 9 ) {
  9777. if ( (elem = context.getElementById( m )) ) {
  9778. // Support: IE, Opera, Webkit
  9779. // TODO: identify versions
  9780. // getElementById can match elements by name instead of ID
  9781. if ( elem.id === m ) {
  9782. results.push( elem );
  9783. return results;
  9784. }
  9785. } else {
  9786. return results;
  9787. }
  9788. // Element context
  9789. } else {
  9790. // Support: IE, Opera, Webkit
  9791. // TODO: identify versions
  9792. // getElementById can match elements by name instead of ID
  9793. if ( newContext && (elem = newContext.getElementById( m )) &&
  9794. contains( context, elem ) &&
  9795. elem.id === m ) {
  9796. results.push( elem );
  9797. return results;
  9798. }
  9799. }
  9800. // Type selector
  9801. } else if ( match[2] ) {
  9802. push.apply( results, context.getElementsByTagName( selector ) );
  9803. return results;
  9804. // Class selector
  9805. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9806. context.getElementsByClassName ) {
  9807. push.apply( results, context.getElementsByClassName( m ) );
  9808. return results;
  9809. }
  9810. }
  9811. // Take advantage of querySelectorAll
  9812. if ( support.qsa &&
  9813. !nonnativeSelectorCache[ selector + " " ] &&
  9814. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9815. // Support: IE 8 only
  9816. // Exclude object elements
  9817. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9818. newSelector = selector;
  9819. newContext = context;
  9820. // qSA considers elements outside a scoping root when evaluating child or
  9821. // descendant combinators, which is not what we want.
  9822. // In such cases, we work around the behavior by prefixing every selector in the
  9823. // list with an ID selector referencing the scope context.
  9824. // Thanks to Andrew Dupont for this technique.
  9825. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9826. // Capture the context ID, setting it first if necessary
  9827. if ( (nid = context.getAttribute( "id" )) ) {
  9828. nid = nid.replace( rcssescape, fcssescape );
  9829. } else {
  9830. context.setAttribute( "id", (nid = expando) );
  9831. }
  9832. // Prefix every selector in the list
  9833. groups = tokenize( selector );
  9834. i = groups.length;
  9835. while ( i-- ) {
  9836. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9837. }
  9838. newSelector = groups.join( "," );
  9839. // Expand context for sibling selectors
  9840. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9841. context;
  9842. }
  9843. try {
  9844. push.apply( results,
  9845. newContext.querySelectorAll( newSelector )
  9846. );
  9847. return results;
  9848. } catch ( qsaError ) {
  9849. nonnativeSelectorCache( selector, true );
  9850. } finally {
  9851. if ( nid === expando ) {
  9852. context.removeAttribute( "id" );
  9853. }
  9854. }
  9855. }
  9856. }
  9857. }
  9858. // All others
  9859. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9860. }
  9861. /**
  9862. * Create key-value caches of limited size
  9863. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9864. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9865. * deleting the oldest entry
  9866. */
  9867. function createCache() {
  9868. var keys = [];
  9869. function cache( key, value ) {
  9870. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9871. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9872. // Only keep the most recent entries
  9873. delete cache[ keys.shift() ];
  9874. }
  9875. return (cache[ key + " " ] = value);
  9876. }
  9877. return cache;
  9878. }
  9879. /**
  9880. * Mark a function for special use by Sizzle
  9881. * @param {Function} fn The function to mark
  9882. */
  9883. function markFunction( fn ) {
  9884. fn[ expando ] = true;
  9885. return fn;
  9886. }
  9887. /**
  9888. * Support testing using an element
  9889. * @param {Function} fn Passed the created element and returns a boolean result
  9890. */
  9891. function assert( fn ) {
  9892. var el = document.createElement("fieldset");
  9893. try {
  9894. return !!fn( el );
  9895. } catch (e) {
  9896. return false;
  9897. } finally {
  9898. // Remove from its parent by default
  9899. if ( el.parentNode ) {
  9900. el.parentNode.removeChild( el );
  9901. }
  9902. // release memory in IE
  9903. el = null;
  9904. }
  9905. }
  9906. /**
  9907. * Adds the same handler for all of the specified attrs
  9908. * @param {String} attrs Pipe-separated list of attributes
  9909. * @param {Function} handler The method that will be applied
  9910. */
  9911. function addHandle( attrs, handler ) {
  9912. var arr = attrs.split("|"),
  9913. i = arr.length;
  9914. while ( i-- ) {
  9915. Expr.attrHandle[ arr[i] ] = handler;
  9916. }
  9917. }
  9918. /**
  9919. * Checks document order of two siblings
  9920. * @param {Element} a
  9921. * @param {Element} b
  9922. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9923. */
  9924. function siblingCheck( a, b ) {
  9925. var cur = b && a,
  9926. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9927. a.sourceIndex - b.sourceIndex;
  9928. // Use IE sourceIndex if available on both nodes
  9929. if ( diff ) {
  9930. return diff;
  9931. }
  9932. // Check if b follows a
  9933. if ( cur ) {
  9934. while ( (cur = cur.nextSibling) ) {
  9935. if ( cur === b ) {
  9936. return -1;
  9937. }
  9938. }
  9939. }
  9940. return a ? 1 : -1;
  9941. }
  9942. /**
  9943. * Returns a function to use in pseudos for input types
  9944. * @param {String} type
  9945. */
  9946. function createInputPseudo( type ) {
  9947. return function( elem ) {
  9948. var name = elem.nodeName.toLowerCase();
  9949. return name === "input" && elem.type === type;
  9950. };
  9951. }
  9952. /**
  9953. * Returns a function to use in pseudos for buttons
  9954. * @param {String} type
  9955. */
  9956. function createButtonPseudo( type ) {
  9957. return function( elem ) {
  9958. var name = elem.nodeName.toLowerCase();
  9959. return (name === "input" || name === "button") && elem.type === type;
  9960. };
  9961. }
  9962. /**
  9963. * Returns a function to use in pseudos for :enabled/:disabled
  9964. * @param {Boolean} disabled true for :disabled; false for :enabled
  9965. */
  9966. function createDisabledPseudo( disabled ) {
  9967. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9968. return function( elem ) {
  9969. // Only certain elements can match :enabled or :disabled
  9970. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9971. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9972. if ( "form" in elem ) {
  9973. // Check for inherited disabledness on relevant non-disabled elements:
  9974. // * listed form-associated elements in a disabled fieldset
  9975. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9976. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9977. // * option elements in a disabled optgroup
  9978. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9979. // All such elements have a "form" property.
  9980. if ( elem.parentNode && elem.disabled === false ) {
  9981. // Option elements defer to a parent optgroup if present
  9982. if ( "label" in elem ) {
  9983. if ( "label" in elem.parentNode ) {
  9984. return elem.parentNode.disabled === disabled;
  9985. } else {
  9986. return elem.disabled === disabled;
  9987. }
  9988. }
  9989. // Support: IE 6 - 11
  9990. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9991. return elem.isDisabled === disabled ||
  9992. // Where there is no isDisabled, check manually
  9993. /* jshint -W018 */
  9994. elem.isDisabled !== !disabled &&
  9995. inDisabledFieldset( elem ) === disabled;
  9996. }
  9997. return elem.disabled === disabled;
  9998. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9999. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10000. // even exist on them, let alone have a boolean value.
  10001. } else if ( "label" in elem ) {
  10002. return elem.disabled === disabled;
  10003. }
  10004. // Remaining elements are neither :enabled nor :disabled
  10005. return false;
  10006. };
  10007. }
  10008. /**
  10009. * Returns a function to use in pseudos for positionals
  10010. * @param {Function} fn
  10011. */
  10012. function createPositionalPseudo( fn ) {
  10013. return markFunction(function( argument ) {
  10014. argument = +argument;
  10015. return markFunction(function( seed, matches ) {
  10016. var j,
  10017. matchIndexes = fn( [], seed.length, argument ),
  10018. i = matchIndexes.length;
  10019. // Match elements found at the specified indexes
  10020. while ( i-- ) {
  10021. if ( seed[ (j = matchIndexes[i]) ] ) {
  10022. seed[j] = !(matches[j] = seed[j]);
  10023. }
  10024. }
  10025. });
  10026. });
  10027. }
  10028. /**
  10029. * Checks a node for validity as a Sizzle context
  10030. * @param {Element|Object=} context
  10031. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10032. */
  10033. function testContext( context ) {
  10034. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10035. }
  10036. // Expose support vars for convenience
  10037. support = Sizzle.support = {};
  10038. /**
  10039. * Detects XML nodes
  10040. * @param {Element|Object} elem An element or a document
  10041. * @returns {Boolean} True iff elem is a non-HTML XML node
  10042. */
  10043. isXML = Sizzle.isXML = function( elem ) {
  10044. var namespace = elem.namespaceURI,
  10045. docElem = (elem.ownerDocument || elem).documentElement;
  10046. // Support: IE <=8
  10047. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10048. // https://bugs.jquery.com/ticket/4833
  10049. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10050. };
  10051. /**
  10052. * Sets document-related variables once based on the current document
  10053. * @param {Element|Object} [doc] An element or document object to use to set the document
  10054. * @returns {Object} Returns the current document
  10055. */
  10056. setDocument = Sizzle.setDocument = function( node ) {
  10057. var hasCompare, subWindow,
  10058. doc = node ? node.ownerDocument || node : preferredDoc;
  10059. // Return early if doc is invalid or already selected
  10060. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10061. return document;
  10062. }
  10063. // Update global variables
  10064. document = doc;
  10065. docElem = document.documentElement;
  10066. documentIsHTML = !isXML( document );
  10067. // Support: IE 9-11, Edge
  10068. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10069. if ( preferredDoc !== document &&
  10070. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10071. // Support: IE 11, Edge
  10072. if ( subWindow.addEventListener ) {
  10073. subWindow.addEventListener( "unload", unloadHandler, false );
  10074. // Support: IE 9 - 10 only
  10075. } else if ( subWindow.attachEvent ) {
  10076. subWindow.attachEvent( "onunload", unloadHandler );
  10077. }
  10078. }
  10079. /* Attributes
  10080. ---------------------------------------------------------------------- */
  10081. // Support: IE<8
  10082. // Verify that getAttribute really returns attributes and not properties
  10083. // (excepting IE8 booleans)
  10084. support.attributes = assert(function( el ) {
  10085. el.className = "i";
  10086. return !el.getAttribute("className");
  10087. });
  10088. /* getElement(s)By*
  10089. ---------------------------------------------------------------------- */
  10090. // Check if getElementsByTagName("*") returns only elements
  10091. support.getElementsByTagName = assert(function( el ) {
  10092. el.appendChild( document.createComment("") );
  10093. return !el.getElementsByTagName("*").length;
  10094. });
  10095. // Support: IE<9
  10096. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10097. // Support: IE<10
  10098. // Check if getElementById returns elements by name
  10099. // The broken getElementById methods don't pick up programmatically-set names,
  10100. // so use a roundabout getElementsByName test
  10101. support.getById = assert(function( el ) {
  10102. docElem.appendChild( el ).id = expando;
  10103. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10104. });
  10105. // ID filter and find
  10106. if ( support.getById ) {
  10107. Expr.filter["ID"] = function( id ) {
  10108. var attrId = id.replace( runescape, funescape );
  10109. return function( elem ) {
  10110. return elem.getAttribute("id") === attrId;
  10111. };
  10112. };
  10113. Expr.find["ID"] = function( id, context ) {
  10114. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10115. var elem = context.getElementById( id );
  10116. return elem ? [ elem ] : [];
  10117. }
  10118. };
  10119. } else {
  10120. Expr.filter["ID"] = function( id ) {
  10121. var attrId = id.replace( runescape, funescape );
  10122. return function( elem ) {
  10123. var node = typeof elem.getAttributeNode !== "undefined" &&
  10124. elem.getAttributeNode("id");
  10125. return node && node.value === attrId;
  10126. };
  10127. };
  10128. // Support: IE 6 - 7 only
  10129. // getElementById is not reliable as a find shortcut
  10130. Expr.find["ID"] = function( id, context ) {
  10131. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10132. var node, i, elems,
  10133. elem = context.getElementById( id );
  10134. if ( elem ) {
  10135. // Verify the id attribute
  10136. node = elem.getAttributeNode("id");
  10137. if ( node && node.value === id ) {
  10138. return [ elem ];
  10139. }
  10140. // Fall back on getElementsByName
  10141. elems = context.getElementsByName( id );
  10142. i = 0;
  10143. while ( (elem = elems[i++]) ) {
  10144. node = elem.getAttributeNode("id");
  10145. if ( node && node.value === id ) {
  10146. return [ elem ];
  10147. }
  10148. }
  10149. }
  10150. return [];
  10151. }
  10152. };
  10153. }
  10154. // Tag
  10155. Expr.find["TAG"] = support.getElementsByTagName ?
  10156. function( tag, context ) {
  10157. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10158. return context.getElementsByTagName( tag );
  10159. // DocumentFragment nodes don't have gEBTN
  10160. } else if ( support.qsa ) {
  10161. return context.querySelectorAll( tag );
  10162. }
  10163. } :
  10164. function( tag, context ) {
  10165. var elem,
  10166. tmp = [],
  10167. i = 0,
  10168. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10169. results = context.getElementsByTagName( tag );
  10170. // Filter out possible comments
  10171. if ( tag === "*" ) {
  10172. while ( (elem = results[i++]) ) {
  10173. if ( elem.nodeType === 1 ) {
  10174. tmp.push( elem );
  10175. }
  10176. }
  10177. return tmp;
  10178. }
  10179. return results;
  10180. };
  10181. // Class
  10182. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10183. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10184. return context.getElementsByClassName( className );
  10185. }
  10186. };
  10187. /* QSA/matchesSelector
  10188. ---------------------------------------------------------------------- */
  10189. // QSA and matchesSelector support
  10190. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10191. rbuggyMatches = [];
  10192. // qSa(:focus) reports false when true (Chrome 21)
  10193. // We allow this because of a bug in IE8/9 that throws an error
  10194. // whenever `document.activeElement` is accessed on an iframe
  10195. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10196. // See https://bugs.jquery.com/ticket/13378
  10197. rbuggyQSA = [];
  10198. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10199. // Build QSA regex
  10200. // Regex strategy adopted from Diego Perini
  10201. assert(function( el ) {
  10202. // Select is set to empty string on purpose
  10203. // This is to test IE's treatment of not explicitly
  10204. // setting a boolean content attribute,
  10205. // since its presence should be enough
  10206. // https://bugs.jquery.com/ticket/12359
  10207. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10208. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10209. "<option selected=''></option></select>";
  10210. // Support: IE8, Opera 11-12.16
  10211. // Nothing should be selected when empty strings follow ^= or $= or *=
  10212. // The test attribute must be unknown in Opera but "safe" for WinRT
  10213. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10214. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10215. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10216. }
  10217. // Support: IE8
  10218. // Boolean attributes and "value" are not treated correctly
  10219. if ( !el.querySelectorAll("[selected]").length ) {
  10220. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10221. }
  10222. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10223. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10224. rbuggyQSA.push("~=");
  10225. }
  10226. // Webkit/Opera - :checked should return selected option elements
  10227. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10228. // IE8 throws error here and will not see later tests
  10229. if ( !el.querySelectorAll(":checked").length ) {
  10230. rbuggyQSA.push(":checked");
  10231. }
  10232. // Support: Safari 8+, iOS 8+
  10233. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10234. // In-page `selector#id sibling-combinator selector` fails
  10235. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10236. rbuggyQSA.push(".#.+[+~]");
  10237. }
  10238. });
  10239. assert(function( el ) {
  10240. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10241. "<select disabled='disabled'><option/></select>";
  10242. // Support: Windows 8 Native Apps
  10243. // The type and name attributes are restricted during .innerHTML assignment
  10244. var input = document.createElement("input");
  10245. input.setAttribute( "type", "hidden" );
  10246. el.appendChild( input ).setAttribute( "name", "D" );
  10247. // Support: IE8
  10248. // Enforce case-sensitivity of name attribute
  10249. if ( el.querySelectorAll("[name=d]").length ) {
  10250. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10251. }
  10252. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10253. // IE8 throws error here and will not see later tests
  10254. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10255. rbuggyQSA.push( ":enabled", ":disabled" );
  10256. }
  10257. // Support: IE9-11+
  10258. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10259. docElem.appendChild( el ).disabled = true;
  10260. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10261. rbuggyQSA.push( ":enabled", ":disabled" );
  10262. }
  10263. // Opera 10-11 does not throw on post-comma invalid pseudos
  10264. el.querySelectorAll("*,:x");
  10265. rbuggyQSA.push(",.*:");
  10266. });
  10267. }
  10268. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10269. docElem.webkitMatchesSelector ||
  10270. docElem.mozMatchesSelector ||
  10271. docElem.oMatchesSelector ||
  10272. docElem.msMatchesSelector) )) ) {
  10273. assert(function( el ) {
  10274. // Check to see if it's possible to do matchesSelector
  10275. // on a disconnected node (IE 9)
  10276. support.disconnectedMatch = matches.call( el, "*" );
  10277. // This should fail with an exception
  10278. // Gecko does not error, returns false instead
  10279. matches.call( el, "[s!='']:x" );
  10280. rbuggyMatches.push( "!=", pseudos );
  10281. });
  10282. }
  10283. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10284. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10285. /* Contains
  10286. ---------------------------------------------------------------------- */
  10287. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10288. // Element contains another
  10289. // Purposefully self-exclusive
  10290. // As in, an element does not contain itself
  10291. contains = hasCompare || rnative.test( docElem.contains ) ?
  10292. function( a, b ) {
  10293. var adown = a.nodeType === 9 ? a.documentElement : a,
  10294. bup = b && b.parentNode;
  10295. return a === bup || !!( bup && bup.nodeType === 1 && (
  10296. adown.contains ?
  10297. adown.contains( bup ) :
  10298. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10299. ));
  10300. } :
  10301. function( a, b ) {
  10302. if ( b ) {
  10303. while ( (b = b.parentNode) ) {
  10304. if ( b === a ) {
  10305. return true;
  10306. }
  10307. }
  10308. }
  10309. return false;
  10310. };
  10311. /* Sorting
  10312. ---------------------------------------------------------------------- */
  10313. // Document order sorting
  10314. sortOrder = hasCompare ?
  10315. function( a, b ) {
  10316. // Flag for duplicate removal
  10317. if ( a === b ) {
  10318. hasDuplicate = true;
  10319. return 0;
  10320. }
  10321. // Sort on method existence if only one input has compareDocumentPosition
  10322. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10323. if ( compare ) {
  10324. return compare;
  10325. }
  10326. // Calculate position if both inputs belong to the same document
  10327. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10328. a.compareDocumentPosition( b ) :
  10329. // Otherwise we know they are disconnected
  10330. 1;
  10331. // Disconnected nodes
  10332. if ( compare & 1 ||
  10333. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10334. // Choose the first element that is related to our preferred document
  10335. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10336. return -1;
  10337. }
  10338. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10339. return 1;
  10340. }
  10341. // Maintain original order
  10342. return sortInput ?
  10343. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10344. 0;
  10345. }
  10346. return compare & 4 ? -1 : 1;
  10347. } :
  10348. function( a, b ) {
  10349. // Exit early if the nodes are identical
  10350. if ( a === b ) {
  10351. hasDuplicate = true;
  10352. return 0;
  10353. }
  10354. var cur,
  10355. i = 0,
  10356. aup = a.parentNode,
  10357. bup = b.parentNode,
  10358. ap = [ a ],
  10359. bp = [ b ];
  10360. // Parentless nodes are either documents or disconnected
  10361. if ( !aup || !bup ) {
  10362. return a === document ? -1 :
  10363. b === document ? 1 :
  10364. aup ? -1 :
  10365. bup ? 1 :
  10366. sortInput ?
  10367. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10368. 0;
  10369. // If the nodes are siblings, we can do a quick check
  10370. } else if ( aup === bup ) {
  10371. return siblingCheck( a, b );
  10372. }
  10373. // Otherwise we need full lists of their ancestors for comparison
  10374. cur = a;
  10375. while ( (cur = cur.parentNode) ) {
  10376. ap.unshift( cur );
  10377. }
  10378. cur = b;
  10379. while ( (cur = cur.parentNode) ) {
  10380. bp.unshift( cur );
  10381. }
  10382. // Walk down the tree looking for a discrepancy
  10383. while ( ap[i] === bp[i] ) {
  10384. i++;
  10385. }
  10386. return i ?
  10387. // Do a sibling check if the nodes have a common ancestor
  10388. siblingCheck( ap[i], bp[i] ) :
  10389. // Otherwise nodes in our document sort first
  10390. ap[i] === preferredDoc ? -1 :
  10391. bp[i] === preferredDoc ? 1 :
  10392. 0;
  10393. };
  10394. return document;
  10395. };
  10396. Sizzle.matches = function( expr, elements ) {
  10397. return Sizzle( expr, null, null, elements );
  10398. };
  10399. Sizzle.matchesSelector = function( elem, expr ) {
  10400. // Set document vars if needed
  10401. if ( ( elem.ownerDocument || elem ) !== document ) {
  10402. setDocument( elem );
  10403. }
  10404. if ( support.matchesSelector && documentIsHTML &&
  10405. !nonnativeSelectorCache[ expr + " " ] &&
  10406. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10407. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10408. try {
  10409. var ret = matches.call( elem, expr );
  10410. // IE 9's matchesSelector returns false on disconnected nodes
  10411. if ( ret || support.disconnectedMatch ||
  10412. // As well, disconnected nodes are said to be in a document
  10413. // fragment in IE 9
  10414. elem.document && elem.document.nodeType !== 11 ) {
  10415. return ret;
  10416. }
  10417. } catch (e) {
  10418. nonnativeSelectorCache( expr, true );
  10419. }
  10420. }
  10421. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10422. };
  10423. Sizzle.contains = function( context, elem ) {
  10424. // Set document vars if needed
  10425. if ( ( context.ownerDocument || context ) !== document ) {
  10426. setDocument( context );
  10427. }
  10428. return contains( context, elem );
  10429. };
  10430. Sizzle.attr = function( elem, name ) {
  10431. // Set document vars if needed
  10432. if ( ( elem.ownerDocument || elem ) !== document ) {
  10433. setDocument( elem );
  10434. }
  10435. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10436. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10437. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10438. fn( elem, name, !documentIsHTML ) :
  10439. undefined;
  10440. return val !== undefined ?
  10441. val :
  10442. support.attributes || !documentIsHTML ?
  10443. elem.getAttribute( name ) :
  10444. (val = elem.getAttributeNode(name)) && val.specified ?
  10445. val.value :
  10446. null;
  10447. };
  10448. Sizzle.escape = function( sel ) {
  10449. return (sel + "").replace( rcssescape, fcssescape );
  10450. };
  10451. Sizzle.error = function( msg ) {
  10452. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10453. };
  10454. /**
  10455. * Document sorting and removing duplicates
  10456. * @param {ArrayLike} results
  10457. */
  10458. Sizzle.uniqueSort = function( results ) {
  10459. var elem,
  10460. duplicates = [],
  10461. j = 0,
  10462. i = 0;
  10463. // Unless we *know* we can detect duplicates, assume their presence
  10464. hasDuplicate = !support.detectDuplicates;
  10465. sortInput = !support.sortStable && results.slice( 0 );
  10466. results.sort( sortOrder );
  10467. if ( hasDuplicate ) {
  10468. while ( (elem = results[i++]) ) {
  10469. if ( elem === results[ i ] ) {
  10470. j = duplicates.push( i );
  10471. }
  10472. }
  10473. while ( j-- ) {
  10474. results.splice( duplicates[ j ], 1 );
  10475. }
  10476. }
  10477. // Clear input after sorting to release objects
  10478. // See https://github.com/jquery/sizzle/pull/225
  10479. sortInput = null;
  10480. return results;
  10481. };
  10482. /**
  10483. * Utility function for retrieving the text value of an array of DOM nodes
  10484. * @param {Array|Element} elem
  10485. */
  10486. getText = Sizzle.getText = function( elem ) {
  10487. var node,
  10488. ret = "",
  10489. i = 0,
  10490. nodeType = elem.nodeType;
  10491. if ( !nodeType ) {
  10492. // If no nodeType, this is expected to be an array
  10493. while ( (node = elem[i++]) ) {
  10494. // Do not traverse comment nodes
  10495. ret += getText( node );
  10496. }
  10497. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10498. // Use textContent for elements
  10499. // innerText usage removed for consistency of new lines (jQuery #11153)
  10500. if ( typeof elem.textContent === "string" ) {
  10501. return elem.textContent;
  10502. } else {
  10503. // Traverse its children
  10504. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10505. ret += getText( elem );
  10506. }
  10507. }
  10508. } else if ( nodeType === 3 || nodeType === 4 ) {
  10509. return elem.nodeValue;
  10510. }
  10511. // Do not include comment or processing instruction nodes
  10512. return ret;
  10513. };
  10514. Expr = Sizzle.selectors = {
  10515. // Can be adjusted by the user
  10516. cacheLength: 50,
  10517. createPseudo: markFunction,
  10518. match: matchExpr,
  10519. attrHandle: {},
  10520. find: {},
  10521. relative: {
  10522. ">": { dir: "parentNode", first: true },
  10523. " ": { dir: "parentNode" },
  10524. "+": { dir: "previousSibling", first: true },
  10525. "~": { dir: "previousSibling" }
  10526. },
  10527. preFilter: {
  10528. "ATTR": function( match ) {
  10529. match[1] = match[1].replace( runescape, funescape );
  10530. // Move the given value to match[3] whether quoted or unquoted
  10531. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10532. if ( match[2] === "~=" ) {
  10533. match[3] = " " + match[3] + " ";
  10534. }
  10535. return match.slice( 0, 4 );
  10536. },
  10537. "CHILD": function( match ) {
  10538. /* matches from matchExpr["CHILD"]
  10539. 1 type (only|nth|...)
  10540. 2 what (child|of-type)
  10541. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10542. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10543. 5 sign of xn-component
  10544. 6 x of xn-component
  10545. 7 sign of y-component
  10546. 8 y of y-component
  10547. */
  10548. match[1] = match[1].toLowerCase();
  10549. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10550. // nth-* requires argument
  10551. if ( !match[3] ) {
  10552. Sizzle.error( match[0] );
  10553. }
  10554. // numeric x and y parameters for Expr.filter.CHILD
  10555. // remember that false/true cast respectively to 0/1
  10556. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10557. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10558. // other types prohibit arguments
  10559. } else if ( match[3] ) {
  10560. Sizzle.error( match[0] );
  10561. }
  10562. return match;
  10563. },
  10564. "PSEUDO": function( match ) {
  10565. var excess,
  10566. unquoted = !match[6] && match[2];
  10567. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10568. return null;
  10569. }
  10570. // Accept quoted arguments as-is
  10571. if ( match[3] ) {
  10572. match[2] = match[4] || match[5] || "";
  10573. // Strip excess characters from unquoted arguments
  10574. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10575. // Get excess from tokenize (recursively)
  10576. (excess = tokenize( unquoted, true )) &&
  10577. // advance to the next closing parenthesis
  10578. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10579. // excess is a negative index
  10580. match[0] = match[0].slice( 0, excess );
  10581. match[2] = unquoted.slice( 0, excess );
  10582. }
  10583. // Return only captures needed by the pseudo filter method (type and argument)
  10584. return match.slice( 0, 3 );
  10585. }
  10586. },
  10587. filter: {
  10588. "TAG": function( nodeNameSelector ) {
  10589. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10590. return nodeNameSelector === "*" ?
  10591. function() { return true; } :
  10592. function( elem ) {
  10593. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10594. };
  10595. },
  10596. "CLASS": function( className ) {
  10597. var pattern = classCache[ className + " " ];
  10598. return pattern ||
  10599. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10600. classCache( className, function( elem ) {
  10601. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10602. });
  10603. },
  10604. "ATTR": function( name, operator, check ) {
  10605. return function( elem ) {
  10606. var result = Sizzle.attr( elem, name );
  10607. if ( result == null ) {
  10608. return operator === "!=";
  10609. }
  10610. if ( !operator ) {
  10611. return true;
  10612. }
  10613. result += "";
  10614. return operator === "=" ? result === check :
  10615. operator === "!=" ? result !== check :
  10616. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10617. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10618. operator === "$=" ? check && result.slice( -check.length ) === check :
  10619. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10620. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10621. false;
  10622. };
  10623. },
  10624. "CHILD": function( type, what, argument, first, last ) {
  10625. var simple = type.slice( 0, 3 ) !== "nth",
  10626. forward = type.slice( -4 ) !== "last",
  10627. ofType = what === "of-type";
  10628. return first === 1 && last === 0 ?
  10629. // Shortcut for :nth-*(n)
  10630. function( elem ) {
  10631. return !!elem.parentNode;
  10632. } :
  10633. function( elem, context, xml ) {
  10634. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10635. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10636. parent = elem.parentNode,
  10637. name = ofType && elem.nodeName.toLowerCase(),
  10638. useCache = !xml && !ofType,
  10639. diff = false;
  10640. if ( parent ) {
  10641. // :(first|last|only)-(child|of-type)
  10642. if ( simple ) {
  10643. while ( dir ) {
  10644. node = elem;
  10645. while ( (node = node[ dir ]) ) {
  10646. if ( ofType ?
  10647. node.nodeName.toLowerCase() === name :
  10648. node.nodeType === 1 ) {
  10649. return false;
  10650. }
  10651. }
  10652. // Reverse direction for :only-* (if we haven't yet done so)
  10653. start = dir = type === "only" && !start && "nextSibling";
  10654. }
  10655. return true;
  10656. }
  10657. start = [ forward ? parent.firstChild : parent.lastChild ];
  10658. // non-xml :nth-child(...) stores cache data on `parent`
  10659. if ( forward && useCache ) {
  10660. // Seek `elem` from a previously-cached index
  10661. // ...in a gzip-friendly way
  10662. node = parent;
  10663. outerCache = node[ expando ] || (node[ expando ] = {});
  10664. // Support: IE <9 only
  10665. // Defend against cloned attroperties (jQuery gh-1709)
  10666. uniqueCache = outerCache[ node.uniqueID ] ||
  10667. (outerCache[ node.uniqueID ] = {});
  10668. cache = uniqueCache[ type ] || [];
  10669. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10670. diff = nodeIndex && cache[ 2 ];
  10671. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10672. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10673. // Fallback to seeking `elem` from the start
  10674. (diff = nodeIndex = 0) || start.pop()) ) {
  10675. // When found, cache indexes on `parent` and break
  10676. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10677. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10678. break;
  10679. }
  10680. }
  10681. } else {
  10682. // Use previously-cached element index if available
  10683. if ( useCache ) {
  10684. // ...in a gzip-friendly way
  10685. node = elem;
  10686. outerCache = node[ expando ] || (node[ expando ] = {});
  10687. // Support: IE <9 only
  10688. // Defend against cloned attroperties (jQuery gh-1709)
  10689. uniqueCache = outerCache[ node.uniqueID ] ||
  10690. (outerCache[ node.uniqueID ] = {});
  10691. cache = uniqueCache[ type ] || [];
  10692. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10693. diff = nodeIndex;
  10694. }
  10695. // xml :nth-child(...)
  10696. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10697. if ( diff === false ) {
  10698. // Use the same loop as above to seek `elem` from the start
  10699. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10700. (diff = nodeIndex = 0) || start.pop()) ) {
  10701. if ( ( ofType ?
  10702. node.nodeName.toLowerCase() === name :
  10703. node.nodeType === 1 ) &&
  10704. ++diff ) {
  10705. // Cache the index of each encountered element
  10706. if ( useCache ) {
  10707. outerCache = node[ expando ] || (node[ expando ] = {});
  10708. // Support: IE <9 only
  10709. // Defend against cloned attroperties (jQuery gh-1709)
  10710. uniqueCache = outerCache[ node.uniqueID ] ||
  10711. (outerCache[ node.uniqueID ] = {});
  10712. uniqueCache[ type ] = [ dirruns, diff ];
  10713. }
  10714. if ( node === elem ) {
  10715. break;
  10716. }
  10717. }
  10718. }
  10719. }
  10720. }
  10721. // Incorporate the offset, then check against cycle size
  10722. diff -= last;
  10723. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10724. }
  10725. };
  10726. },
  10727. "PSEUDO": function( pseudo, argument ) {
  10728. // pseudo-class names are case-insensitive
  10729. // http://www.w3.org/TR/selectors/#pseudo-classes
  10730. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10731. // Remember that setFilters inherits from pseudos
  10732. var args,
  10733. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10734. Sizzle.error( "unsupported pseudo: " + pseudo );
  10735. // The user may use createPseudo to indicate that
  10736. // arguments are needed to create the filter function
  10737. // just as Sizzle does
  10738. if ( fn[ expando ] ) {
  10739. return fn( argument );
  10740. }
  10741. // But maintain support for old signatures
  10742. if ( fn.length > 1 ) {
  10743. args = [ pseudo, pseudo, "", argument ];
  10744. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10745. markFunction(function( seed, matches ) {
  10746. var idx,
  10747. matched = fn( seed, argument ),
  10748. i = matched.length;
  10749. while ( i-- ) {
  10750. idx = indexOf( seed, matched[i] );
  10751. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10752. }
  10753. }) :
  10754. function( elem ) {
  10755. return fn( elem, 0, args );
  10756. };
  10757. }
  10758. return fn;
  10759. }
  10760. },
  10761. pseudos: {
  10762. // Potentially complex pseudos
  10763. "not": markFunction(function( selector ) {
  10764. // Trim the selector passed to compile
  10765. // to avoid treating leading and trailing
  10766. // spaces as combinators
  10767. var input = [],
  10768. results = [],
  10769. matcher = compile( selector.replace( rtrim, "$1" ) );
  10770. return matcher[ expando ] ?
  10771. markFunction(function( seed, matches, context, xml ) {
  10772. var elem,
  10773. unmatched = matcher( seed, null, xml, [] ),
  10774. i = seed.length;
  10775. // Match elements unmatched by `matcher`
  10776. while ( i-- ) {
  10777. if ( (elem = unmatched[i]) ) {
  10778. seed[i] = !(matches[i] = elem);
  10779. }
  10780. }
  10781. }) :
  10782. function( elem, context, xml ) {
  10783. input[0] = elem;
  10784. matcher( input, null, xml, results );
  10785. // Don't keep the element (issue #299)
  10786. input[0] = null;
  10787. return !results.pop();
  10788. };
  10789. }),
  10790. "has": markFunction(function( selector ) {
  10791. return function( elem ) {
  10792. return Sizzle( selector, elem ).length > 0;
  10793. };
  10794. }),
  10795. "contains": markFunction(function( text ) {
  10796. text = text.replace( runescape, funescape );
  10797. return function( elem ) {
  10798. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10799. };
  10800. }),
  10801. // "Whether an element is represented by a :lang() selector
  10802. // is based solely on the element's language value
  10803. // being equal to the identifier C,
  10804. // or beginning with the identifier C immediately followed by "-".
  10805. // The matching of C against the element's language value is performed case-insensitively.
  10806. // The identifier C does not have to be a valid language name."
  10807. // http://www.w3.org/TR/selectors/#lang-pseudo
  10808. "lang": markFunction( function( lang ) {
  10809. // lang value must be a valid identifier
  10810. if ( !ridentifier.test(lang || "") ) {
  10811. Sizzle.error( "unsupported lang: " + lang );
  10812. }
  10813. lang = lang.replace( runescape, funescape ).toLowerCase();
  10814. return function( elem ) {
  10815. var elemLang;
  10816. do {
  10817. if ( (elemLang = documentIsHTML ?
  10818. elem.lang :
  10819. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10820. elemLang = elemLang.toLowerCase();
  10821. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10822. }
  10823. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10824. return false;
  10825. };
  10826. }),
  10827. // Miscellaneous
  10828. "target": function( elem ) {
  10829. var hash = window.location && window.location.hash;
  10830. return hash && hash.slice( 1 ) === elem.id;
  10831. },
  10832. "root": function( elem ) {
  10833. return elem === docElem;
  10834. },
  10835. "focus": function( elem ) {
  10836. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10837. },
  10838. // Boolean properties
  10839. "enabled": createDisabledPseudo( false ),
  10840. "disabled": createDisabledPseudo( true ),
  10841. "checked": function( elem ) {
  10842. // In CSS3, :checked should return both checked and selected elements
  10843. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10844. var nodeName = elem.nodeName.toLowerCase();
  10845. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10846. },
  10847. "selected": function( elem ) {
  10848. // Accessing this property makes selected-by-default
  10849. // options in Safari work properly
  10850. if ( elem.parentNode ) {
  10851. elem.parentNode.selectedIndex;
  10852. }
  10853. return elem.selected === true;
  10854. },
  10855. // Contents
  10856. "empty": function( elem ) {
  10857. // http://www.w3.org/TR/selectors/#empty-pseudo
  10858. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10859. // but not by others (comment: 8; processing instruction: 7; etc.)
  10860. // nodeType < 6 works because attributes (2) do not appear as children
  10861. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10862. if ( elem.nodeType < 6 ) {
  10863. return false;
  10864. }
  10865. }
  10866. return true;
  10867. },
  10868. "parent": function( elem ) {
  10869. return !Expr.pseudos["empty"]( elem );
  10870. },
  10871. // Element/input types
  10872. "header": function( elem ) {
  10873. return rheader.test( elem.nodeName );
  10874. },
  10875. "input": function( elem ) {
  10876. return rinputs.test( elem.nodeName );
  10877. },
  10878. "button": function( elem ) {
  10879. var name = elem.nodeName.toLowerCase();
  10880. return name === "input" && elem.type === "button" || name === "button";
  10881. },
  10882. "text": function( elem ) {
  10883. var attr;
  10884. return elem.nodeName.toLowerCase() === "input" &&
  10885. elem.type === "text" &&
  10886. // Support: IE<8
  10887. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10888. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10889. },
  10890. // Position-in-collection
  10891. "first": createPositionalPseudo(function() {
  10892. return [ 0 ];
  10893. }),
  10894. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10895. return [ length - 1 ];
  10896. }),
  10897. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10898. return [ argument < 0 ? argument + length : argument ];
  10899. }),
  10900. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10901. var i = 0;
  10902. for ( ; i < length; i += 2 ) {
  10903. matchIndexes.push( i );
  10904. }
  10905. return matchIndexes;
  10906. }),
  10907. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10908. var i = 1;
  10909. for ( ; i < length; i += 2 ) {
  10910. matchIndexes.push( i );
  10911. }
  10912. return matchIndexes;
  10913. }),
  10914. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10915. var i = argument < 0 ?
  10916. argument + length :
  10917. argument > length ?
  10918. length :
  10919. argument;
  10920. for ( ; --i >= 0; ) {
  10921. matchIndexes.push( i );
  10922. }
  10923. return matchIndexes;
  10924. }),
  10925. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10926. var i = argument < 0 ? argument + length : argument;
  10927. for ( ; ++i < length; ) {
  10928. matchIndexes.push( i );
  10929. }
  10930. return matchIndexes;
  10931. })
  10932. }
  10933. };
  10934. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10935. // Add button/input type pseudos
  10936. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10937. Expr.pseudos[ i ] = createInputPseudo( i );
  10938. }
  10939. for ( i in { submit: true, reset: true } ) {
  10940. Expr.pseudos[ i ] = createButtonPseudo( i );
  10941. }
  10942. // Easy API for creating new setFilters
  10943. function setFilters() {}
  10944. setFilters.prototype = Expr.filters = Expr.pseudos;
  10945. Expr.setFilters = new setFilters();
  10946. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10947. var matched, match, tokens, type,
  10948. soFar, groups, preFilters,
  10949. cached = tokenCache[ selector + " " ];
  10950. if ( cached ) {
  10951. return parseOnly ? 0 : cached.slice( 0 );
  10952. }
  10953. soFar = selector;
  10954. groups = [];
  10955. preFilters = Expr.preFilter;
  10956. while ( soFar ) {
  10957. // Comma and first run
  10958. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10959. if ( match ) {
  10960. // Don't consume trailing commas as valid
  10961. soFar = soFar.slice( match[0].length ) || soFar;
  10962. }
  10963. groups.push( (tokens = []) );
  10964. }
  10965. matched = false;
  10966. // Combinators
  10967. if ( (match = rcombinators.exec( soFar )) ) {
  10968. matched = match.shift();
  10969. tokens.push({
  10970. value: matched,
  10971. // Cast descendant combinators to space
  10972. type: match[0].replace( rtrim, " " )
  10973. });
  10974. soFar = soFar.slice( matched.length );
  10975. }
  10976. // Filters
  10977. for ( type in Expr.filter ) {
  10978. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10979. (match = preFilters[ type ]( match ))) ) {
  10980. matched = match.shift();
  10981. tokens.push({
  10982. value: matched,
  10983. type: type,
  10984. matches: match
  10985. });
  10986. soFar = soFar.slice( matched.length );
  10987. }
  10988. }
  10989. if ( !matched ) {
  10990. break;
  10991. }
  10992. }
  10993. // Return the length of the invalid excess
  10994. // if we're just parsing
  10995. // Otherwise, throw an error or return tokens
  10996. return parseOnly ?
  10997. soFar.length :
  10998. soFar ?
  10999. Sizzle.error( selector ) :
  11000. // Cache the tokens
  11001. tokenCache( selector, groups ).slice( 0 );
  11002. };
  11003. function toSelector( tokens ) {
  11004. var i = 0,
  11005. len = tokens.length,
  11006. selector = "";
  11007. for ( ; i < len; i++ ) {
  11008. selector += tokens[i].value;
  11009. }
  11010. return selector;
  11011. }
  11012. function addCombinator( matcher, combinator, base ) {
  11013. var dir = combinator.dir,
  11014. skip = combinator.next,
  11015. key = skip || dir,
  11016. checkNonElements = base && key === "parentNode",
  11017. doneName = done++;
  11018. return combinator.first ?
  11019. // Check against closest ancestor/preceding element
  11020. function( elem, context, xml ) {
  11021. while ( (elem = elem[ dir ]) ) {
  11022. if ( elem.nodeType === 1 || checkNonElements ) {
  11023. return matcher( elem, context, xml );
  11024. }
  11025. }
  11026. return false;
  11027. } :
  11028. // Check against all ancestor/preceding elements
  11029. function( elem, context, xml ) {
  11030. var oldCache, uniqueCache, outerCache,
  11031. newCache = [ dirruns, doneName ];
  11032. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11033. if ( xml ) {
  11034. while ( (elem = elem[ dir ]) ) {
  11035. if ( elem.nodeType === 1 || checkNonElements ) {
  11036. if ( matcher( elem, context, xml ) ) {
  11037. return true;
  11038. }
  11039. }
  11040. }
  11041. } else {
  11042. while ( (elem = elem[ dir ]) ) {
  11043. if ( elem.nodeType === 1 || checkNonElements ) {
  11044. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11045. // Support: IE <9 only
  11046. // Defend against cloned attroperties (jQuery gh-1709)
  11047. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11048. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11049. elem = elem[ dir ] || elem;
  11050. } else if ( (oldCache = uniqueCache[ key ]) &&
  11051. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11052. // Assign to newCache so results back-propagate to previous elements
  11053. return (newCache[ 2 ] = oldCache[ 2 ]);
  11054. } else {
  11055. // Reuse newcache so results back-propagate to previous elements
  11056. uniqueCache[ key ] = newCache;
  11057. // A match means we're done; a fail means we have to keep checking
  11058. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11059. return true;
  11060. }
  11061. }
  11062. }
  11063. }
  11064. }
  11065. return false;
  11066. };
  11067. }
  11068. function elementMatcher( matchers ) {
  11069. return matchers.length > 1 ?
  11070. function( elem, context, xml ) {
  11071. var i = matchers.length;
  11072. while ( i-- ) {
  11073. if ( !matchers[i]( elem, context, xml ) ) {
  11074. return false;
  11075. }
  11076. }
  11077. return true;
  11078. } :
  11079. matchers[0];
  11080. }
  11081. function multipleContexts( selector, contexts, results ) {
  11082. var i = 0,
  11083. len = contexts.length;
  11084. for ( ; i < len; i++ ) {
  11085. Sizzle( selector, contexts[i], results );
  11086. }
  11087. return results;
  11088. }
  11089. function condense( unmatched, map, filter, context, xml ) {
  11090. var elem,
  11091. newUnmatched = [],
  11092. i = 0,
  11093. len = unmatched.length,
  11094. mapped = map != null;
  11095. for ( ; i < len; i++ ) {
  11096. if ( (elem = unmatched[i]) ) {
  11097. if ( !filter || filter( elem, context, xml ) ) {
  11098. newUnmatched.push( elem );
  11099. if ( mapped ) {
  11100. map.push( i );
  11101. }
  11102. }
  11103. }
  11104. }
  11105. return newUnmatched;
  11106. }
  11107. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11108. if ( postFilter && !postFilter[ expando ] ) {
  11109. postFilter = setMatcher( postFilter );
  11110. }
  11111. if ( postFinder && !postFinder[ expando ] ) {
  11112. postFinder = setMatcher( postFinder, postSelector );
  11113. }
  11114. return markFunction(function( seed, results, context, xml ) {
  11115. var temp, i, elem,
  11116. preMap = [],
  11117. postMap = [],
  11118. preexisting = results.length,
  11119. // Get initial elements from seed or context
  11120. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11121. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11122. matcherIn = preFilter && ( seed || !selector ) ?
  11123. condense( elems, preMap, preFilter, context, xml ) :
  11124. elems,
  11125. matcherOut = matcher ?
  11126. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11127. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11128. // ...intermediate processing is necessary
  11129. [] :
  11130. // ...otherwise use results directly
  11131. results :
  11132. matcherIn;
  11133. // Find primary matches
  11134. if ( matcher ) {
  11135. matcher( matcherIn, matcherOut, context, xml );
  11136. }
  11137. // Apply postFilter
  11138. if ( postFilter ) {
  11139. temp = condense( matcherOut, postMap );
  11140. postFilter( temp, [], context, xml );
  11141. // Un-match failing elements by moving them back to matcherIn
  11142. i = temp.length;
  11143. while ( i-- ) {
  11144. if ( (elem = temp[i]) ) {
  11145. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11146. }
  11147. }
  11148. }
  11149. if ( seed ) {
  11150. if ( postFinder || preFilter ) {
  11151. if ( postFinder ) {
  11152. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11153. temp = [];
  11154. i = matcherOut.length;
  11155. while ( i-- ) {
  11156. if ( (elem = matcherOut[i]) ) {
  11157. // Restore matcherIn since elem is not yet a final match
  11158. temp.push( (matcherIn[i] = elem) );
  11159. }
  11160. }
  11161. postFinder( null, (matcherOut = []), temp, xml );
  11162. }
  11163. // Move matched elements from seed to results to keep them synchronized
  11164. i = matcherOut.length;
  11165. while ( i-- ) {
  11166. if ( (elem = matcherOut[i]) &&
  11167. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11168. seed[temp] = !(results[temp] = elem);
  11169. }
  11170. }
  11171. }
  11172. // Add elements to results, through postFinder if defined
  11173. } else {
  11174. matcherOut = condense(
  11175. matcherOut === results ?
  11176. matcherOut.splice( preexisting, matcherOut.length ) :
  11177. matcherOut
  11178. );
  11179. if ( postFinder ) {
  11180. postFinder( null, results, matcherOut, xml );
  11181. } else {
  11182. push.apply( results, matcherOut );
  11183. }
  11184. }
  11185. });
  11186. }
  11187. function matcherFromTokens( tokens ) {
  11188. var checkContext, matcher, j,
  11189. len = tokens.length,
  11190. leadingRelative = Expr.relative[ tokens[0].type ],
  11191. implicitRelative = leadingRelative || Expr.relative[" "],
  11192. i = leadingRelative ? 1 : 0,
  11193. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11194. matchContext = addCombinator( function( elem ) {
  11195. return elem === checkContext;
  11196. }, implicitRelative, true ),
  11197. matchAnyContext = addCombinator( function( elem ) {
  11198. return indexOf( checkContext, elem ) > -1;
  11199. }, implicitRelative, true ),
  11200. matchers = [ function( elem, context, xml ) {
  11201. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11202. (checkContext = context).nodeType ?
  11203. matchContext( elem, context, xml ) :
  11204. matchAnyContext( elem, context, xml ) );
  11205. // Avoid hanging onto element (issue #299)
  11206. checkContext = null;
  11207. return ret;
  11208. } ];
  11209. for ( ; i < len; i++ ) {
  11210. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11211. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11212. } else {
  11213. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11214. // Return special upon seeing a positional matcher
  11215. if ( matcher[ expando ] ) {
  11216. // Find the next relative operator (if any) for proper handling
  11217. j = ++i;
  11218. for ( ; j < len; j++ ) {
  11219. if ( Expr.relative[ tokens[j].type ] ) {
  11220. break;
  11221. }
  11222. }
  11223. return setMatcher(
  11224. i > 1 && elementMatcher( matchers ),
  11225. i > 1 && toSelector(
  11226. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11227. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11228. ).replace( rtrim, "$1" ),
  11229. matcher,
  11230. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11231. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11232. j < len && toSelector( tokens )
  11233. );
  11234. }
  11235. matchers.push( matcher );
  11236. }
  11237. }
  11238. return elementMatcher( matchers );
  11239. }
  11240. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11241. var bySet = setMatchers.length > 0,
  11242. byElement = elementMatchers.length > 0,
  11243. superMatcher = function( seed, context, xml, results, outermost ) {
  11244. var elem, j, matcher,
  11245. matchedCount = 0,
  11246. i = "0",
  11247. unmatched = seed && [],
  11248. setMatched = [],
  11249. contextBackup = outermostContext,
  11250. // We must always have either seed elements or outermost context
  11251. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11252. // Use integer dirruns iff this is the outermost matcher
  11253. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11254. len = elems.length;
  11255. if ( outermost ) {
  11256. outermostContext = context === document || context || outermost;
  11257. }
  11258. // Add elements passing elementMatchers directly to results
  11259. // Support: IE<9, Safari
  11260. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11261. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11262. if ( byElement && elem ) {
  11263. j = 0;
  11264. if ( !context && elem.ownerDocument !== document ) {
  11265. setDocument( elem );
  11266. xml = !documentIsHTML;
  11267. }
  11268. while ( (matcher = elementMatchers[j++]) ) {
  11269. if ( matcher( elem, context || document, xml) ) {
  11270. results.push( elem );
  11271. break;
  11272. }
  11273. }
  11274. if ( outermost ) {
  11275. dirruns = dirrunsUnique;
  11276. }
  11277. }
  11278. // Track unmatched elements for set filters
  11279. if ( bySet ) {
  11280. // They will have gone through all possible matchers
  11281. if ( (elem = !matcher && elem) ) {
  11282. matchedCount--;
  11283. }
  11284. // Lengthen the array for every element, matched or not
  11285. if ( seed ) {
  11286. unmatched.push( elem );
  11287. }
  11288. }
  11289. }
  11290. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11291. // makes the latter nonnegative.
  11292. matchedCount += i;
  11293. // Apply set filters to unmatched elements
  11294. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11295. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11296. // no element matchers and no seed.
  11297. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11298. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11299. // numerically zero.
  11300. if ( bySet && i !== matchedCount ) {
  11301. j = 0;
  11302. while ( (matcher = setMatchers[j++]) ) {
  11303. matcher( unmatched, setMatched, context, xml );
  11304. }
  11305. if ( seed ) {
  11306. // Reintegrate element matches to eliminate the need for sorting
  11307. if ( matchedCount > 0 ) {
  11308. while ( i-- ) {
  11309. if ( !(unmatched[i] || setMatched[i]) ) {
  11310. setMatched[i] = pop.call( results );
  11311. }
  11312. }
  11313. }
  11314. // Discard index placeholder values to get only actual matches
  11315. setMatched = condense( setMatched );
  11316. }
  11317. // Add matches to results
  11318. push.apply( results, setMatched );
  11319. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11320. if ( outermost && !seed && setMatched.length > 0 &&
  11321. ( matchedCount + setMatchers.length ) > 1 ) {
  11322. Sizzle.uniqueSort( results );
  11323. }
  11324. }
  11325. // Override manipulation of globals by nested matchers
  11326. if ( outermost ) {
  11327. dirruns = dirrunsUnique;
  11328. outermostContext = contextBackup;
  11329. }
  11330. return unmatched;
  11331. };
  11332. return bySet ?
  11333. markFunction( superMatcher ) :
  11334. superMatcher;
  11335. }
  11336. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11337. var i,
  11338. setMatchers = [],
  11339. elementMatchers = [],
  11340. cached = compilerCache[ selector + " " ];
  11341. if ( !cached ) {
  11342. // Generate a function of recursive functions that can be used to check each element
  11343. if ( !match ) {
  11344. match = tokenize( selector );
  11345. }
  11346. i = match.length;
  11347. while ( i-- ) {
  11348. cached = matcherFromTokens( match[i] );
  11349. if ( cached[ expando ] ) {
  11350. setMatchers.push( cached );
  11351. } else {
  11352. elementMatchers.push( cached );
  11353. }
  11354. }
  11355. // Cache the compiled function
  11356. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11357. // Save selector and tokenization
  11358. cached.selector = selector;
  11359. }
  11360. return cached;
  11361. };
  11362. /**
  11363. * A low-level selection function that works with Sizzle's compiled
  11364. * selector functions
  11365. * @param {String|Function} selector A selector or a pre-compiled
  11366. * selector function built with Sizzle.compile
  11367. * @param {Element} context
  11368. * @param {Array} [results]
  11369. * @param {Array} [seed] A set of elements to match against
  11370. */
  11371. select = Sizzle.select = function( selector, context, results, seed ) {
  11372. var i, tokens, token, type, find,
  11373. compiled = typeof selector === "function" && selector,
  11374. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11375. results = results || [];
  11376. // Try to minimize operations if there is only one selector in the list and no seed
  11377. // (the latter of which guarantees us context)
  11378. if ( match.length === 1 ) {
  11379. // Reduce context if the leading compound selector is an ID
  11380. tokens = match[0] = match[0].slice( 0 );
  11381. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11382. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11383. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11384. if ( !context ) {
  11385. return results;
  11386. // Precompiled matchers will still verify ancestry, so step up a level
  11387. } else if ( compiled ) {
  11388. context = context.parentNode;
  11389. }
  11390. selector = selector.slice( tokens.shift().value.length );
  11391. }
  11392. // Fetch a seed set for right-to-left matching
  11393. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11394. while ( i-- ) {
  11395. token = tokens[i];
  11396. // Abort if we hit a combinator
  11397. if ( Expr.relative[ (type = token.type) ] ) {
  11398. break;
  11399. }
  11400. if ( (find = Expr.find[ type ]) ) {
  11401. // Search, expanding context for leading sibling combinators
  11402. if ( (seed = find(
  11403. token.matches[0].replace( runescape, funescape ),
  11404. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11405. )) ) {
  11406. // If seed is empty or no tokens remain, we can return early
  11407. tokens.splice( i, 1 );
  11408. selector = seed.length && toSelector( tokens );
  11409. if ( !selector ) {
  11410. push.apply( results, seed );
  11411. return results;
  11412. }
  11413. break;
  11414. }
  11415. }
  11416. }
  11417. }
  11418. // Compile and execute a filtering function if one is not provided
  11419. // Provide `match` to avoid retokenization if we modified the selector above
  11420. ( compiled || compile( selector, match ) )(
  11421. seed,
  11422. context,
  11423. !documentIsHTML,
  11424. results,
  11425. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11426. );
  11427. return results;
  11428. };
  11429. // One-time assignments
  11430. // Sort stability
  11431. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11432. // Support: Chrome 14-35+
  11433. // Always assume duplicates if they aren't passed to the comparison function
  11434. support.detectDuplicates = !!hasDuplicate;
  11435. // Initialize against the default document
  11436. setDocument();
  11437. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11438. // Detached nodes confoundingly follow *each other*
  11439. support.sortDetached = assert(function( el ) {
  11440. // Should return 1, but returns 4 (following)
  11441. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11442. });
  11443. // Support: IE<8
  11444. // Prevent attribute/property "interpolation"
  11445. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11446. if ( !assert(function( el ) {
  11447. el.innerHTML = "<a href='#'></a>";
  11448. return el.firstChild.getAttribute("href") === "#" ;
  11449. }) ) {
  11450. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11451. if ( !isXML ) {
  11452. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11453. }
  11454. });
  11455. }
  11456. // Support: IE<9
  11457. // Use defaultValue in place of getAttribute("value")
  11458. if ( !support.attributes || !assert(function( el ) {
  11459. el.innerHTML = "<input/>";
  11460. el.firstChild.setAttribute( "value", "" );
  11461. return el.firstChild.getAttribute( "value" ) === "";
  11462. }) ) {
  11463. addHandle( "value", function( elem, name, isXML ) {
  11464. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11465. return elem.defaultValue;
  11466. }
  11467. });
  11468. }
  11469. // Support: IE<9
  11470. // Use getAttributeNode to fetch booleans when getAttribute lies
  11471. if ( !assert(function( el ) {
  11472. return el.getAttribute("disabled") == null;
  11473. }) ) {
  11474. addHandle( booleans, function( elem, name, isXML ) {
  11475. var val;
  11476. if ( !isXML ) {
  11477. return elem[ name ] === true ? name.toLowerCase() :
  11478. (val = elem.getAttributeNode( name )) && val.specified ?
  11479. val.value :
  11480. null;
  11481. }
  11482. });
  11483. }
  11484. return Sizzle;
  11485. })( window );
  11486. jQuery.find = Sizzle;
  11487. jQuery.expr = Sizzle.selectors;
  11488. // Deprecated
  11489. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11490. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11491. jQuery.text = Sizzle.getText;
  11492. jQuery.isXMLDoc = Sizzle.isXML;
  11493. jQuery.contains = Sizzle.contains;
  11494. jQuery.escapeSelector = Sizzle.escape;
  11495. var dir = function( elem, dir, until ) {
  11496. var matched = [],
  11497. truncate = until !== undefined;
  11498. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11499. if ( elem.nodeType === 1 ) {
  11500. if ( truncate && jQuery( elem ).is( until ) ) {
  11501. break;
  11502. }
  11503. matched.push( elem );
  11504. }
  11505. }
  11506. return matched;
  11507. };
  11508. var siblings = function( n, elem ) {
  11509. var matched = [];
  11510. for ( ; n; n = n.nextSibling ) {
  11511. if ( n.nodeType === 1 && n !== elem ) {
  11512. matched.push( n );
  11513. }
  11514. }
  11515. return matched;
  11516. };
  11517. var rneedsContext = jQuery.expr.match.needsContext;
  11518. function nodeName( elem, name ) {
  11519. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11520. };
  11521. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11522. // Implement the identical functionality for filter and not
  11523. function winnow( elements, qualifier, not ) {
  11524. if ( isFunction( qualifier ) ) {
  11525. return jQuery.grep( elements, function( elem, i ) {
  11526. return !!qualifier.call( elem, i, elem ) !== not;
  11527. } );
  11528. }
  11529. // Single element
  11530. if ( qualifier.nodeType ) {
  11531. return jQuery.grep( elements, function( elem ) {
  11532. return ( elem === qualifier ) !== not;
  11533. } );
  11534. }
  11535. // Arraylike of elements (jQuery, arguments, Array)
  11536. if ( typeof qualifier !== "string" ) {
  11537. return jQuery.grep( elements, function( elem ) {
  11538. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11539. } );
  11540. }
  11541. // Filtered directly for both simple and complex selectors
  11542. return jQuery.filter( qualifier, elements, not );
  11543. }
  11544. jQuery.filter = function( expr, elems, not ) {
  11545. var elem = elems[ 0 ];
  11546. if ( not ) {
  11547. expr = ":not(" + expr + ")";
  11548. }
  11549. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11550. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11551. }
  11552. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11553. return elem.nodeType === 1;
  11554. } ) );
  11555. };
  11556. jQuery.fn.extend( {
  11557. find: function( selector ) {
  11558. var i, ret,
  11559. len = this.length,
  11560. self = this;
  11561. if ( typeof selector !== "string" ) {
  11562. return this.pushStack( jQuery( selector ).filter( function() {
  11563. for ( i = 0; i < len; i++ ) {
  11564. if ( jQuery.contains( self[ i ], this ) ) {
  11565. return true;
  11566. }
  11567. }
  11568. } ) );
  11569. }
  11570. ret = this.pushStack( [] );
  11571. for ( i = 0; i < len; i++ ) {
  11572. jQuery.find( selector, self[ i ], ret );
  11573. }
  11574. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11575. },
  11576. filter: function( selector ) {
  11577. return this.pushStack( winnow( this, selector || [], false ) );
  11578. },
  11579. not: function( selector ) {
  11580. return this.pushStack( winnow( this, selector || [], true ) );
  11581. },
  11582. is: function( selector ) {
  11583. return !!winnow(
  11584. this,
  11585. // If this is a positional/relative selector, check membership in the returned set
  11586. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11587. typeof selector === "string" && rneedsContext.test( selector ) ?
  11588. jQuery( selector ) :
  11589. selector || [],
  11590. false
  11591. ).length;
  11592. }
  11593. } );
  11594. // Initialize a jQuery object
  11595. // A central reference to the root jQuery(document)
  11596. var rootjQuery,
  11597. // A simple way to check for HTML strings
  11598. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11599. // Strict HTML recognition (#11290: must start with <)
  11600. // Shortcut simple #id case for speed
  11601. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11602. init = jQuery.fn.init = function( selector, context, root ) {
  11603. var match, elem;
  11604. // HANDLE: $(""), $(null), $(undefined), $(false)
  11605. if ( !selector ) {
  11606. return this;
  11607. }
  11608. // Method init() accepts an alternate rootjQuery
  11609. // so migrate can support jQuery.sub (gh-2101)
  11610. root = root || rootjQuery;
  11611. // Handle HTML strings
  11612. if ( typeof selector === "string" ) {
  11613. if ( selector[ 0 ] === "<" &&
  11614. selector[ selector.length - 1 ] === ">" &&
  11615. selector.length >= 3 ) {
  11616. // Assume that strings that start and end with <> are HTML and skip the regex check
  11617. match = [ null, selector, null ];
  11618. } else {
  11619. match = rquickExpr.exec( selector );
  11620. }
  11621. // Match html or make sure no context is specified for #id
  11622. if ( match && ( match[ 1 ] || !context ) ) {
  11623. // HANDLE: $(html) -> $(array)
  11624. if ( match[ 1 ] ) {
  11625. context = context instanceof jQuery ? context[ 0 ] : context;
  11626. // Option to run scripts is true for back-compat
  11627. // Intentionally let the error be thrown if parseHTML is not present
  11628. jQuery.merge( this, jQuery.parseHTML(
  11629. match[ 1 ],
  11630. context && context.nodeType ? context.ownerDocument || context : document,
  11631. true
  11632. ) );
  11633. // HANDLE: $(html, props)
  11634. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11635. for ( match in context ) {
  11636. // Properties of context are called as methods if possible
  11637. if ( isFunction( this[ match ] ) ) {
  11638. this[ match ]( context[ match ] );
  11639. // ...and otherwise set as attributes
  11640. } else {
  11641. this.attr( match, context[ match ] );
  11642. }
  11643. }
  11644. }
  11645. return this;
  11646. // HANDLE: $(#id)
  11647. } else {
  11648. elem = document.getElementById( match[ 2 ] );
  11649. if ( elem ) {
  11650. // Inject the element directly into the jQuery object
  11651. this[ 0 ] = elem;
  11652. this.length = 1;
  11653. }
  11654. return this;
  11655. }
  11656. // HANDLE: $(expr, $(...))
  11657. } else if ( !context || context.jquery ) {
  11658. return ( context || root ).find( selector );
  11659. // HANDLE: $(expr, context)
  11660. // (which is just equivalent to: $(context).find(expr)
  11661. } else {
  11662. return this.constructor( context ).find( selector );
  11663. }
  11664. // HANDLE: $(DOMElement)
  11665. } else if ( selector.nodeType ) {
  11666. this[ 0 ] = selector;
  11667. this.length = 1;
  11668. return this;
  11669. // HANDLE: $(function)
  11670. // Shortcut for document ready
  11671. } else if ( isFunction( selector ) ) {
  11672. return root.ready !== undefined ?
  11673. root.ready( selector ) :
  11674. // Execute immediately if ready is not present
  11675. selector( jQuery );
  11676. }
  11677. return jQuery.makeArray( selector, this );
  11678. };
  11679. // Give the init function the jQuery prototype for later instantiation
  11680. init.prototype = jQuery.fn;
  11681. // Initialize central reference
  11682. rootjQuery = jQuery( document );
  11683. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11684. // Methods guaranteed to produce a unique set when starting from a unique set
  11685. guaranteedUnique = {
  11686. children: true,
  11687. contents: true,
  11688. next: true,
  11689. prev: true
  11690. };
  11691. jQuery.fn.extend( {
  11692. has: function( target ) {
  11693. var targets = jQuery( target, this ),
  11694. l = targets.length;
  11695. return this.filter( function() {
  11696. var i = 0;
  11697. for ( ; i < l; i++ ) {
  11698. if ( jQuery.contains( this, targets[ i ] ) ) {
  11699. return true;
  11700. }
  11701. }
  11702. } );
  11703. },
  11704. closest: function( selectors, context ) {
  11705. var cur,
  11706. i = 0,
  11707. l = this.length,
  11708. matched = [],
  11709. targets = typeof selectors !== "string" && jQuery( selectors );
  11710. // Positional selectors never match, since there's no _selection_ context
  11711. if ( !rneedsContext.test( selectors ) ) {
  11712. for ( ; i < l; i++ ) {
  11713. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11714. // Always skip document fragments
  11715. if ( cur.nodeType < 11 && ( targets ?
  11716. targets.index( cur ) > -1 :
  11717. // Don't pass non-elements to Sizzle
  11718. cur.nodeType === 1 &&
  11719. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11720. matched.push( cur );
  11721. break;
  11722. }
  11723. }
  11724. }
  11725. }
  11726. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11727. },
  11728. // Determine the position of an element within the set
  11729. index: function( elem ) {
  11730. // No argument, return index in parent
  11731. if ( !elem ) {
  11732. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11733. }
  11734. // Index in selector
  11735. if ( typeof elem === "string" ) {
  11736. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11737. }
  11738. // Locate the position of the desired element
  11739. return indexOf.call( this,
  11740. // If it receives a jQuery object, the first element is used
  11741. elem.jquery ? elem[ 0 ] : elem
  11742. );
  11743. },
  11744. add: function( selector, context ) {
  11745. return this.pushStack(
  11746. jQuery.uniqueSort(
  11747. jQuery.merge( this.get(), jQuery( selector, context ) )
  11748. )
  11749. );
  11750. },
  11751. addBack: function( selector ) {
  11752. return this.add( selector == null ?
  11753. this.prevObject : this.prevObject.filter( selector )
  11754. );
  11755. }
  11756. } );
  11757. function sibling( cur, dir ) {
  11758. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11759. return cur;
  11760. }
  11761. jQuery.each( {
  11762. parent: function( elem ) {
  11763. var parent = elem.parentNode;
  11764. return parent && parent.nodeType !== 11 ? parent : null;
  11765. },
  11766. parents: function( elem ) {
  11767. return dir( elem, "parentNode" );
  11768. },
  11769. parentsUntil: function( elem, i, until ) {
  11770. return dir( elem, "parentNode", until );
  11771. },
  11772. next: function( elem ) {
  11773. return sibling( elem, "nextSibling" );
  11774. },
  11775. prev: function( elem ) {
  11776. return sibling( elem, "previousSibling" );
  11777. },
  11778. nextAll: function( elem ) {
  11779. return dir( elem, "nextSibling" );
  11780. },
  11781. prevAll: function( elem ) {
  11782. return dir( elem, "previousSibling" );
  11783. },
  11784. nextUntil: function( elem, i, until ) {
  11785. return dir( elem, "nextSibling", until );
  11786. },
  11787. prevUntil: function( elem, i, until ) {
  11788. return dir( elem, "previousSibling", until );
  11789. },
  11790. siblings: function( elem ) {
  11791. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11792. },
  11793. children: function( elem ) {
  11794. return siblings( elem.firstChild );
  11795. },
  11796. contents: function( elem ) {
  11797. if ( typeof elem.contentDocument !== "undefined" ) {
  11798. return elem.contentDocument;
  11799. }
  11800. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11801. // Treat the template element as a regular one in browsers that
  11802. // don't support it.
  11803. if ( nodeName( elem, "template" ) ) {
  11804. elem = elem.content || elem;
  11805. }
  11806. return jQuery.merge( [], elem.childNodes );
  11807. }
  11808. }, function( name, fn ) {
  11809. jQuery.fn[ name ] = function( until, selector ) {
  11810. var matched = jQuery.map( this, fn, until );
  11811. if ( name.slice( -5 ) !== "Until" ) {
  11812. selector = until;
  11813. }
  11814. if ( selector && typeof selector === "string" ) {
  11815. matched = jQuery.filter( selector, matched );
  11816. }
  11817. if ( this.length > 1 ) {
  11818. // Remove duplicates
  11819. if ( !guaranteedUnique[ name ] ) {
  11820. jQuery.uniqueSort( matched );
  11821. }
  11822. // Reverse order for parents* and prev-derivatives
  11823. if ( rparentsprev.test( name ) ) {
  11824. matched.reverse();
  11825. }
  11826. }
  11827. return this.pushStack( matched );
  11828. };
  11829. } );
  11830. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11831. // Convert String-formatted options into Object-formatted ones
  11832. function createOptions( options ) {
  11833. var object = {};
  11834. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11835. object[ flag ] = true;
  11836. } );
  11837. return object;
  11838. }
  11839. /*
  11840. * Create a callback list using the following parameters:
  11841. *
  11842. * options: an optional list of space-separated options that will change how
  11843. * the callback list behaves or a more traditional option object
  11844. *
  11845. * By default a callback list will act like an event callback list and can be
  11846. * "fired" multiple times.
  11847. *
  11848. * Possible options:
  11849. *
  11850. * once: will ensure the callback list can only be fired once (like a Deferred)
  11851. *
  11852. * memory: will keep track of previous values and will call any callback added
  11853. * after the list has been fired right away with the latest "memorized"
  11854. * values (like a Deferred)
  11855. *
  11856. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11857. *
  11858. * stopOnFalse: interrupt callings when a callback returns false
  11859. *
  11860. */
  11861. jQuery.Callbacks = function( options ) {
  11862. // Convert options from String-formatted to Object-formatted if needed
  11863. // (we check in cache first)
  11864. options = typeof options === "string" ?
  11865. createOptions( options ) :
  11866. jQuery.extend( {}, options );
  11867. var // Flag to know if list is currently firing
  11868. firing,
  11869. // Last fire value for non-forgettable lists
  11870. memory,
  11871. // Flag to know if list was already fired
  11872. fired,
  11873. // Flag to prevent firing
  11874. locked,
  11875. // Actual callback list
  11876. list = [],
  11877. // Queue of execution data for repeatable lists
  11878. queue = [],
  11879. // Index of currently firing callback (modified by add/remove as needed)
  11880. firingIndex = -1,
  11881. // Fire callbacks
  11882. fire = function() {
  11883. // Enforce single-firing
  11884. locked = locked || options.once;
  11885. // Execute callbacks for all pending executions,
  11886. // respecting firingIndex overrides and runtime changes
  11887. fired = firing = true;
  11888. for ( ; queue.length; firingIndex = -1 ) {
  11889. memory = queue.shift();
  11890. while ( ++firingIndex < list.length ) {
  11891. // Run callback and check for early termination
  11892. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11893. options.stopOnFalse ) {
  11894. // Jump to end and forget the data so .add doesn't re-fire
  11895. firingIndex = list.length;
  11896. memory = false;
  11897. }
  11898. }
  11899. }
  11900. // Forget the data if we're done with it
  11901. if ( !options.memory ) {
  11902. memory = false;
  11903. }
  11904. firing = false;
  11905. // Clean up if we're done firing for good
  11906. if ( locked ) {
  11907. // Keep an empty list if we have data for future add calls
  11908. if ( memory ) {
  11909. list = [];
  11910. // Otherwise, this object is spent
  11911. } else {
  11912. list = "";
  11913. }
  11914. }
  11915. },
  11916. // Actual Callbacks object
  11917. self = {
  11918. // Add a callback or a collection of callbacks to the list
  11919. add: function() {
  11920. if ( list ) {
  11921. // If we have memory from a past run, we should fire after adding
  11922. if ( memory && !firing ) {
  11923. firingIndex = list.length - 1;
  11924. queue.push( memory );
  11925. }
  11926. ( function add( args ) {
  11927. jQuery.each( args, function( _, arg ) {
  11928. if ( isFunction( arg ) ) {
  11929. if ( !options.unique || !self.has( arg ) ) {
  11930. list.push( arg );
  11931. }
  11932. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11933. // Inspect recursively
  11934. add( arg );
  11935. }
  11936. } );
  11937. } )( arguments );
  11938. if ( memory && !firing ) {
  11939. fire();
  11940. }
  11941. }
  11942. return this;
  11943. },
  11944. // Remove a callback from the list
  11945. remove: function() {
  11946. jQuery.each( arguments, function( _, arg ) {
  11947. var index;
  11948. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11949. list.splice( index, 1 );
  11950. // Handle firing indexes
  11951. if ( index <= firingIndex ) {
  11952. firingIndex--;
  11953. }
  11954. }
  11955. } );
  11956. return this;
  11957. },
  11958. // Check if a given callback is in the list.
  11959. // If no argument is given, return whether or not list has callbacks attached.
  11960. has: function( fn ) {
  11961. return fn ?
  11962. jQuery.inArray( fn, list ) > -1 :
  11963. list.length > 0;
  11964. },
  11965. // Remove all callbacks from the list
  11966. empty: function() {
  11967. if ( list ) {
  11968. list = [];
  11969. }
  11970. return this;
  11971. },
  11972. // Disable .fire and .add
  11973. // Abort any current/pending executions
  11974. // Clear all callbacks and values
  11975. disable: function() {
  11976. locked = queue = [];
  11977. list = memory = "";
  11978. return this;
  11979. },
  11980. disabled: function() {
  11981. return !list;
  11982. },
  11983. // Disable .fire
  11984. // Also disable .add unless we have memory (since it would have no effect)
  11985. // Abort any pending executions
  11986. lock: function() {
  11987. locked = queue = [];
  11988. if ( !memory && !firing ) {
  11989. list = memory = "";
  11990. }
  11991. return this;
  11992. },
  11993. locked: function() {
  11994. return !!locked;
  11995. },
  11996. // Call all callbacks with the given context and arguments
  11997. fireWith: function( context, args ) {
  11998. if ( !locked ) {
  11999. args = args || [];
  12000. args = [ context, args.slice ? args.slice() : args ];
  12001. queue.push( args );
  12002. if ( !firing ) {
  12003. fire();
  12004. }
  12005. }
  12006. return this;
  12007. },
  12008. // Call all the callbacks with the given arguments
  12009. fire: function() {
  12010. self.fireWith( this, arguments );
  12011. return this;
  12012. },
  12013. // To know if the callbacks have already been called at least once
  12014. fired: function() {
  12015. return !!fired;
  12016. }
  12017. };
  12018. return self;
  12019. };
  12020. function Identity( v ) {
  12021. return v;
  12022. }
  12023. function Thrower( ex ) {
  12024. throw ex;
  12025. }
  12026. function adoptValue( value, resolve, reject, noValue ) {
  12027. var method;
  12028. try {
  12029. // Check for promise aspect first to privilege synchronous behavior
  12030. if ( value && isFunction( ( method = value.promise ) ) ) {
  12031. method.call( value ).done( resolve ).fail( reject );
  12032. // Other thenables
  12033. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12034. method.call( value, resolve, reject );
  12035. // Other non-thenables
  12036. } else {
  12037. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12038. // * false: [ value ].slice( 0 ) => resolve( value )
  12039. // * true: [ value ].slice( 1 ) => resolve()
  12040. resolve.apply( undefined, [ value ].slice( noValue ) );
  12041. }
  12042. // For Promises/A+, convert exceptions into rejections
  12043. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12044. // Deferred#then to conditionally suppress rejection.
  12045. } catch ( value ) {
  12046. // Support: Android 4.0 only
  12047. // Strict mode functions invoked without .call/.apply get global-object context
  12048. reject.apply( undefined, [ value ] );
  12049. }
  12050. }
  12051. jQuery.extend( {
  12052. Deferred: function( func ) {
  12053. var tuples = [
  12054. // action, add listener, callbacks,
  12055. // ... .then handlers, argument index, [final state]
  12056. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12057. jQuery.Callbacks( "memory" ), 2 ],
  12058. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12059. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12060. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12061. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12062. ],
  12063. state = "pending",
  12064. promise = {
  12065. state: function() {
  12066. return state;
  12067. },
  12068. always: function() {
  12069. deferred.done( arguments ).fail( arguments );
  12070. return this;
  12071. },
  12072. "catch": function( fn ) {
  12073. return promise.then( null, fn );
  12074. },
  12075. // Keep pipe for back-compat
  12076. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12077. var fns = arguments;
  12078. return jQuery.Deferred( function( newDefer ) {
  12079. jQuery.each( tuples, function( i, tuple ) {
  12080. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12081. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12082. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12083. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12084. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12085. deferred[ tuple[ 1 ] ]( function() {
  12086. var returned = fn && fn.apply( this, arguments );
  12087. if ( returned && isFunction( returned.promise ) ) {
  12088. returned.promise()
  12089. .progress( newDefer.notify )
  12090. .done( newDefer.resolve )
  12091. .fail( newDefer.reject );
  12092. } else {
  12093. newDefer[ tuple[ 0 ] + "With" ](
  12094. this,
  12095. fn ? [ returned ] : arguments
  12096. );
  12097. }
  12098. } );
  12099. } );
  12100. fns = null;
  12101. } ).promise();
  12102. },
  12103. then: function( onFulfilled, onRejected, onProgress ) {
  12104. var maxDepth = 0;
  12105. function resolve( depth, deferred, handler, special ) {
  12106. return function() {
  12107. var that = this,
  12108. args = arguments,
  12109. mightThrow = function() {
  12110. var returned, then;
  12111. // Support: Promises/A+ section 2.3.3.3.3
  12112. // https://promisesaplus.com/#point-59
  12113. // Ignore double-resolution attempts
  12114. if ( depth < maxDepth ) {
  12115. return;
  12116. }
  12117. returned = handler.apply( that, args );
  12118. // Support: Promises/A+ section 2.3.1
  12119. // https://promisesaplus.com/#point-48
  12120. if ( returned === deferred.promise() ) {
  12121. throw new TypeError( "Thenable self-resolution" );
  12122. }
  12123. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12124. // https://promisesaplus.com/#point-54
  12125. // https://promisesaplus.com/#point-75
  12126. // Retrieve `then` only once
  12127. then = returned &&
  12128. // Support: Promises/A+ section 2.3.4
  12129. // https://promisesaplus.com/#point-64
  12130. // Only check objects and functions for thenability
  12131. ( typeof returned === "object" ||
  12132. typeof returned === "function" ) &&
  12133. returned.then;
  12134. // Handle a returned thenable
  12135. if ( isFunction( then ) ) {
  12136. // Special processors (notify) just wait for resolution
  12137. if ( special ) {
  12138. then.call(
  12139. returned,
  12140. resolve( maxDepth, deferred, Identity, special ),
  12141. resolve( maxDepth, deferred, Thrower, special )
  12142. );
  12143. // Normal processors (resolve) also hook into progress
  12144. } else {
  12145. // ...and disregard older resolution values
  12146. maxDepth++;
  12147. then.call(
  12148. returned,
  12149. resolve( maxDepth, deferred, Identity, special ),
  12150. resolve( maxDepth, deferred, Thrower, special ),
  12151. resolve( maxDepth, deferred, Identity,
  12152. deferred.notifyWith )
  12153. );
  12154. }
  12155. // Handle all other returned values
  12156. } else {
  12157. // Only substitute handlers pass on context
  12158. // and multiple values (non-spec behavior)
  12159. if ( handler !== Identity ) {
  12160. that = undefined;
  12161. args = [ returned ];
  12162. }
  12163. // Process the value(s)
  12164. // Default process is resolve
  12165. ( special || deferred.resolveWith )( that, args );
  12166. }
  12167. },
  12168. // Only normal processors (resolve) catch and reject exceptions
  12169. process = special ?
  12170. mightThrow :
  12171. function() {
  12172. try {
  12173. mightThrow();
  12174. } catch ( e ) {
  12175. if ( jQuery.Deferred.exceptionHook ) {
  12176. jQuery.Deferred.exceptionHook( e,
  12177. process.stackTrace );
  12178. }
  12179. // Support: Promises/A+ section 2.3.3.3.4.1
  12180. // https://promisesaplus.com/#point-61
  12181. // Ignore post-resolution exceptions
  12182. if ( depth + 1 >= maxDepth ) {
  12183. // Only substitute handlers pass on context
  12184. // and multiple values (non-spec behavior)
  12185. if ( handler !== Thrower ) {
  12186. that = undefined;
  12187. args = [ e ];
  12188. }
  12189. deferred.rejectWith( that, args );
  12190. }
  12191. }
  12192. };
  12193. // Support: Promises/A+ section 2.3.3.3.1
  12194. // https://promisesaplus.com/#point-57
  12195. // Re-resolve promises immediately to dodge false rejection from
  12196. // subsequent errors
  12197. if ( depth ) {
  12198. process();
  12199. } else {
  12200. // Call an optional hook to record the stack, in case of exception
  12201. // since it's otherwise lost when execution goes async
  12202. if ( jQuery.Deferred.getStackHook ) {
  12203. process.stackTrace = jQuery.Deferred.getStackHook();
  12204. }
  12205. window.setTimeout( process );
  12206. }
  12207. };
  12208. }
  12209. return jQuery.Deferred( function( newDefer ) {
  12210. // progress_handlers.add( ... )
  12211. tuples[ 0 ][ 3 ].add(
  12212. resolve(
  12213. 0,
  12214. newDefer,
  12215. isFunction( onProgress ) ?
  12216. onProgress :
  12217. Identity,
  12218. newDefer.notifyWith
  12219. )
  12220. );
  12221. // fulfilled_handlers.add( ... )
  12222. tuples[ 1 ][ 3 ].add(
  12223. resolve(
  12224. 0,
  12225. newDefer,
  12226. isFunction( onFulfilled ) ?
  12227. onFulfilled :
  12228. Identity
  12229. )
  12230. );
  12231. // rejected_handlers.add( ... )
  12232. tuples[ 2 ][ 3 ].add(
  12233. resolve(
  12234. 0,
  12235. newDefer,
  12236. isFunction( onRejected ) ?
  12237. onRejected :
  12238. Thrower
  12239. )
  12240. );
  12241. } ).promise();
  12242. },
  12243. // Get a promise for this deferred
  12244. // If obj is provided, the promise aspect is added to the object
  12245. promise: function( obj ) {
  12246. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12247. }
  12248. },
  12249. deferred = {};
  12250. // Add list-specific methods
  12251. jQuery.each( tuples, function( i, tuple ) {
  12252. var list = tuple[ 2 ],
  12253. stateString = tuple[ 5 ];
  12254. // promise.progress = list.add
  12255. // promise.done = list.add
  12256. // promise.fail = list.add
  12257. promise[ tuple[ 1 ] ] = list.add;
  12258. // Handle state
  12259. if ( stateString ) {
  12260. list.add(
  12261. function() {
  12262. // state = "resolved" (i.e., fulfilled)
  12263. // state = "rejected"
  12264. state = stateString;
  12265. },
  12266. // rejected_callbacks.disable
  12267. // fulfilled_callbacks.disable
  12268. tuples[ 3 - i ][ 2 ].disable,
  12269. // rejected_handlers.disable
  12270. // fulfilled_handlers.disable
  12271. tuples[ 3 - i ][ 3 ].disable,
  12272. // progress_callbacks.lock
  12273. tuples[ 0 ][ 2 ].lock,
  12274. // progress_handlers.lock
  12275. tuples[ 0 ][ 3 ].lock
  12276. );
  12277. }
  12278. // progress_handlers.fire
  12279. // fulfilled_handlers.fire
  12280. // rejected_handlers.fire
  12281. list.add( tuple[ 3 ].fire );
  12282. // deferred.notify = function() { deferred.notifyWith(...) }
  12283. // deferred.resolve = function() { deferred.resolveWith(...) }
  12284. // deferred.reject = function() { deferred.rejectWith(...) }
  12285. deferred[ tuple[ 0 ] ] = function() {
  12286. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12287. return this;
  12288. };
  12289. // deferred.notifyWith = list.fireWith
  12290. // deferred.resolveWith = list.fireWith
  12291. // deferred.rejectWith = list.fireWith
  12292. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12293. } );
  12294. // Make the deferred a promise
  12295. promise.promise( deferred );
  12296. // Call given func if any
  12297. if ( func ) {
  12298. func.call( deferred, deferred );
  12299. }
  12300. // All done!
  12301. return deferred;
  12302. },
  12303. // Deferred helper
  12304. when: function( singleValue ) {
  12305. var
  12306. // count of uncompleted subordinates
  12307. remaining = arguments.length,
  12308. // count of unprocessed arguments
  12309. i = remaining,
  12310. // subordinate fulfillment data
  12311. resolveContexts = Array( i ),
  12312. resolveValues = slice.call( arguments ),
  12313. // the master Deferred
  12314. master = jQuery.Deferred(),
  12315. // subordinate callback factory
  12316. updateFunc = function( i ) {
  12317. return function( value ) {
  12318. resolveContexts[ i ] = this;
  12319. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12320. if ( !( --remaining ) ) {
  12321. master.resolveWith( resolveContexts, resolveValues );
  12322. }
  12323. };
  12324. };
  12325. // Single- and empty arguments are adopted like Promise.resolve
  12326. if ( remaining <= 1 ) {
  12327. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12328. !remaining );
  12329. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12330. if ( master.state() === "pending" ||
  12331. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12332. return master.then();
  12333. }
  12334. }
  12335. // Multiple arguments are aggregated like Promise.all array elements
  12336. while ( i-- ) {
  12337. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12338. }
  12339. return master.promise();
  12340. }
  12341. } );
  12342. // These usually indicate a programmer mistake during development,
  12343. // warn about them ASAP rather than swallowing them by default.
  12344. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12345. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12346. // Support: IE 8 - 9 only
  12347. // Console exists when dev tools are open, which can happen at any time
  12348. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12349. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12350. }
  12351. };
  12352. jQuery.readyException = function( error ) {
  12353. window.setTimeout( function() {
  12354. throw error;
  12355. } );
  12356. };
  12357. // The deferred used on DOM ready
  12358. var readyList = jQuery.Deferred();
  12359. jQuery.fn.ready = function( fn ) {
  12360. readyList
  12361. .then( fn )
  12362. // Wrap jQuery.readyException in a function so that the lookup
  12363. // happens at the time of error handling instead of callback
  12364. // registration.
  12365. .catch( function( error ) {
  12366. jQuery.readyException( error );
  12367. } );
  12368. return this;
  12369. };
  12370. jQuery.extend( {
  12371. // Is the DOM ready to be used? Set to true once it occurs.
  12372. isReady: false,
  12373. // A counter to track how many items to wait for before
  12374. // the ready event fires. See #6781
  12375. readyWait: 1,
  12376. // Handle when the DOM is ready
  12377. ready: function( wait ) {
  12378. // Abort if there are pending holds or we're already ready
  12379. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12380. return;
  12381. }
  12382. // Remember that the DOM is ready
  12383. jQuery.isReady = true;
  12384. // If a normal DOM Ready event fired, decrement, and wait if need be
  12385. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12386. return;
  12387. }
  12388. // If there are functions bound, to execute
  12389. readyList.resolveWith( document, [ jQuery ] );
  12390. }
  12391. } );
  12392. jQuery.ready.then = readyList.then;
  12393. // The ready event handler and self cleanup method
  12394. function completed() {
  12395. document.removeEventListener( "DOMContentLoaded", completed );
  12396. window.removeEventListener( "load", completed );
  12397. jQuery.ready();
  12398. }
  12399. // Catch cases where $(document).ready() is called
  12400. // after the browser event has already occurred.
  12401. // Support: IE <=9 - 10 only
  12402. // Older IE sometimes signals "interactive" too soon
  12403. if ( document.readyState === "complete" ||
  12404. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12405. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12406. window.setTimeout( jQuery.ready );
  12407. } else {
  12408. // Use the handy event callback
  12409. document.addEventListener( "DOMContentLoaded", completed );
  12410. // A fallback to window.onload, that will always work
  12411. window.addEventListener( "load", completed );
  12412. }
  12413. // Multifunctional method to get and set values of a collection
  12414. // The value/s can optionally be executed if it's a function
  12415. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12416. var i = 0,
  12417. len = elems.length,
  12418. bulk = key == null;
  12419. // Sets many values
  12420. if ( toType( key ) === "object" ) {
  12421. chainable = true;
  12422. for ( i in key ) {
  12423. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12424. }
  12425. // Sets one value
  12426. } else if ( value !== undefined ) {
  12427. chainable = true;
  12428. if ( !isFunction( value ) ) {
  12429. raw = true;
  12430. }
  12431. if ( bulk ) {
  12432. // Bulk operations run against the entire set
  12433. if ( raw ) {
  12434. fn.call( elems, value );
  12435. fn = null;
  12436. // ...except when executing function values
  12437. } else {
  12438. bulk = fn;
  12439. fn = function( elem, key, value ) {
  12440. return bulk.call( jQuery( elem ), value );
  12441. };
  12442. }
  12443. }
  12444. if ( fn ) {
  12445. for ( ; i < len; i++ ) {
  12446. fn(
  12447. elems[ i ], key, raw ?
  12448. value :
  12449. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12450. );
  12451. }
  12452. }
  12453. }
  12454. if ( chainable ) {
  12455. return elems;
  12456. }
  12457. // Gets
  12458. if ( bulk ) {
  12459. return fn.call( elems );
  12460. }
  12461. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12462. };
  12463. // Matches dashed string for camelizing
  12464. var rmsPrefix = /^-ms-/,
  12465. rdashAlpha = /-([a-z])/g;
  12466. // Used by camelCase as callback to replace()
  12467. function fcamelCase( all, letter ) {
  12468. return letter.toUpperCase();
  12469. }
  12470. // Convert dashed to camelCase; used by the css and data modules
  12471. // Support: IE <=9 - 11, Edge 12 - 15
  12472. // Microsoft forgot to hump their vendor prefix (#9572)
  12473. function camelCase( string ) {
  12474. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12475. }
  12476. var acceptData = function( owner ) {
  12477. // Accepts only:
  12478. // - Node
  12479. // - Node.ELEMENT_NODE
  12480. // - Node.DOCUMENT_NODE
  12481. // - Object
  12482. // - Any
  12483. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12484. };
  12485. function Data() {
  12486. this.expando = jQuery.expando + Data.uid++;
  12487. }
  12488. Data.uid = 1;
  12489. Data.prototype = {
  12490. cache: function( owner ) {
  12491. // Check if the owner object already has a cache
  12492. var value = owner[ this.expando ];
  12493. // If not, create one
  12494. if ( !value ) {
  12495. value = {};
  12496. // We can accept data for non-element nodes in modern browsers,
  12497. // but we should not, see #8335.
  12498. // Always return an empty object.
  12499. if ( acceptData( owner ) ) {
  12500. // If it is a node unlikely to be stringify-ed or looped over
  12501. // use plain assignment
  12502. if ( owner.nodeType ) {
  12503. owner[ this.expando ] = value;
  12504. // Otherwise secure it in a non-enumerable property
  12505. // configurable must be true to allow the property to be
  12506. // deleted when data is removed
  12507. } else {
  12508. Object.defineProperty( owner, this.expando, {
  12509. value: value,
  12510. configurable: true
  12511. } );
  12512. }
  12513. }
  12514. }
  12515. return value;
  12516. },
  12517. set: function( owner, data, value ) {
  12518. var prop,
  12519. cache = this.cache( owner );
  12520. // Handle: [ owner, key, value ] args
  12521. // Always use camelCase key (gh-2257)
  12522. if ( typeof data === "string" ) {
  12523. cache[ camelCase( data ) ] = value;
  12524. // Handle: [ owner, { properties } ] args
  12525. } else {
  12526. // Copy the properties one-by-one to the cache object
  12527. for ( prop in data ) {
  12528. cache[ camelCase( prop ) ] = data[ prop ];
  12529. }
  12530. }
  12531. return cache;
  12532. },
  12533. get: function( owner, key ) {
  12534. return key === undefined ?
  12535. this.cache( owner ) :
  12536. // Always use camelCase key (gh-2257)
  12537. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12538. },
  12539. access: function( owner, key, value ) {
  12540. // In cases where either:
  12541. //
  12542. // 1. No key was specified
  12543. // 2. A string key was specified, but no value provided
  12544. //
  12545. // Take the "read" path and allow the get method to determine
  12546. // which value to return, respectively either:
  12547. //
  12548. // 1. The entire cache object
  12549. // 2. The data stored at the key
  12550. //
  12551. if ( key === undefined ||
  12552. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12553. return this.get( owner, key );
  12554. }
  12555. // When the key is not a string, or both a key and value
  12556. // are specified, set or extend (existing objects) with either:
  12557. //
  12558. // 1. An object of properties
  12559. // 2. A key and value
  12560. //
  12561. this.set( owner, key, value );
  12562. // Since the "set" path can have two possible entry points
  12563. // return the expected data based on which path was taken[*]
  12564. return value !== undefined ? value : key;
  12565. },
  12566. remove: function( owner, key ) {
  12567. var i,
  12568. cache = owner[ this.expando ];
  12569. if ( cache === undefined ) {
  12570. return;
  12571. }
  12572. if ( key !== undefined ) {
  12573. // Support array or space separated string of keys
  12574. if ( Array.isArray( key ) ) {
  12575. // If key is an array of keys...
  12576. // We always set camelCase keys, so remove that.
  12577. key = key.map( camelCase );
  12578. } else {
  12579. key = camelCase( key );
  12580. // If a key with the spaces exists, use it.
  12581. // Otherwise, create an array by matching non-whitespace
  12582. key = key in cache ?
  12583. [ key ] :
  12584. ( key.match( rnothtmlwhite ) || [] );
  12585. }
  12586. i = key.length;
  12587. while ( i-- ) {
  12588. delete cache[ key[ i ] ];
  12589. }
  12590. }
  12591. // Remove the expando if there's no more data
  12592. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12593. // Support: Chrome <=35 - 45
  12594. // Webkit & Blink performance suffers when deleting properties
  12595. // from DOM nodes, so set to undefined instead
  12596. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12597. if ( owner.nodeType ) {
  12598. owner[ this.expando ] = undefined;
  12599. } else {
  12600. delete owner[ this.expando ];
  12601. }
  12602. }
  12603. },
  12604. hasData: function( owner ) {
  12605. var cache = owner[ this.expando ];
  12606. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12607. }
  12608. };
  12609. var dataPriv = new Data();
  12610. var dataUser = new Data();
  12611. // Implementation Summary
  12612. //
  12613. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12614. // 2. Improve the module's maintainability by reducing the storage
  12615. // paths to a single mechanism.
  12616. // 3. Use the same single mechanism to support "private" and "user" data.
  12617. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12618. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12619. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12620. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12621. rmultiDash = /[A-Z]/g;
  12622. function getData( data ) {
  12623. if ( data === "true" ) {
  12624. return true;
  12625. }
  12626. if ( data === "false" ) {
  12627. return false;
  12628. }
  12629. if ( data === "null" ) {
  12630. return null;
  12631. }
  12632. // Only convert to a number if it doesn't change the string
  12633. if ( data === +data + "" ) {
  12634. return +data;
  12635. }
  12636. if ( rbrace.test( data ) ) {
  12637. return JSON.parse( data );
  12638. }
  12639. return data;
  12640. }
  12641. function dataAttr( elem, key, data ) {
  12642. var name;
  12643. // If nothing was found internally, try to fetch any
  12644. // data from the HTML5 data-* attribute
  12645. if ( data === undefined && elem.nodeType === 1 ) {
  12646. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12647. data = elem.getAttribute( name );
  12648. if ( typeof data === "string" ) {
  12649. try {
  12650. data = getData( data );
  12651. } catch ( e ) {}
  12652. // Make sure we set the data so it isn't changed later
  12653. dataUser.set( elem, key, data );
  12654. } else {
  12655. data = undefined;
  12656. }
  12657. }
  12658. return data;
  12659. }
  12660. jQuery.extend( {
  12661. hasData: function( elem ) {
  12662. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12663. },
  12664. data: function( elem, name, data ) {
  12665. return dataUser.access( elem, name, data );
  12666. },
  12667. removeData: function( elem, name ) {
  12668. dataUser.remove( elem, name );
  12669. },
  12670. // TODO: Now that all calls to _data and _removeData have been replaced
  12671. // with direct calls to dataPriv methods, these can be deprecated.
  12672. _data: function( elem, name, data ) {
  12673. return dataPriv.access( elem, name, data );
  12674. },
  12675. _removeData: function( elem, name ) {
  12676. dataPriv.remove( elem, name );
  12677. }
  12678. } );
  12679. jQuery.fn.extend( {
  12680. data: function( key, value ) {
  12681. var i, name, data,
  12682. elem = this[ 0 ],
  12683. attrs = elem && elem.attributes;
  12684. // Gets all values
  12685. if ( key === undefined ) {
  12686. if ( this.length ) {
  12687. data = dataUser.get( elem );
  12688. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12689. i = attrs.length;
  12690. while ( i-- ) {
  12691. // Support: IE 11 only
  12692. // The attrs elements can be null (#14894)
  12693. if ( attrs[ i ] ) {
  12694. name = attrs[ i ].name;
  12695. if ( name.indexOf( "data-" ) === 0 ) {
  12696. name = camelCase( name.slice( 5 ) );
  12697. dataAttr( elem, name, data[ name ] );
  12698. }
  12699. }
  12700. }
  12701. dataPriv.set( elem, "hasDataAttrs", true );
  12702. }
  12703. }
  12704. return data;
  12705. }
  12706. // Sets multiple values
  12707. if ( typeof key === "object" ) {
  12708. return this.each( function() {
  12709. dataUser.set( this, key );
  12710. } );
  12711. }
  12712. return access( this, function( value ) {
  12713. var data;
  12714. // The calling jQuery object (element matches) is not empty
  12715. // (and therefore has an element appears at this[ 0 ]) and the
  12716. // `value` parameter was not undefined. An empty jQuery object
  12717. // will result in `undefined` for elem = this[ 0 ] which will
  12718. // throw an exception if an attempt to read a data cache is made.
  12719. if ( elem && value === undefined ) {
  12720. // Attempt to get data from the cache
  12721. // The key will always be camelCased in Data
  12722. data = dataUser.get( elem, key );
  12723. if ( data !== undefined ) {
  12724. return data;
  12725. }
  12726. // Attempt to "discover" the data in
  12727. // HTML5 custom data-* attrs
  12728. data = dataAttr( elem, key );
  12729. if ( data !== undefined ) {
  12730. return data;
  12731. }
  12732. // We tried really hard, but the data doesn't exist.
  12733. return;
  12734. }
  12735. // Set the data...
  12736. this.each( function() {
  12737. // We always store the camelCased key
  12738. dataUser.set( this, key, value );
  12739. } );
  12740. }, null, value, arguments.length > 1, null, true );
  12741. },
  12742. removeData: function( key ) {
  12743. return this.each( function() {
  12744. dataUser.remove( this, key );
  12745. } );
  12746. }
  12747. } );
  12748. jQuery.extend( {
  12749. queue: function( elem, type, data ) {
  12750. var queue;
  12751. if ( elem ) {
  12752. type = ( type || "fx" ) + "queue";
  12753. queue = dataPriv.get( elem, type );
  12754. // Speed up dequeue by getting out quickly if this is just a lookup
  12755. if ( data ) {
  12756. if ( !queue || Array.isArray( data ) ) {
  12757. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12758. } else {
  12759. queue.push( data );
  12760. }
  12761. }
  12762. return queue || [];
  12763. }
  12764. },
  12765. dequeue: function( elem, type ) {
  12766. type = type || "fx";
  12767. var queue = jQuery.queue( elem, type ),
  12768. startLength = queue.length,
  12769. fn = queue.shift(),
  12770. hooks = jQuery._queueHooks( elem, type ),
  12771. next = function() {
  12772. jQuery.dequeue( elem, type );
  12773. };
  12774. // If the fx queue is dequeued, always remove the progress sentinel
  12775. if ( fn === "inprogress" ) {
  12776. fn = queue.shift();
  12777. startLength--;
  12778. }
  12779. if ( fn ) {
  12780. // Add a progress sentinel to prevent the fx queue from being
  12781. // automatically dequeued
  12782. if ( type === "fx" ) {
  12783. queue.unshift( "inprogress" );
  12784. }
  12785. // Clear up the last queue stop function
  12786. delete hooks.stop;
  12787. fn.call( elem, next, hooks );
  12788. }
  12789. if ( !startLength && hooks ) {
  12790. hooks.empty.fire();
  12791. }
  12792. },
  12793. // Not public - generate a queueHooks object, or return the current one
  12794. _queueHooks: function( elem, type ) {
  12795. var key = type + "queueHooks";
  12796. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12797. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12798. dataPriv.remove( elem, [ type + "queue", key ] );
  12799. } )
  12800. } );
  12801. }
  12802. } );
  12803. jQuery.fn.extend( {
  12804. queue: function( type, data ) {
  12805. var setter = 2;
  12806. if ( typeof type !== "string" ) {
  12807. data = type;
  12808. type = "fx";
  12809. setter--;
  12810. }
  12811. if ( arguments.length < setter ) {
  12812. return jQuery.queue( this[ 0 ], type );
  12813. }
  12814. return data === undefined ?
  12815. this :
  12816. this.each( function() {
  12817. var queue = jQuery.queue( this, type, data );
  12818. // Ensure a hooks for this queue
  12819. jQuery._queueHooks( this, type );
  12820. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12821. jQuery.dequeue( this, type );
  12822. }
  12823. } );
  12824. },
  12825. dequeue: function( type ) {
  12826. return this.each( function() {
  12827. jQuery.dequeue( this, type );
  12828. } );
  12829. },
  12830. clearQueue: function( type ) {
  12831. return this.queue( type || "fx", [] );
  12832. },
  12833. // Get a promise resolved when queues of a certain type
  12834. // are emptied (fx is the type by default)
  12835. promise: function( type, obj ) {
  12836. var tmp,
  12837. count = 1,
  12838. defer = jQuery.Deferred(),
  12839. elements = this,
  12840. i = this.length,
  12841. resolve = function() {
  12842. if ( !( --count ) ) {
  12843. defer.resolveWith( elements, [ elements ] );
  12844. }
  12845. };
  12846. if ( typeof type !== "string" ) {
  12847. obj = type;
  12848. type = undefined;
  12849. }
  12850. type = type || "fx";
  12851. while ( i-- ) {
  12852. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12853. if ( tmp && tmp.empty ) {
  12854. count++;
  12855. tmp.empty.add( resolve );
  12856. }
  12857. }
  12858. resolve();
  12859. return defer.promise( obj );
  12860. }
  12861. } );
  12862. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12863. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12864. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12865. var documentElement = document.documentElement;
  12866. var isAttached = function( elem ) {
  12867. return jQuery.contains( elem.ownerDocument, elem );
  12868. },
  12869. composed = { composed: true };
  12870. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12871. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12872. // Support: iOS 10.0-10.2 only
  12873. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12874. // leading to errors. We need to check for `getRootNode`.
  12875. if ( documentElement.getRootNode ) {
  12876. isAttached = function( elem ) {
  12877. return jQuery.contains( elem.ownerDocument, elem ) ||
  12878. elem.getRootNode( composed ) === elem.ownerDocument;
  12879. };
  12880. }
  12881. var isHiddenWithinTree = function( elem, el ) {
  12882. // isHiddenWithinTree might be called from jQuery#filter function;
  12883. // in that case, element will be second argument
  12884. elem = el || elem;
  12885. // Inline style trumps all
  12886. return elem.style.display === "none" ||
  12887. elem.style.display === "" &&
  12888. // Otherwise, check computed style
  12889. // Support: Firefox <=43 - 45
  12890. // Disconnected elements can have computed display: none, so first confirm that elem is
  12891. // in the document.
  12892. isAttached( elem ) &&
  12893. jQuery.css( elem, "display" ) === "none";
  12894. };
  12895. var swap = function( elem, options, callback, args ) {
  12896. var ret, name,
  12897. old = {};
  12898. // Remember the old values, and insert the new ones
  12899. for ( name in options ) {
  12900. old[ name ] = elem.style[ name ];
  12901. elem.style[ name ] = options[ name ];
  12902. }
  12903. ret = callback.apply( elem, args || [] );
  12904. // Revert the old values
  12905. for ( name in options ) {
  12906. elem.style[ name ] = old[ name ];
  12907. }
  12908. return ret;
  12909. };
  12910. function adjustCSS( elem, prop, valueParts, tween ) {
  12911. var adjusted, scale,
  12912. maxIterations = 20,
  12913. currentValue = tween ?
  12914. function() {
  12915. return tween.cur();
  12916. } :
  12917. function() {
  12918. return jQuery.css( elem, prop, "" );
  12919. },
  12920. initial = currentValue(),
  12921. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12922. // Starting value computation is required for potential unit mismatches
  12923. initialInUnit = elem.nodeType &&
  12924. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12925. rcssNum.exec( jQuery.css( elem, prop ) );
  12926. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12927. // Support: Firefox <=54
  12928. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12929. initial = initial / 2;
  12930. // Trust units reported by jQuery.css
  12931. unit = unit || initialInUnit[ 3 ];
  12932. // Iteratively approximate from a nonzero starting point
  12933. initialInUnit = +initial || 1;
  12934. while ( maxIterations-- ) {
  12935. // Evaluate and update our best guess (doubling guesses that zero out).
  12936. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12937. jQuery.style( elem, prop, initialInUnit + unit );
  12938. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12939. maxIterations = 0;
  12940. }
  12941. initialInUnit = initialInUnit / scale;
  12942. }
  12943. initialInUnit = initialInUnit * 2;
  12944. jQuery.style( elem, prop, initialInUnit + unit );
  12945. // Make sure we update the tween properties later on
  12946. valueParts = valueParts || [];
  12947. }
  12948. if ( valueParts ) {
  12949. initialInUnit = +initialInUnit || +initial || 0;
  12950. // Apply relative offset (+=/-=) if specified
  12951. adjusted = valueParts[ 1 ] ?
  12952. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12953. +valueParts[ 2 ];
  12954. if ( tween ) {
  12955. tween.unit = unit;
  12956. tween.start = initialInUnit;
  12957. tween.end = adjusted;
  12958. }
  12959. }
  12960. return adjusted;
  12961. }
  12962. var defaultDisplayMap = {};
  12963. function getDefaultDisplay( elem ) {
  12964. var temp,
  12965. doc = elem.ownerDocument,
  12966. nodeName = elem.nodeName,
  12967. display = defaultDisplayMap[ nodeName ];
  12968. if ( display ) {
  12969. return display;
  12970. }
  12971. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12972. display = jQuery.css( temp, "display" );
  12973. temp.parentNode.removeChild( temp );
  12974. if ( display === "none" ) {
  12975. display = "block";
  12976. }
  12977. defaultDisplayMap[ nodeName ] = display;
  12978. return display;
  12979. }
  12980. function showHide( elements, show ) {
  12981. var display, elem,
  12982. values = [],
  12983. index = 0,
  12984. length = elements.length;
  12985. // Determine new display value for elements that need to change
  12986. for ( ; index < length; index++ ) {
  12987. elem = elements[ index ];
  12988. if ( !elem.style ) {
  12989. continue;
  12990. }
  12991. display = elem.style.display;
  12992. if ( show ) {
  12993. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12994. // check is required in this first loop unless we have a nonempty display value (either
  12995. // inline or about-to-be-restored)
  12996. if ( display === "none" ) {
  12997. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12998. if ( !values[ index ] ) {
  12999. elem.style.display = "";
  13000. }
  13001. }
  13002. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13003. values[ index ] = getDefaultDisplay( elem );
  13004. }
  13005. } else {
  13006. if ( display !== "none" ) {
  13007. values[ index ] = "none";
  13008. // Remember what we're overwriting
  13009. dataPriv.set( elem, "display", display );
  13010. }
  13011. }
  13012. }
  13013. // Set the display of the elements in a second loop to avoid constant reflow
  13014. for ( index = 0; index < length; index++ ) {
  13015. if ( values[ index ] != null ) {
  13016. elements[ index ].style.display = values[ index ];
  13017. }
  13018. }
  13019. return elements;
  13020. }
  13021. jQuery.fn.extend( {
  13022. show: function() {
  13023. return showHide( this, true );
  13024. },
  13025. hide: function() {
  13026. return showHide( this );
  13027. },
  13028. toggle: function( state ) {
  13029. if ( typeof state === "boolean" ) {
  13030. return state ? this.show() : this.hide();
  13031. }
  13032. return this.each( function() {
  13033. if ( isHiddenWithinTree( this ) ) {
  13034. jQuery( this ).show();
  13035. } else {
  13036. jQuery( this ).hide();
  13037. }
  13038. } );
  13039. }
  13040. } );
  13041. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13042. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13043. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13044. // We have to close these tags to support XHTML (#13200)
  13045. var wrapMap = {
  13046. // Support: IE <=9 only
  13047. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13048. // XHTML parsers do not magically insert elements in the
  13049. // same way that tag soup parsers do. So we cannot shorten
  13050. // this by omitting <tbody> or other required elements.
  13051. thead: [ 1, "<table>", "</table>" ],
  13052. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13053. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13054. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13055. _default: [ 0, "", "" ]
  13056. };
  13057. // Support: IE <=9 only
  13058. wrapMap.optgroup = wrapMap.option;
  13059. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13060. wrapMap.th = wrapMap.td;
  13061. function getAll( context, tag ) {
  13062. // Support: IE <=9 - 11 only
  13063. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13064. var ret;
  13065. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13066. ret = context.getElementsByTagName( tag || "*" );
  13067. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13068. ret = context.querySelectorAll( tag || "*" );
  13069. } else {
  13070. ret = [];
  13071. }
  13072. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13073. return jQuery.merge( [ context ], ret );
  13074. }
  13075. return ret;
  13076. }
  13077. // Mark scripts as having already been evaluated
  13078. function setGlobalEval( elems, refElements ) {
  13079. var i = 0,
  13080. l = elems.length;
  13081. for ( ; i < l; i++ ) {
  13082. dataPriv.set(
  13083. elems[ i ],
  13084. "globalEval",
  13085. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13086. );
  13087. }
  13088. }
  13089. var rhtml = /<|&#?\w+;/;
  13090. function buildFragment( elems, context, scripts, selection, ignored ) {
  13091. var elem, tmp, tag, wrap, attached, j,
  13092. fragment = context.createDocumentFragment(),
  13093. nodes = [],
  13094. i = 0,
  13095. l = elems.length;
  13096. for ( ; i < l; i++ ) {
  13097. elem = elems[ i ];
  13098. if ( elem || elem === 0 ) {
  13099. // Add nodes directly
  13100. if ( toType( elem ) === "object" ) {
  13101. // Support: Android <=4.0 only, PhantomJS 1 only
  13102. // push.apply(_, arraylike) throws on ancient WebKit
  13103. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13104. // Convert non-html into a text node
  13105. } else if ( !rhtml.test( elem ) ) {
  13106. nodes.push( context.createTextNode( elem ) );
  13107. // Convert html into DOM nodes
  13108. } else {
  13109. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13110. // Deserialize a standard representation
  13111. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13112. wrap = wrapMap[ tag ] || wrapMap._default;
  13113. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13114. // Descend through wrappers to the right content
  13115. j = wrap[ 0 ];
  13116. while ( j-- ) {
  13117. tmp = tmp.lastChild;
  13118. }
  13119. // Support: Android <=4.0 only, PhantomJS 1 only
  13120. // push.apply(_, arraylike) throws on ancient WebKit
  13121. jQuery.merge( nodes, tmp.childNodes );
  13122. // Remember the top-level container
  13123. tmp = fragment.firstChild;
  13124. // Ensure the created nodes are orphaned (#12392)
  13125. tmp.textContent = "";
  13126. }
  13127. }
  13128. }
  13129. // Remove wrapper from fragment
  13130. fragment.textContent = "";
  13131. i = 0;
  13132. while ( ( elem = nodes[ i++ ] ) ) {
  13133. // Skip elements already in the context collection (trac-4087)
  13134. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13135. if ( ignored ) {
  13136. ignored.push( elem );
  13137. }
  13138. continue;
  13139. }
  13140. attached = isAttached( elem );
  13141. // Append to fragment
  13142. tmp = getAll( fragment.appendChild( elem ), "script" );
  13143. // Preserve script evaluation history
  13144. if ( attached ) {
  13145. setGlobalEval( tmp );
  13146. }
  13147. // Capture executables
  13148. if ( scripts ) {
  13149. j = 0;
  13150. while ( ( elem = tmp[ j++ ] ) ) {
  13151. if ( rscriptType.test( elem.type || "" ) ) {
  13152. scripts.push( elem );
  13153. }
  13154. }
  13155. }
  13156. }
  13157. return fragment;
  13158. }
  13159. ( function() {
  13160. var fragment = document.createDocumentFragment(),
  13161. div = fragment.appendChild( document.createElement( "div" ) ),
  13162. input = document.createElement( "input" );
  13163. // Support: Android 4.0 - 4.3 only
  13164. // Check state lost if the name is set (#11217)
  13165. // Support: Windows Web Apps (WWA)
  13166. // `name` and `type` must use .setAttribute for WWA (#14901)
  13167. input.setAttribute( "type", "radio" );
  13168. input.setAttribute( "checked", "checked" );
  13169. input.setAttribute( "name", "t" );
  13170. div.appendChild( input );
  13171. // Support: Android <=4.1 only
  13172. // Older WebKit doesn't clone checked state correctly in fragments
  13173. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13174. // Support: IE <=11 only
  13175. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13176. div.innerHTML = "<textarea>x</textarea>";
  13177. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13178. } )();
  13179. var
  13180. rkeyEvent = /^key/,
  13181. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13182. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13183. function returnTrue() {
  13184. return true;
  13185. }
  13186. function returnFalse() {
  13187. return false;
  13188. }
  13189. // Support: IE <=9 - 11+
  13190. // focus() and blur() are asynchronous, except when they are no-op.
  13191. // So expect focus to be synchronous when the element is already active,
  13192. // and blur to be synchronous when the element is not already active.
  13193. // (focus and blur are always synchronous in other supported browsers,
  13194. // this just defines when we can count on it).
  13195. function expectSync( elem, type ) {
  13196. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13197. }
  13198. // Support: IE <=9 only
  13199. // Accessing document.activeElement can throw unexpectedly
  13200. // https://bugs.jquery.com/ticket/13393
  13201. function safeActiveElement() {
  13202. try {
  13203. return document.activeElement;
  13204. } catch ( err ) { }
  13205. }
  13206. function on( elem, types, selector, data, fn, one ) {
  13207. var origFn, type;
  13208. // Types can be a map of types/handlers
  13209. if ( typeof types === "object" ) {
  13210. // ( types-Object, selector, data )
  13211. if ( typeof selector !== "string" ) {
  13212. // ( types-Object, data )
  13213. data = data || selector;
  13214. selector = undefined;
  13215. }
  13216. for ( type in types ) {
  13217. on( elem, type, selector, data, types[ type ], one );
  13218. }
  13219. return elem;
  13220. }
  13221. if ( data == null && fn == null ) {
  13222. // ( types, fn )
  13223. fn = selector;
  13224. data = selector = undefined;
  13225. } else if ( fn == null ) {
  13226. if ( typeof selector === "string" ) {
  13227. // ( types, selector, fn )
  13228. fn = data;
  13229. data = undefined;
  13230. } else {
  13231. // ( types, data, fn )
  13232. fn = data;
  13233. data = selector;
  13234. selector = undefined;
  13235. }
  13236. }
  13237. if ( fn === false ) {
  13238. fn = returnFalse;
  13239. } else if ( !fn ) {
  13240. return elem;
  13241. }
  13242. if ( one === 1 ) {
  13243. origFn = fn;
  13244. fn = function( event ) {
  13245. // Can use an empty set, since event contains the info
  13246. jQuery().off( event );
  13247. return origFn.apply( this, arguments );
  13248. };
  13249. // Use same guid so caller can remove using origFn
  13250. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13251. }
  13252. return elem.each( function() {
  13253. jQuery.event.add( this, types, fn, data, selector );
  13254. } );
  13255. }
  13256. /*
  13257. * Helper functions for managing events -- not part of the public interface.
  13258. * Props to Dean Edwards' addEvent library for many of the ideas.
  13259. */
  13260. jQuery.event = {
  13261. global: {},
  13262. add: function( elem, types, handler, data, selector ) {
  13263. var handleObjIn, eventHandle, tmp,
  13264. events, t, handleObj,
  13265. special, handlers, type, namespaces, origType,
  13266. elemData = dataPriv.get( elem );
  13267. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13268. if ( !elemData ) {
  13269. return;
  13270. }
  13271. // Caller can pass in an object of custom data in lieu of the handler
  13272. if ( handler.handler ) {
  13273. handleObjIn = handler;
  13274. handler = handleObjIn.handler;
  13275. selector = handleObjIn.selector;
  13276. }
  13277. // Ensure that invalid selectors throw exceptions at attach time
  13278. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13279. if ( selector ) {
  13280. jQuery.find.matchesSelector( documentElement, selector );
  13281. }
  13282. // Make sure that the handler has a unique ID, used to find/remove it later
  13283. if ( !handler.guid ) {
  13284. handler.guid = jQuery.guid++;
  13285. }
  13286. // Init the element's event structure and main handler, if this is the first
  13287. if ( !( events = elemData.events ) ) {
  13288. events = elemData.events = {};
  13289. }
  13290. if ( !( eventHandle = elemData.handle ) ) {
  13291. eventHandle = elemData.handle = function( e ) {
  13292. // Discard the second event of a jQuery.event.trigger() and
  13293. // when an event is called after a page has unloaded
  13294. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13295. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13296. };
  13297. }
  13298. // Handle multiple events separated by a space
  13299. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13300. t = types.length;
  13301. while ( t-- ) {
  13302. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13303. type = origType = tmp[ 1 ];
  13304. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13305. // There *must* be a type, no attaching namespace-only handlers
  13306. if ( !type ) {
  13307. continue;
  13308. }
  13309. // If event changes its type, use the special event handlers for the changed type
  13310. special = jQuery.event.special[ type ] || {};
  13311. // If selector defined, determine special event api type, otherwise given type
  13312. type = ( selector ? special.delegateType : special.bindType ) || type;
  13313. // Update special based on newly reset type
  13314. special = jQuery.event.special[ type ] || {};
  13315. // handleObj is passed to all event handlers
  13316. handleObj = jQuery.extend( {
  13317. type: type,
  13318. origType: origType,
  13319. data: data,
  13320. handler: handler,
  13321. guid: handler.guid,
  13322. selector: selector,
  13323. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13324. namespace: namespaces.join( "." )
  13325. }, handleObjIn );
  13326. // Init the event handler queue if we're the first
  13327. if ( !( handlers = events[ type ] ) ) {
  13328. handlers = events[ type ] = [];
  13329. handlers.delegateCount = 0;
  13330. // Only use addEventListener if the special events handler returns false
  13331. if ( !special.setup ||
  13332. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13333. if ( elem.addEventListener ) {
  13334. elem.addEventListener( type, eventHandle );
  13335. }
  13336. }
  13337. }
  13338. if ( special.add ) {
  13339. special.add.call( elem, handleObj );
  13340. if ( !handleObj.handler.guid ) {
  13341. handleObj.handler.guid = handler.guid;
  13342. }
  13343. }
  13344. // Add to the element's handler list, delegates in front
  13345. if ( selector ) {
  13346. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13347. } else {
  13348. handlers.push( handleObj );
  13349. }
  13350. // Keep track of which events have ever been used, for event optimization
  13351. jQuery.event.global[ type ] = true;
  13352. }
  13353. },
  13354. // Detach an event or set of events from an element
  13355. remove: function( elem, types, handler, selector, mappedTypes ) {
  13356. var j, origCount, tmp,
  13357. events, t, handleObj,
  13358. special, handlers, type, namespaces, origType,
  13359. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13360. if ( !elemData || !( events = elemData.events ) ) {
  13361. return;
  13362. }
  13363. // Once for each type.namespace in types; type may be omitted
  13364. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13365. t = types.length;
  13366. while ( t-- ) {
  13367. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13368. type = origType = tmp[ 1 ];
  13369. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13370. // Unbind all events (on this namespace, if provided) for the element
  13371. if ( !type ) {
  13372. for ( type in events ) {
  13373. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13374. }
  13375. continue;
  13376. }
  13377. special = jQuery.event.special[ type ] || {};
  13378. type = ( selector ? special.delegateType : special.bindType ) || type;
  13379. handlers = events[ type ] || [];
  13380. tmp = tmp[ 2 ] &&
  13381. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13382. // Remove matching events
  13383. origCount = j = handlers.length;
  13384. while ( j-- ) {
  13385. handleObj = handlers[ j ];
  13386. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13387. ( !handler || handler.guid === handleObj.guid ) &&
  13388. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13389. ( !selector || selector === handleObj.selector ||
  13390. selector === "**" && handleObj.selector ) ) {
  13391. handlers.splice( j, 1 );
  13392. if ( handleObj.selector ) {
  13393. handlers.delegateCount--;
  13394. }
  13395. if ( special.remove ) {
  13396. special.remove.call( elem, handleObj );
  13397. }
  13398. }
  13399. }
  13400. // Remove generic event handler if we removed something and no more handlers exist
  13401. // (avoids potential for endless recursion during removal of special event handlers)
  13402. if ( origCount && !handlers.length ) {
  13403. if ( !special.teardown ||
  13404. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13405. jQuery.removeEvent( elem, type, elemData.handle );
  13406. }
  13407. delete events[ type ];
  13408. }
  13409. }
  13410. // Remove data and the expando if it's no longer used
  13411. if ( jQuery.isEmptyObject( events ) ) {
  13412. dataPriv.remove( elem, "handle events" );
  13413. }
  13414. },
  13415. dispatch: function( nativeEvent ) {
  13416. // Make a writable jQuery.Event from the native event object
  13417. var event = jQuery.event.fix( nativeEvent );
  13418. var i, j, ret, matched, handleObj, handlerQueue,
  13419. args = new Array( arguments.length ),
  13420. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13421. special = jQuery.event.special[ event.type ] || {};
  13422. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13423. args[ 0 ] = event;
  13424. for ( i = 1; i < arguments.length; i++ ) {
  13425. args[ i ] = arguments[ i ];
  13426. }
  13427. event.delegateTarget = this;
  13428. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13429. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13430. return;
  13431. }
  13432. // Determine handlers
  13433. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13434. // Run delegates first; they may want to stop propagation beneath us
  13435. i = 0;
  13436. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13437. event.currentTarget = matched.elem;
  13438. j = 0;
  13439. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13440. !event.isImmediatePropagationStopped() ) {
  13441. // If the event is namespaced, then each handler is only invoked if it is
  13442. // specially universal or its namespaces are a superset of the event's.
  13443. if ( !event.rnamespace || handleObj.namespace === false ||
  13444. event.rnamespace.test( handleObj.namespace ) ) {
  13445. event.handleObj = handleObj;
  13446. event.data = handleObj.data;
  13447. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13448. handleObj.handler ).apply( matched.elem, args );
  13449. if ( ret !== undefined ) {
  13450. if ( ( event.result = ret ) === false ) {
  13451. event.preventDefault();
  13452. event.stopPropagation();
  13453. }
  13454. }
  13455. }
  13456. }
  13457. }
  13458. // Call the postDispatch hook for the mapped type
  13459. if ( special.postDispatch ) {
  13460. special.postDispatch.call( this, event );
  13461. }
  13462. return event.result;
  13463. },
  13464. handlers: function( event, handlers ) {
  13465. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13466. handlerQueue = [],
  13467. delegateCount = handlers.delegateCount,
  13468. cur = event.target;
  13469. // Find delegate handlers
  13470. if ( delegateCount &&
  13471. // Support: IE <=9
  13472. // Black-hole SVG <use> instance trees (trac-13180)
  13473. cur.nodeType &&
  13474. // Support: Firefox <=42
  13475. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13476. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13477. // Support: IE 11 only
  13478. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13479. !( event.type === "click" && event.button >= 1 ) ) {
  13480. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13481. // Don't check non-elements (#13208)
  13482. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13483. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13484. matchedHandlers = [];
  13485. matchedSelectors = {};
  13486. for ( i = 0; i < delegateCount; i++ ) {
  13487. handleObj = handlers[ i ];
  13488. // Don't conflict with Object.prototype properties (#13203)
  13489. sel = handleObj.selector + " ";
  13490. if ( matchedSelectors[ sel ] === undefined ) {
  13491. matchedSelectors[ sel ] = handleObj.needsContext ?
  13492. jQuery( sel, this ).index( cur ) > -1 :
  13493. jQuery.find( sel, this, null, [ cur ] ).length;
  13494. }
  13495. if ( matchedSelectors[ sel ] ) {
  13496. matchedHandlers.push( handleObj );
  13497. }
  13498. }
  13499. if ( matchedHandlers.length ) {
  13500. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13501. }
  13502. }
  13503. }
  13504. }
  13505. // Add the remaining (directly-bound) handlers
  13506. cur = this;
  13507. if ( delegateCount < handlers.length ) {
  13508. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13509. }
  13510. return handlerQueue;
  13511. },
  13512. addProp: function( name, hook ) {
  13513. Object.defineProperty( jQuery.Event.prototype, name, {
  13514. enumerable: true,
  13515. configurable: true,
  13516. get: isFunction( hook ) ?
  13517. function() {
  13518. if ( this.originalEvent ) {
  13519. return hook( this.originalEvent );
  13520. }
  13521. } :
  13522. function() {
  13523. if ( this.originalEvent ) {
  13524. return this.originalEvent[ name ];
  13525. }
  13526. },
  13527. set: function( value ) {
  13528. Object.defineProperty( this, name, {
  13529. enumerable: true,
  13530. configurable: true,
  13531. writable: true,
  13532. value: value
  13533. } );
  13534. }
  13535. } );
  13536. },
  13537. fix: function( originalEvent ) {
  13538. return originalEvent[ jQuery.expando ] ?
  13539. originalEvent :
  13540. new jQuery.Event( originalEvent );
  13541. },
  13542. special: {
  13543. load: {
  13544. // Prevent triggered image.load events from bubbling to window.load
  13545. noBubble: true
  13546. },
  13547. click: {
  13548. // Utilize native event to ensure correct state for checkable inputs
  13549. setup: function( data ) {
  13550. // For mutual compressibility with _default, replace `this` access with a local var.
  13551. // `|| data` is dead code meant only to preserve the variable through minification.
  13552. var el = this || data;
  13553. // Claim the first handler
  13554. if ( rcheckableType.test( el.type ) &&
  13555. el.click && nodeName( el, "input" ) ) {
  13556. // dataPriv.set( el, "click", ... )
  13557. leverageNative( el, "click", returnTrue );
  13558. }
  13559. // Return false to allow normal processing in the caller
  13560. return false;
  13561. },
  13562. trigger: function( data ) {
  13563. // For mutual compressibility with _default, replace `this` access with a local var.
  13564. // `|| data` is dead code meant only to preserve the variable through minification.
  13565. var el = this || data;
  13566. // Force setup before triggering a click
  13567. if ( rcheckableType.test( el.type ) &&
  13568. el.click && nodeName( el, "input" ) ) {
  13569. leverageNative( el, "click" );
  13570. }
  13571. // Return non-false to allow normal event-path propagation
  13572. return true;
  13573. },
  13574. // For cross-browser consistency, suppress native .click() on links
  13575. // Also prevent it if we're currently inside a leveraged native-event stack
  13576. _default: function( event ) {
  13577. var target = event.target;
  13578. return rcheckableType.test( target.type ) &&
  13579. target.click && nodeName( target, "input" ) &&
  13580. dataPriv.get( target, "click" ) ||
  13581. nodeName( target, "a" );
  13582. }
  13583. },
  13584. beforeunload: {
  13585. postDispatch: function( event ) {
  13586. // Support: Firefox 20+
  13587. // Firefox doesn't alert if the returnValue field is not set.
  13588. if ( event.result !== undefined && event.originalEvent ) {
  13589. event.originalEvent.returnValue = event.result;
  13590. }
  13591. }
  13592. }
  13593. }
  13594. };
  13595. // Ensure the presence of an event listener that handles manually-triggered
  13596. // synthetic events by interrupting progress until reinvoked in response to
  13597. // *native* events that it fires directly, ensuring that state changes have
  13598. // already occurred before other listeners are invoked.
  13599. function leverageNative( el, type, expectSync ) {
  13600. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13601. if ( !expectSync ) {
  13602. if ( dataPriv.get( el, type ) === undefined ) {
  13603. jQuery.event.add( el, type, returnTrue );
  13604. }
  13605. return;
  13606. }
  13607. // Register the controller as a special universal handler for all event namespaces
  13608. dataPriv.set( el, type, false );
  13609. jQuery.event.add( el, type, {
  13610. namespace: false,
  13611. handler: function( event ) {
  13612. var notAsync, result,
  13613. saved = dataPriv.get( this, type );
  13614. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13615. // Interrupt processing of the outer synthetic .trigger()ed event
  13616. // Saved data should be false in such cases, but might be a leftover capture object
  13617. // from an async native handler (gh-4350)
  13618. if ( !saved.length ) {
  13619. // Store arguments for use when handling the inner native event
  13620. // There will always be at least one argument (an event object), so this array
  13621. // will not be confused with a leftover capture object.
  13622. saved = slice.call( arguments );
  13623. dataPriv.set( this, type, saved );
  13624. // Trigger the native event and capture its result
  13625. // Support: IE <=9 - 11+
  13626. // focus() and blur() are asynchronous
  13627. notAsync = expectSync( this, type );
  13628. this[ type ]();
  13629. result = dataPriv.get( this, type );
  13630. if ( saved !== result || notAsync ) {
  13631. dataPriv.set( this, type, false );
  13632. } else {
  13633. result = {};
  13634. }
  13635. if ( saved !== result ) {
  13636. // Cancel the outer synthetic event
  13637. event.stopImmediatePropagation();
  13638. event.preventDefault();
  13639. return result.value;
  13640. }
  13641. // If this is an inner synthetic event for an event with a bubbling surrogate
  13642. // (focus or blur), assume that the surrogate already propagated from triggering the
  13643. // native event and prevent that from happening again here.
  13644. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13645. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13646. // less bad than duplication.
  13647. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13648. event.stopPropagation();
  13649. }
  13650. // If this is a native event triggered above, everything is now in order
  13651. // Fire an inner synthetic event with the original arguments
  13652. } else if ( saved.length ) {
  13653. // ...and capture the result
  13654. dataPriv.set( this, type, {
  13655. value: jQuery.event.trigger(
  13656. // Support: IE <=9 - 11+
  13657. // Extend with the prototype to reset the above stopImmediatePropagation()
  13658. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13659. saved.slice( 1 ),
  13660. this
  13661. )
  13662. } );
  13663. // Abort handling of the native event
  13664. event.stopImmediatePropagation();
  13665. }
  13666. }
  13667. } );
  13668. }
  13669. jQuery.removeEvent = function( elem, type, handle ) {
  13670. // This "if" is needed for plain objects
  13671. if ( elem.removeEventListener ) {
  13672. elem.removeEventListener( type, handle );
  13673. }
  13674. };
  13675. jQuery.Event = function( src, props ) {
  13676. // Allow instantiation without the 'new' keyword
  13677. if ( !( this instanceof jQuery.Event ) ) {
  13678. return new jQuery.Event( src, props );
  13679. }
  13680. // Event object
  13681. if ( src && src.type ) {
  13682. this.originalEvent = src;
  13683. this.type = src.type;
  13684. // Events bubbling up the document may have been marked as prevented
  13685. // by a handler lower down the tree; reflect the correct value.
  13686. this.isDefaultPrevented = src.defaultPrevented ||
  13687. src.defaultPrevented === undefined &&
  13688. // Support: Android <=2.3 only
  13689. src.returnValue === false ?
  13690. returnTrue :
  13691. returnFalse;
  13692. // Create target properties
  13693. // Support: Safari <=6 - 7 only
  13694. // Target should not be a text node (#504, #13143)
  13695. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13696. src.target.parentNode :
  13697. src.target;
  13698. this.currentTarget = src.currentTarget;
  13699. this.relatedTarget = src.relatedTarget;
  13700. // Event type
  13701. } else {
  13702. this.type = src;
  13703. }
  13704. // Put explicitly provided properties onto the event object
  13705. if ( props ) {
  13706. jQuery.extend( this, props );
  13707. }
  13708. // Create a timestamp if incoming event doesn't have one
  13709. this.timeStamp = src && src.timeStamp || Date.now();
  13710. // Mark it as fixed
  13711. this[ jQuery.expando ] = true;
  13712. };
  13713. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13714. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13715. jQuery.Event.prototype = {
  13716. constructor: jQuery.Event,
  13717. isDefaultPrevented: returnFalse,
  13718. isPropagationStopped: returnFalse,
  13719. isImmediatePropagationStopped: returnFalse,
  13720. isSimulated: false,
  13721. preventDefault: function() {
  13722. var e = this.originalEvent;
  13723. this.isDefaultPrevented = returnTrue;
  13724. if ( e && !this.isSimulated ) {
  13725. e.preventDefault();
  13726. }
  13727. },
  13728. stopPropagation: function() {
  13729. var e = this.originalEvent;
  13730. this.isPropagationStopped = returnTrue;
  13731. if ( e && !this.isSimulated ) {
  13732. e.stopPropagation();
  13733. }
  13734. },
  13735. stopImmediatePropagation: function() {
  13736. var e = this.originalEvent;
  13737. this.isImmediatePropagationStopped = returnTrue;
  13738. if ( e && !this.isSimulated ) {
  13739. e.stopImmediatePropagation();
  13740. }
  13741. this.stopPropagation();
  13742. }
  13743. };
  13744. // Includes all common event props including KeyEvent and MouseEvent specific props
  13745. jQuery.each( {
  13746. altKey: true,
  13747. bubbles: true,
  13748. cancelable: true,
  13749. changedTouches: true,
  13750. ctrlKey: true,
  13751. detail: true,
  13752. eventPhase: true,
  13753. metaKey: true,
  13754. pageX: true,
  13755. pageY: true,
  13756. shiftKey: true,
  13757. view: true,
  13758. "char": true,
  13759. code: true,
  13760. charCode: true,
  13761. key: true,
  13762. keyCode: true,
  13763. button: true,
  13764. buttons: true,
  13765. clientX: true,
  13766. clientY: true,
  13767. offsetX: true,
  13768. offsetY: true,
  13769. pointerId: true,
  13770. pointerType: true,
  13771. screenX: true,
  13772. screenY: true,
  13773. targetTouches: true,
  13774. toElement: true,
  13775. touches: true,
  13776. which: function( event ) {
  13777. var button = event.button;
  13778. // Add which for key events
  13779. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13780. return event.charCode != null ? event.charCode : event.keyCode;
  13781. }
  13782. // Add which for click: 1 === left; 2 === middle; 3 === right
  13783. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13784. if ( button & 1 ) {
  13785. return 1;
  13786. }
  13787. if ( button & 2 ) {
  13788. return 3;
  13789. }
  13790. if ( button & 4 ) {
  13791. return 2;
  13792. }
  13793. return 0;
  13794. }
  13795. return event.which;
  13796. }
  13797. }, jQuery.event.addProp );
  13798. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13799. jQuery.event.special[ type ] = {
  13800. // Utilize native event if possible so blur/focus sequence is correct
  13801. setup: function() {
  13802. // Claim the first handler
  13803. // dataPriv.set( this, "focus", ... )
  13804. // dataPriv.set( this, "blur", ... )
  13805. leverageNative( this, type, expectSync );
  13806. // Return false to allow normal processing in the caller
  13807. return false;
  13808. },
  13809. trigger: function() {
  13810. // Force setup before trigger
  13811. leverageNative( this, type );
  13812. // Return non-false to allow normal event-path propagation
  13813. return true;
  13814. },
  13815. delegateType: delegateType
  13816. };
  13817. } );
  13818. // Create mouseenter/leave events using mouseover/out and event-time checks
  13819. // so that event delegation works in jQuery.
  13820. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13821. //
  13822. // Support: Safari 7 only
  13823. // Safari sends mouseenter too often; see:
  13824. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13825. // for the description of the bug (it existed in older Chrome versions as well).
  13826. jQuery.each( {
  13827. mouseenter: "mouseover",
  13828. mouseleave: "mouseout",
  13829. pointerenter: "pointerover",
  13830. pointerleave: "pointerout"
  13831. }, function( orig, fix ) {
  13832. jQuery.event.special[ orig ] = {
  13833. delegateType: fix,
  13834. bindType: fix,
  13835. handle: function( event ) {
  13836. var ret,
  13837. target = this,
  13838. related = event.relatedTarget,
  13839. handleObj = event.handleObj;
  13840. // For mouseenter/leave call the handler if related is outside the target.
  13841. // NB: No relatedTarget if the mouse left/entered the browser window
  13842. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13843. event.type = handleObj.origType;
  13844. ret = handleObj.handler.apply( this, arguments );
  13845. event.type = fix;
  13846. }
  13847. return ret;
  13848. }
  13849. };
  13850. } );
  13851. jQuery.fn.extend( {
  13852. on: function( types, selector, data, fn ) {
  13853. return on( this, types, selector, data, fn );
  13854. },
  13855. one: function( types, selector, data, fn ) {
  13856. return on( this, types, selector, data, fn, 1 );
  13857. },
  13858. off: function( types, selector, fn ) {
  13859. var handleObj, type;
  13860. if ( types && types.preventDefault && types.handleObj ) {
  13861. // ( event ) dispatched jQuery.Event
  13862. handleObj = types.handleObj;
  13863. jQuery( types.delegateTarget ).off(
  13864. handleObj.namespace ?
  13865. handleObj.origType + "." + handleObj.namespace :
  13866. handleObj.origType,
  13867. handleObj.selector,
  13868. handleObj.handler
  13869. );
  13870. return this;
  13871. }
  13872. if ( typeof types === "object" ) {
  13873. // ( types-object [, selector] )
  13874. for ( type in types ) {
  13875. this.off( type, selector, types[ type ] );
  13876. }
  13877. return this;
  13878. }
  13879. if ( selector === false || typeof selector === "function" ) {
  13880. // ( types [, fn] )
  13881. fn = selector;
  13882. selector = undefined;
  13883. }
  13884. if ( fn === false ) {
  13885. fn = returnFalse;
  13886. }
  13887. return this.each( function() {
  13888. jQuery.event.remove( this, types, fn, selector );
  13889. } );
  13890. }
  13891. } );
  13892. var
  13893. /* eslint-disable max-len */
  13894. // See https://github.com/eslint/eslint/issues/3229
  13895. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13896. /* eslint-enable */
  13897. // Support: IE <=10 - 11, Edge 12 - 13 only
  13898. // In IE/Edge using regex groups here causes severe slowdowns.
  13899. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13900. rnoInnerhtml = /<script|<style|<link/i,
  13901. // checked="checked" or checked
  13902. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13903. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13904. // Prefer a tbody over its parent table for containing new rows
  13905. function manipulationTarget( elem, content ) {
  13906. if ( nodeName( elem, "table" ) &&
  13907. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13908. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13909. }
  13910. return elem;
  13911. }
  13912. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13913. function disableScript( elem ) {
  13914. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13915. return elem;
  13916. }
  13917. function restoreScript( elem ) {
  13918. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13919. elem.type = elem.type.slice( 5 );
  13920. } else {
  13921. elem.removeAttribute( "type" );
  13922. }
  13923. return elem;
  13924. }
  13925. function cloneCopyEvent( src, dest ) {
  13926. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13927. if ( dest.nodeType !== 1 ) {
  13928. return;
  13929. }
  13930. // 1. Copy private data: events, handlers, etc.
  13931. if ( dataPriv.hasData( src ) ) {
  13932. pdataOld = dataPriv.access( src );
  13933. pdataCur = dataPriv.set( dest, pdataOld );
  13934. events = pdataOld.events;
  13935. if ( events ) {
  13936. delete pdataCur.handle;
  13937. pdataCur.events = {};
  13938. for ( type in events ) {
  13939. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13940. jQuery.event.add( dest, type, events[ type ][ i ] );
  13941. }
  13942. }
  13943. }
  13944. }
  13945. // 2. Copy user data
  13946. if ( dataUser.hasData( src ) ) {
  13947. udataOld = dataUser.access( src );
  13948. udataCur = jQuery.extend( {}, udataOld );
  13949. dataUser.set( dest, udataCur );
  13950. }
  13951. }
  13952. // Fix IE bugs, see support tests
  13953. function fixInput( src, dest ) {
  13954. var nodeName = dest.nodeName.toLowerCase();
  13955. // Fails to persist the checked state of a cloned checkbox or radio button.
  13956. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13957. dest.checked = src.checked;
  13958. // Fails to return the selected option to the default selected state when cloning options
  13959. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13960. dest.defaultValue = src.defaultValue;
  13961. }
  13962. }
  13963. function domManip( collection, args, callback, ignored ) {
  13964. // Flatten any nested arrays
  13965. args = concat.apply( [], args );
  13966. var fragment, first, scripts, hasScripts, node, doc,
  13967. i = 0,
  13968. l = collection.length,
  13969. iNoClone = l - 1,
  13970. value = args[ 0 ],
  13971. valueIsFunction = isFunction( value );
  13972. // We can't cloneNode fragments that contain checked, in WebKit
  13973. if ( valueIsFunction ||
  13974. ( l > 1 && typeof value === "string" &&
  13975. !support.checkClone && rchecked.test( value ) ) ) {
  13976. return collection.each( function( index ) {
  13977. var self = collection.eq( index );
  13978. if ( valueIsFunction ) {
  13979. args[ 0 ] = value.call( this, index, self.html() );
  13980. }
  13981. domManip( self, args, callback, ignored );
  13982. } );
  13983. }
  13984. if ( l ) {
  13985. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13986. first = fragment.firstChild;
  13987. if ( fragment.childNodes.length === 1 ) {
  13988. fragment = first;
  13989. }
  13990. // Require either new content or an interest in ignored elements to invoke the callback
  13991. if ( first || ignored ) {
  13992. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13993. hasScripts = scripts.length;
  13994. // Use the original fragment for the last item
  13995. // instead of the first because it can end up
  13996. // being emptied incorrectly in certain situations (#8070).
  13997. for ( ; i < l; i++ ) {
  13998. node = fragment;
  13999. if ( i !== iNoClone ) {
  14000. node = jQuery.clone( node, true, true );
  14001. // Keep references to cloned scripts for later restoration
  14002. if ( hasScripts ) {
  14003. // Support: Android <=4.0 only, PhantomJS 1 only
  14004. // push.apply(_, arraylike) throws on ancient WebKit
  14005. jQuery.merge( scripts, getAll( node, "script" ) );
  14006. }
  14007. }
  14008. callback.call( collection[ i ], node, i );
  14009. }
  14010. if ( hasScripts ) {
  14011. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14012. // Reenable scripts
  14013. jQuery.map( scripts, restoreScript );
  14014. // Evaluate executable scripts on first document insertion
  14015. for ( i = 0; i < hasScripts; i++ ) {
  14016. node = scripts[ i ];
  14017. if ( rscriptType.test( node.type || "" ) &&
  14018. !dataPriv.access( node, "globalEval" ) &&
  14019. jQuery.contains( doc, node ) ) {
  14020. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14021. // Optional AJAX dependency, but won't run scripts if not present
  14022. if ( jQuery._evalUrl && !node.noModule ) {
  14023. jQuery._evalUrl( node.src, {
  14024. nonce: node.nonce || node.getAttribute( "nonce" )
  14025. } );
  14026. }
  14027. } else {
  14028. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14029. }
  14030. }
  14031. }
  14032. }
  14033. }
  14034. }
  14035. return collection;
  14036. }
  14037. function remove( elem, selector, keepData ) {
  14038. var node,
  14039. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14040. i = 0;
  14041. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14042. if ( !keepData && node.nodeType === 1 ) {
  14043. jQuery.cleanData( getAll( node ) );
  14044. }
  14045. if ( node.parentNode ) {
  14046. if ( keepData && isAttached( node ) ) {
  14047. setGlobalEval( getAll( node, "script" ) );
  14048. }
  14049. node.parentNode.removeChild( node );
  14050. }
  14051. }
  14052. return elem;
  14053. }
  14054. jQuery.extend( {
  14055. htmlPrefilter: function( html ) {
  14056. return html.replace( rxhtmlTag, "<$1></$2>" );
  14057. },
  14058. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14059. var i, l, srcElements, destElements,
  14060. clone = elem.cloneNode( true ),
  14061. inPage = isAttached( elem );
  14062. // Fix IE cloning issues
  14063. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14064. !jQuery.isXMLDoc( elem ) ) {
  14065. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14066. destElements = getAll( clone );
  14067. srcElements = getAll( elem );
  14068. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14069. fixInput( srcElements[ i ], destElements[ i ] );
  14070. }
  14071. }
  14072. // Copy the events from the original to the clone
  14073. if ( dataAndEvents ) {
  14074. if ( deepDataAndEvents ) {
  14075. srcElements = srcElements || getAll( elem );
  14076. destElements = destElements || getAll( clone );
  14077. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14078. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14079. }
  14080. } else {
  14081. cloneCopyEvent( elem, clone );
  14082. }
  14083. }
  14084. // Preserve script evaluation history
  14085. destElements = getAll( clone, "script" );
  14086. if ( destElements.length > 0 ) {
  14087. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14088. }
  14089. // Return the cloned set
  14090. return clone;
  14091. },
  14092. cleanData: function( elems ) {
  14093. var data, elem, type,
  14094. special = jQuery.event.special,
  14095. i = 0;
  14096. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14097. if ( acceptData( elem ) ) {
  14098. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14099. if ( data.events ) {
  14100. for ( type in data.events ) {
  14101. if ( special[ type ] ) {
  14102. jQuery.event.remove( elem, type );
  14103. // This is a shortcut to avoid jQuery.event.remove's overhead
  14104. } else {
  14105. jQuery.removeEvent( elem, type, data.handle );
  14106. }
  14107. }
  14108. }
  14109. // Support: Chrome <=35 - 45+
  14110. // Assign undefined instead of using delete, see Data#remove
  14111. elem[ dataPriv.expando ] = undefined;
  14112. }
  14113. if ( elem[ dataUser.expando ] ) {
  14114. // Support: Chrome <=35 - 45+
  14115. // Assign undefined instead of using delete, see Data#remove
  14116. elem[ dataUser.expando ] = undefined;
  14117. }
  14118. }
  14119. }
  14120. }
  14121. } );
  14122. jQuery.fn.extend( {
  14123. detach: function( selector ) {
  14124. return remove( this, selector, true );
  14125. },
  14126. remove: function( selector ) {
  14127. return remove( this, selector );
  14128. },
  14129. text: function( value ) {
  14130. return access( this, function( value ) {
  14131. return value === undefined ?
  14132. jQuery.text( this ) :
  14133. this.empty().each( function() {
  14134. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14135. this.textContent = value;
  14136. }
  14137. } );
  14138. }, null, value, arguments.length );
  14139. },
  14140. append: function() {
  14141. return domManip( this, arguments, function( elem ) {
  14142. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14143. var target = manipulationTarget( this, elem );
  14144. target.appendChild( elem );
  14145. }
  14146. } );
  14147. },
  14148. prepend: function() {
  14149. return domManip( this, arguments, function( elem ) {
  14150. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14151. var target = manipulationTarget( this, elem );
  14152. target.insertBefore( elem, target.firstChild );
  14153. }
  14154. } );
  14155. },
  14156. before: function() {
  14157. return domManip( this, arguments, function( elem ) {
  14158. if ( this.parentNode ) {
  14159. this.parentNode.insertBefore( elem, this );
  14160. }
  14161. } );
  14162. },
  14163. after: function() {
  14164. return domManip( this, arguments, function( elem ) {
  14165. if ( this.parentNode ) {
  14166. this.parentNode.insertBefore( elem, this.nextSibling );
  14167. }
  14168. } );
  14169. },
  14170. empty: function() {
  14171. var elem,
  14172. i = 0;
  14173. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14174. if ( elem.nodeType === 1 ) {
  14175. // Prevent memory leaks
  14176. jQuery.cleanData( getAll( elem, false ) );
  14177. // Remove any remaining nodes
  14178. elem.textContent = "";
  14179. }
  14180. }
  14181. return this;
  14182. },
  14183. clone: function( dataAndEvents, deepDataAndEvents ) {
  14184. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14185. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14186. return this.map( function() {
  14187. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14188. } );
  14189. },
  14190. html: function( value ) {
  14191. return access( this, function( value ) {
  14192. var elem = this[ 0 ] || {},
  14193. i = 0,
  14194. l = this.length;
  14195. if ( value === undefined && elem.nodeType === 1 ) {
  14196. return elem.innerHTML;
  14197. }
  14198. // See if we can take a shortcut and just use innerHTML
  14199. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14200. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14201. value = jQuery.htmlPrefilter( value );
  14202. try {
  14203. for ( ; i < l; i++ ) {
  14204. elem = this[ i ] || {};
  14205. // Remove element nodes and prevent memory leaks
  14206. if ( elem.nodeType === 1 ) {
  14207. jQuery.cleanData( getAll( elem, false ) );
  14208. elem.innerHTML = value;
  14209. }
  14210. }
  14211. elem = 0;
  14212. // If using innerHTML throws an exception, use the fallback method
  14213. } catch ( e ) {}
  14214. }
  14215. if ( elem ) {
  14216. this.empty().append( value );
  14217. }
  14218. }, null, value, arguments.length );
  14219. },
  14220. replaceWith: function() {
  14221. var ignored = [];
  14222. // Make the changes, replacing each non-ignored context element with the new content
  14223. return domManip( this, arguments, function( elem ) {
  14224. var parent = this.parentNode;
  14225. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14226. jQuery.cleanData( getAll( this ) );
  14227. if ( parent ) {
  14228. parent.replaceChild( elem, this );
  14229. }
  14230. }
  14231. // Force callback invocation
  14232. }, ignored );
  14233. }
  14234. } );
  14235. jQuery.each( {
  14236. appendTo: "append",
  14237. prependTo: "prepend",
  14238. insertBefore: "before",
  14239. insertAfter: "after",
  14240. replaceAll: "replaceWith"
  14241. }, function( name, original ) {
  14242. jQuery.fn[ name ] = function( selector ) {
  14243. var elems,
  14244. ret = [],
  14245. insert = jQuery( selector ),
  14246. last = insert.length - 1,
  14247. i = 0;
  14248. for ( ; i <= last; i++ ) {
  14249. elems = i === last ? this : this.clone( true );
  14250. jQuery( insert[ i ] )[ original ]( elems );
  14251. // Support: Android <=4.0 only, PhantomJS 1 only
  14252. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14253. push.apply( ret, elems.get() );
  14254. }
  14255. return this.pushStack( ret );
  14256. };
  14257. } );
  14258. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14259. var getStyles = function( elem ) {
  14260. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14261. // IE throws on elements created in popups
  14262. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14263. var view = elem.ownerDocument.defaultView;
  14264. if ( !view || !view.opener ) {
  14265. view = window;
  14266. }
  14267. return view.getComputedStyle( elem );
  14268. };
  14269. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14270. ( function() {
  14271. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14272. // so they're executed at the same time to save the second computation.
  14273. function computeStyleTests() {
  14274. // This is a singleton, we need to execute it only once
  14275. if ( !div ) {
  14276. return;
  14277. }
  14278. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14279. "margin-top:1px;padding:0;border:0";
  14280. div.style.cssText =
  14281. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14282. "margin:auto;border:1px;padding:1px;" +
  14283. "width:60%;top:1%";
  14284. documentElement.appendChild( container ).appendChild( div );
  14285. var divStyle = window.getComputedStyle( div );
  14286. pixelPositionVal = divStyle.top !== "1%";
  14287. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14288. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14289. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14290. // Some styles come back with percentage values, even though they shouldn't
  14291. div.style.right = "60%";
  14292. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14293. // Support: IE 9 - 11 only
  14294. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14295. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14296. // Support: IE 9 only
  14297. // Detect overflow:scroll screwiness (gh-3699)
  14298. // Support: Chrome <=64
  14299. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14300. div.style.position = "absolute";
  14301. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14302. documentElement.removeChild( container );
  14303. // Nullify the div so it wouldn't be stored in the memory and
  14304. // it will also be a sign that checks already performed
  14305. div = null;
  14306. }
  14307. function roundPixelMeasures( measure ) {
  14308. return Math.round( parseFloat( measure ) );
  14309. }
  14310. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14311. reliableMarginLeftVal,
  14312. container = document.createElement( "div" ),
  14313. div = document.createElement( "div" );
  14314. // Finish early in limited (non-browser) environments
  14315. if ( !div.style ) {
  14316. return;
  14317. }
  14318. // Support: IE <=9 - 11 only
  14319. // Style of cloned element affects source element cloned (#8908)
  14320. div.style.backgroundClip = "content-box";
  14321. div.cloneNode( true ).style.backgroundClip = "";
  14322. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14323. jQuery.extend( support, {
  14324. boxSizingReliable: function() {
  14325. computeStyleTests();
  14326. return boxSizingReliableVal;
  14327. },
  14328. pixelBoxStyles: function() {
  14329. computeStyleTests();
  14330. return pixelBoxStylesVal;
  14331. },
  14332. pixelPosition: function() {
  14333. computeStyleTests();
  14334. return pixelPositionVal;
  14335. },
  14336. reliableMarginLeft: function() {
  14337. computeStyleTests();
  14338. return reliableMarginLeftVal;
  14339. },
  14340. scrollboxSize: function() {
  14341. computeStyleTests();
  14342. return scrollboxSizeVal;
  14343. }
  14344. } );
  14345. } )();
  14346. function curCSS( elem, name, computed ) {
  14347. var width, minWidth, maxWidth, ret,
  14348. // Support: Firefox 51+
  14349. // Retrieving style before computed somehow
  14350. // fixes an issue with getting wrong values
  14351. // on detached elements
  14352. style = elem.style;
  14353. computed = computed || getStyles( elem );
  14354. // getPropertyValue is needed for:
  14355. // .css('filter') (IE 9 only, #12537)
  14356. // .css('--customProperty) (#3144)
  14357. if ( computed ) {
  14358. ret = computed.getPropertyValue( name ) || computed[ name ];
  14359. if ( ret === "" && !isAttached( elem ) ) {
  14360. ret = jQuery.style( elem, name );
  14361. }
  14362. // A tribute to the "awesome hack by Dean Edwards"
  14363. // Android Browser returns percentage for some values,
  14364. // but width seems to be reliably pixels.
  14365. // This is against the CSSOM draft spec:
  14366. // https://drafts.csswg.org/cssom/#resolved-values
  14367. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14368. // Remember the original values
  14369. width = style.width;
  14370. minWidth = style.minWidth;
  14371. maxWidth = style.maxWidth;
  14372. // Put in the new values to get a computed value out
  14373. style.minWidth = style.maxWidth = style.width = ret;
  14374. ret = computed.width;
  14375. // Revert the changed values
  14376. style.width = width;
  14377. style.minWidth = minWidth;
  14378. style.maxWidth = maxWidth;
  14379. }
  14380. }
  14381. return ret !== undefined ?
  14382. // Support: IE <=9 - 11 only
  14383. // IE returns zIndex value as an integer.
  14384. ret + "" :
  14385. ret;
  14386. }
  14387. function addGetHookIf( conditionFn, hookFn ) {
  14388. // Define the hook, we'll check on the first run if it's really needed.
  14389. return {
  14390. get: function() {
  14391. if ( conditionFn() ) {
  14392. // Hook not needed (or it's not possible to use it due
  14393. // to missing dependency), remove it.
  14394. delete this.get;
  14395. return;
  14396. }
  14397. // Hook needed; redefine it so that the support test is not executed again.
  14398. return ( this.get = hookFn ).apply( this, arguments );
  14399. }
  14400. };
  14401. }
  14402. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14403. emptyStyle = document.createElement( "div" ).style,
  14404. vendorProps = {};
  14405. // Return a vendor-prefixed property or undefined
  14406. function vendorPropName( name ) {
  14407. // Check for vendor prefixed names
  14408. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14409. i = cssPrefixes.length;
  14410. while ( i-- ) {
  14411. name = cssPrefixes[ i ] + capName;
  14412. if ( name in emptyStyle ) {
  14413. return name;
  14414. }
  14415. }
  14416. }
  14417. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14418. function finalPropName( name ) {
  14419. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14420. if ( final ) {
  14421. return final;
  14422. }
  14423. if ( name in emptyStyle ) {
  14424. return name;
  14425. }
  14426. return vendorProps[ name ] = vendorPropName( name ) || name;
  14427. }
  14428. var
  14429. // Swappable if display is none or starts with table
  14430. // except "table", "table-cell", or "table-caption"
  14431. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14432. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14433. rcustomProp = /^--/,
  14434. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14435. cssNormalTransform = {
  14436. letterSpacing: "0",
  14437. fontWeight: "400"
  14438. };
  14439. function setPositiveNumber( elem, value, subtract ) {
  14440. // Any relative (+/-) values have already been
  14441. // normalized at this point
  14442. var matches = rcssNum.exec( value );
  14443. return matches ?
  14444. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14445. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14446. value;
  14447. }
  14448. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14449. var i = dimension === "width" ? 1 : 0,
  14450. extra = 0,
  14451. delta = 0;
  14452. // Adjustment may not be necessary
  14453. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14454. return 0;
  14455. }
  14456. for ( ; i < 4; i += 2 ) {
  14457. // Both box models exclude margin
  14458. if ( box === "margin" ) {
  14459. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14460. }
  14461. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14462. if ( !isBorderBox ) {
  14463. // Add padding
  14464. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14465. // For "border" or "margin", add border
  14466. if ( box !== "padding" ) {
  14467. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14468. // But still keep track of it otherwise
  14469. } else {
  14470. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14471. }
  14472. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14473. // "padding" or "margin"
  14474. } else {
  14475. // For "content", subtract padding
  14476. if ( box === "content" ) {
  14477. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14478. }
  14479. // For "content" or "padding", subtract border
  14480. if ( box !== "margin" ) {
  14481. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14482. }
  14483. }
  14484. }
  14485. // Account for positive content-box scroll gutter when requested by providing computedVal
  14486. if ( !isBorderBox && computedVal >= 0 ) {
  14487. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14488. // Assuming integer scroll gutter, subtract the rest and round down
  14489. delta += Math.max( 0, Math.ceil(
  14490. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14491. computedVal -
  14492. delta -
  14493. extra -
  14494. 0.5
  14495. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14496. // Use an explicit zero to avoid NaN (gh-3964)
  14497. ) ) || 0;
  14498. }
  14499. return delta;
  14500. }
  14501. function getWidthOrHeight( elem, dimension, extra ) {
  14502. // Start with computed style
  14503. var styles = getStyles( elem ),
  14504. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14505. // Fake content-box until we know it's needed to know the true value.
  14506. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14507. isBorderBox = boxSizingNeeded &&
  14508. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14509. valueIsBorderBox = isBorderBox,
  14510. val = curCSS( elem, dimension, styles ),
  14511. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14512. // Support: Firefox <=54
  14513. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14514. if ( rnumnonpx.test( val ) ) {
  14515. if ( !extra ) {
  14516. return val;
  14517. }
  14518. val = "auto";
  14519. }
  14520. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14521. // This happens for inline elements with no explicit setting (gh-3571)
  14522. // Support: Android <=4.1 - 4.3 only
  14523. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14524. // Support: IE 9-11 only
  14525. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14526. // We use getClientRects() to check for hidden/disconnected.
  14527. // In those cases, the computed value can be trusted to be border-box
  14528. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14529. val === "auto" ||
  14530. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14531. elem.getClientRects().length ) {
  14532. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14533. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14534. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14535. // retrieved value as a content box dimension.
  14536. valueIsBorderBox = offsetProp in elem;
  14537. if ( valueIsBorderBox ) {
  14538. val = elem[ offsetProp ];
  14539. }
  14540. }
  14541. // Normalize "" and auto
  14542. val = parseFloat( val ) || 0;
  14543. // Adjust for the element's box model
  14544. return ( val +
  14545. boxModelAdjustment(
  14546. elem,
  14547. dimension,
  14548. extra || ( isBorderBox ? "border" : "content" ),
  14549. valueIsBorderBox,
  14550. styles,
  14551. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14552. val
  14553. )
  14554. ) + "px";
  14555. }
  14556. jQuery.extend( {
  14557. // Add in style property hooks for overriding the default
  14558. // behavior of getting and setting a style property
  14559. cssHooks: {
  14560. opacity: {
  14561. get: function( elem, computed ) {
  14562. if ( computed ) {
  14563. // We should always get a number back from opacity
  14564. var ret = curCSS( elem, "opacity" );
  14565. return ret === "" ? "1" : ret;
  14566. }
  14567. }
  14568. }
  14569. },
  14570. // Don't automatically add "px" to these possibly-unitless properties
  14571. cssNumber: {
  14572. "animationIterationCount": true,
  14573. "columnCount": true,
  14574. "fillOpacity": true,
  14575. "flexGrow": true,
  14576. "flexShrink": true,
  14577. "fontWeight": true,
  14578. "gridArea": true,
  14579. "gridColumn": true,
  14580. "gridColumnEnd": true,
  14581. "gridColumnStart": true,
  14582. "gridRow": true,
  14583. "gridRowEnd": true,
  14584. "gridRowStart": true,
  14585. "lineHeight": true,
  14586. "opacity": true,
  14587. "order": true,
  14588. "orphans": true,
  14589. "widows": true,
  14590. "zIndex": true,
  14591. "zoom": true
  14592. },
  14593. // Add in properties whose names you wish to fix before
  14594. // setting or getting the value
  14595. cssProps: {},
  14596. // Get and set the style property on a DOM Node
  14597. style: function( elem, name, value, extra ) {
  14598. // Don't set styles on text and comment nodes
  14599. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14600. return;
  14601. }
  14602. // Make sure that we're working with the right name
  14603. var ret, type, hooks,
  14604. origName = camelCase( name ),
  14605. isCustomProp = rcustomProp.test( name ),
  14606. style = elem.style;
  14607. // Make sure that we're working with the right name. We don't
  14608. // want to query the value if it is a CSS custom property
  14609. // since they are user-defined.
  14610. if ( !isCustomProp ) {
  14611. name = finalPropName( origName );
  14612. }
  14613. // Gets hook for the prefixed version, then unprefixed version
  14614. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14615. // Check if we're setting a value
  14616. if ( value !== undefined ) {
  14617. type = typeof value;
  14618. // Convert "+=" or "-=" to relative numbers (#7345)
  14619. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14620. value = adjustCSS( elem, name, ret );
  14621. // Fixes bug #9237
  14622. type = "number";
  14623. }
  14624. // Make sure that null and NaN values aren't set (#7116)
  14625. if ( value == null || value !== value ) {
  14626. return;
  14627. }
  14628. // If a number was passed in, add the unit (except for certain CSS properties)
  14629. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14630. // "px" to a few hardcoded values.
  14631. if ( type === "number" && !isCustomProp ) {
  14632. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14633. }
  14634. // background-* props affect original clone's values
  14635. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14636. style[ name ] = "inherit";
  14637. }
  14638. // If a hook was provided, use that value, otherwise just set the specified value
  14639. if ( !hooks || !( "set" in hooks ) ||
  14640. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14641. if ( isCustomProp ) {
  14642. style.setProperty( name, value );
  14643. } else {
  14644. style[ name ] = value;
  14645. }
  14646. }
  14647. } else {
  14648. // If a hook was provided get the non-computed value from there
  14649. if ( hooks && "get" in hooks &&
  14650. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14651. return ret;
  14652. }
  14653. // Otherwise just get the value from the style object
  14654. return style[ name ];
  14655. }
  14656. },
  14657. css: function( elem, name, extra, styles ) {
  14658. var val, num, hooks,
  14659. origName = camelCase( name ),
  14660. isCustomProp = rcustomProp.test( name );
  14661. // Make sure that we're working with the right name. We don't
  14662. // want to modify the value if it is a CSS custom property
  14663. // since they are user-defined.
  14664. if ( !isCustomProp ) {
  14665. name = finalPropName( origName );
  14666. }
  14667. // Try prefixed name followed by the unprefixed name
  14668. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14669. // If a hook was provided get the computed value from there
  14670. if ( hooks && "get" in hooks ) {
  14671. val = hooks.get( elem, true, extra );
  14672. }
  14673. // Otherwise, if a way to get the computed value exists, use that
  14674. if ( val === undefined ) {
  14675. val = curCSS( elem, name, styles );
  14676. }
  14677. // Convert "normal" to computed value
  14678. if ( val === "normal" && name in cssNormalTransform ) {
  14679. val = cssNormalTransform[ name ];
  14680. }
  14681. // Make numeric if forced or a qualifier was provided and val looks numeric
  14682. if ( extra === "" || extra ) {
  14683. num = parseFloat( val );
  14684. return extra === true || isFinite( num ) ? num || 0 : val;
  14685. }
  14686. return val;
  14687. }
  14688. } );
  14689. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14690. jQuery.cssHooks[ dimension ] = {
  14691. get: function( elem, computed, extra ) {
  14692. if ( computed ) {
  14693. // Certain elements can have dimension info if we invisibly show them
  14694. // but it must have a current display style that would benefit
  14695. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14696. // Support: Safari 8+
  14697. // Table columns in Safari have non-zero offsetWidth & zero
  14698. // getBoundingClientRect().width unless display is changed.
  14699. // Support: IE <=11 only
  14700. // Running getBoundingClientRect on a disconnected node
  14701. // in IE throws an error.
  14702. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14703. swap( elem, cssShow, function() {
  14704. return getWidthOrHeight( elem, dimension, extra );
  14705. } ) :
  14706. getWidthOrHeight( elem, dimension, extra );
  14707. }
  14708. },
  14709. set: function( elem, value, extra ) {
  14710. var matches,
  14711. styles = getStyles( elem ),
  14712. // Only read styles.position if the test has a chance to fail
  14713. // to avoid forcing a reflow.
  14714. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14715. styles.position === "absolute",
  14716. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14717. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14718. isBorderBox = boxSizingNeeded &&
  14719. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14720. subtract = extra ?
  14721. boxModelAdjustment(
  14722. elem,
  14723. dimension,
  14724. extra,
  14725. isBorderBox,
  14726. styles
  14727. ) :
  14728. 0;
  14729. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14730. // faking a content-box to get border and padding (gh-3699)
  14731. if ( isBorderBox && scrollboxSizeBuggy ) {
  14732. subtract -= Math.ceil(
  14733. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14734. parseFloat( styles[ dimension ] ) -
  14735. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14736. 0.5
  14737. );
  14738. }
  14739. // Convert to pixels if value adjustment is needed
  14740. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14741. ( matches[ 3 ] || "px" ) !== "px" ) {
  14742. elem.style[ dimension ] = value;
  14743. value = jQuery.css( elem, dimension );
  14744. }
  14745. return setPositiveNumber( elem, value, subtract );
  14746. }
  14747. };
  14748. } );
  14749. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14750. function( elem, computed ) {
  14751. if ( computed ) {
  14752. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14753. elem.getBoundingClientRect().left -
  14754. swap( elem, { marginLeft: 0 }, function() {
  14755. return elem.getBoundingClientRect().left;
  14756. } )
  14757. ) + "px";
  14758. }
  14759. }
  14760. );
  14761. // These hooks are used by animate to expand properties
  14762. jQuery.each( {
  14763. margin: "",
  14764. padding: "",
  14765. border: "Width"
  14766. }, function( prefix, suffix ) {
  14767. jQuery.cssHooks[ prefix + suffix ] = {
  14768. expand: function( value ) {
  14769. var i = 0,
  14770. expanded = {},
  14771. // Assumes a single number if not a string
  14772. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14773. for ( ; i < 4; i++ ) {
  14774. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14775. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14776. }
  14777. return expanded;
  14778. }
  14779. };
  14780. if ( prefix !== "margin" ) {
  14781. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14782. }
  14783. } );
  14784. jQuery.fn.extend( {
  14785. css: function( name, value ) {
  14786. return access( this, function( elem, name, value ) {
  14787. var styles, len,
  14788. map = {},
  14789. i = 0;
  14790. if ( Array.isArray( name ) ) {
  14791. styles = getStyles( elem );
  14792. len = name.length;
  14793. for ( ; i < len; i++ ) {
  14794. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14795. }
  14796. return map;
  14797. }
  14798. return value !== undefined ?
  14799. jQuery.style( elem, name, value ) :
  14800. jQuery.css( elem, name );
  14801. }, name, value, arguments.length > 1 );
  14802. }
  14803. } );
  14804. function Tween( elem, options, prop, end, easing ) {
  14805. return new Tween.prototype.init( elem, options, prop, end, easing );
  14806. }
  14807. jQuery.Tween = Tween;
  14808. Tween.prototype = {
  14809. constructor: Tween,
  14810. init: function( elem, options, prop, end, easing, unit ) {
  14811. this.elem = elem;
  14812. this.prop = prop;
  14813. this.easing = easing || jQuery.easing._default;
  14814. this.options = options;
  14815. this.start = this.now = this.cur();
  14816. this.end = end;
  14817. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14818. },
  14819. cur: function() {
  14820. var hooks = Tween.propHooks[ this.prop ];
  14821. return hooks && hooks.get ?
  14822. hooks.get( this ) :
  14823. Tween.propHooks._default.get( this );
  14824. },
  14825. run: function( percent ) {
  14826. var eased,
  14827. hooks = Tween.propHooks[ this.prop ];
  14828. if ( this.options.duration ) {
  14829. this.pos = eased = jQuery.easing[ this.easing ](
  14830. percent, this.options.duration * percent, 0, 1, this.options.duration
  14831. );
  14832. } else {
  14833. this.pos = eased = percent;
  14834. }
  14835. this.now = ( this.end - this.start ) * eased + this.start;
  14836. if ( this.options.step ) {
  14837. this.options.step.call( this.elem, this.now, this );
  14838. }
  14839. if ( hooks && hooks.set ) {
  14840. hooks.set( this );
  14841. } else {
  14842. Tween.propHooks._default.set( this );
  14843. }
  14844. return this;
  14845. }
  14846. };
  14847. Tween.prototype.init.prototype = Tween.prototype;
  14848. Tween.propHooks = {
  14849. _default: {
  14850. get: function( tween ) {
  14851. var result;
  14852. // Use a property on the element directly when it is not a DOM element,
  14853. // or when there is no matching style property that exists.
  14854. if ( tween.elem.nodeType !== 1 ||
  14855. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14856. return tween.elem[ tween.prop ];
  14857. }
  14858. // Passing an empty string as a 3rd parameter to .css will automatically
  14859. // attempt a parseFloat and fallback to a string if the parse fails.
  14860. // Simple values such as "10px" are parsed to Float;
  14861. // complex values such as "rotate(1rad)" are returned as-is.
  14862. result = jQuery.css( tween.elem, tween.prop, "" );
  14863. // Empty strings, null, undefined and "auto" are converted to 0.
  14864. return !result || result === "auto" ? 0 : result;
  14865. },
  14866. set: function( tween ) {
  14867. // Use step hook for back compat.
  14868. // Use cssHook if its there.
  14869. // Use .style if available and use plain properties where available.
  14870. if ( jQuery.fx.step[ tween.prop ] ) {
  14871. jQuery.fx.step[ tween.prop ]( tween );
  14872. } else if ( tween.elem.nodeType === 1 && (
  14873. jQuery.cssHooks[ tween.prop ] ||
  14874. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14875. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14876. } else {
  14877. tween.elem[ tween.prop ] = tween.now;
  14878. }
  14879. }
  14880. }
  14881. };
  14882. // Support: IE <=9 only
  14883. // Panic based approach to setting things on disconnected nodes
  14884. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14885. set: function( tween ) {
  14886. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14887. tween.elem[ tween.prop ] = tween.now;
  14888. }
  14889. }
  14890. };
  14891. jQuery.easing = {
  14892. linear: function( p ) {
  14893. return p;
  14894. },
  14895. swing: function( p ) {
  14896. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14897. },
  14898. _default: "swing"
  14899. };
  14900. jQuery.fx = Tween.prototype.init;
  14901. // Back compat <1.8 extension point
  14902. jQuery.fx.step = {};
  14903. var
  14904. fxNow, inProgress,
  14905. rfxtypes = /^(?:toggle|show|hide)$/,
  14906. rrun = /queueHooks$/;
  14907. function schedule() {
  14908. if ( inProgress ) {
  14909. if ( document.hidden === false && window.requestAnimationFrame ) {
  14910. window.requestAnimationFrame( schedule );
  14911. } else {
  14912. window.setTimeout( schedule, jQuery.fx.interval );
  14913. }
  14914. jQuery.fx.tick();
  14915. }
  14916. }
  14917. // Animations created synchronously will run synchronously
  14918. function createFxNow() {
  14919. window.setTimeout( function() {
  14920. fxNow = undefined;
  14921. } );
  14922. return ( fxNow = Date.now() );
  14923. }
  14924. // Generate parameters to create a standard animation
  14925. function genFx( type, includeWidth ) {
  14926. var which,
  14927. i = 0,
  14928. attrs = { height: type };
  14929. // If we include width, step value is 1 to do all cssExpand values,
  14930. // otherwise step value is 2 to skip over Left and Right
  14931. includeWidth = includeWidth ? 1 : 0;
  14932. for ( ; i < 4; i += 2 - includeWidth ) {
  14933. which = cssExpand[ i ];
  14934. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14935. }
  14936. if ( includeWidth ) {
  14937. attrs.opacity = attrs.width = type;
  14938. }
  14939. return attrs;
  14940. }
  14941. function createTween( value, prop, animation ) {
  14942. var tween,
  14943. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14944. index = 0,
  14945. length = collection.length;
  14946. for ( ; index < length; index++ ) {
  14947. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14948. // We're done with this property
  14949. return tween;
  14950. }
  14951. }
  14952. }
  14953. function defaultPrefilter( elem, props, opts ) {
  14954. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14955. isBox = "width" in props || "height" in props,
  14956. anim = this,
  14957. orig = {},
  14958. style = elem.style,
  14959. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14960. dataShow = dataPriv.get( elem, "fxshow" );
  14961. // Queue-skipping animations hijack the fx hooks
  14962. if ( !opts.queue ) {
  14963. hooks = jQuery._queueHooks( elem, "fx" );
  14964. if ( hooks.unqueued == null ) {
  14965. hooks.unqueued = 0;
  14966. oldfire = hooks.empty.fire;
  14967. hooks.empty.fire = function() {
  14968. if ( !hooks.unqueued ) {
  14969. oldfire();
  14970. }
  14971. };
  14972. }
  14973. hooks.unqueued++;
  14974. anim.always( function() {
  14975. // Ensure the complete handler is called before this completes
  14976. anim.always( function() {
  14977. hooks.unqueued--;
  14978. if ( !jQuery.queue( elem, "fx" ).length ) {
  14979. hooks.empty.fire();
  14980. }
  14981. } );
  14982. } );
  14983. }
  14984. // Detect show/hide animations
  14985. for ( prop in props ) {
  14986. value = props[ prop ];
  14987. if ( rfxtypes.test( value ) ) {
  14988. delete props[ prop ];
  14989. toggle = toggle || value === "toggle";
  14990. if ( value === ( hidden ? "hide" : "show" ) ) {
  14991. // Pretend to be hidden if this is a "show" and
  14992. // there is still data from a stopped show/hide
  14993. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14994. hidden = true;
  14995. // Ignore all other no-op show/hide data
  14996. } else {
  14997. continue;
  14998. }
  14999. }
  15000. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15001. }
  15002. }
  15003. // Bail out if this is a no-op like .hide().hide()
  15004. propTween = !jQuery.isEmptyObject( props );
  15005. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15006. return;
  15007. }
  15008. // Restrict "overflow" and "display" styles during box animations
  15009. if ( isBox && elem.nodeType === 1 ) {
  15010. // Support: IE <=9 - 11, Edge 12 - 15
  15011. // Record all 3 overflow attributes because IE does not infer the shorthand
  15012. // from identically-valued overflowX and overflowY and Edge just mirrors
  15013. // the overflowX value there.
  15014. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15015. // Identify a display type, preferring old show/hide data over the CSS cascade
  15016. restoreDisplay = dataShow && dataShow.display;
  15017. if ( restoreDisplay == null ) {
  15018. restoreDisplay = dataPriv.get( elem, "display" );
  15019. }
  15020. display = jQuery.css( elem, "display" );
  15021. if ( display === "none" ) {
  15022. if ( restoreDisplay ) {
  15023. display = restoreDisplay;
  15024. } else {
  15025. // Get nonempty value(s) by temporarily forcing visibility
  15026. showHide( [ elem ], true );
  15027. restoreDisplay = elem.style.display || restoreDisplay;
  15028. display = jQuery.css( elem, "display" );
  15029. showHide( [ elem ] );
  15030. }
  15031. }
  15032. // Animate inline elements as inline-block
  15033. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15034. if ( jQuery.css( elem, "float" ) === "none" ) {
  15035. // Restore the original display value at the end of pure show/hide animations
  15036. if ( !propTween ) {
  15037. anim.done( function() {
  15038. style.display = restoreDisplay;
  15039. } );
  15040. if ( restoreDisplay == null ) {
  15041. display = style.display;
  15042. restoreDisplay = display === "none" ? "" : display;
  15043. }
  15044. }
  15045. style.display = "inline-block";
  15046. }
  15047. }
  15048. }
  15049. if ( opts.overflow ) {
  15050. style.overflow = "hidden";
  15051. anim.always( function() {
  15052. style.overflow = opts.overflow[ 0 ];
  15053. style.overflowX = opts.overflow[ 1 ];
  15054. style.overflowY = opts.overflow[ 2 ];
  15055. } );
  15056. }
  15057. // Implement show/hide animations
  15058. propTween = false;
  15059. for ( prop in orig ) {
  15060. // General show/hide setup for this element animation
  15061. if ( !propTween ) {
  15062. if ( dataShow ) {
  15063. if ( "hidden" in dataShow ) {
  15064. hidden = dataShow.hidden;
  15065. }
  15066. } else {
  15067. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15068. }
  15069. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15070. if ( toggle ) {
  15071. dataShow.hidden = !hidden;
  15072. }
  15073. // Show elements before animating them
  15074. if ( hidden ) {
  15075. showHide( [ elem ], true );
  15076. }
  15077. /* eslint-disable no-loop-func */
  15078. anim.done( function() {
  15079. /* eslint-enable no-loop-func */
  15080. // The final step of a "hide" animation is actually hiding the element
  15081. if ( !hidden ) {
  15082. showHide( [ elem ] );
  15083. }
  15084. dataPriv.remove( elem, "fxshow" );
  15085. for ( prop in orig ) {
  15086. jQuery.style( elem, prop, orig[ prop ] );
  15087. }
  15088. } );
  15089. }
  15090. // Per-property setup
  15091. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15092. if ( !( prop in dataShow ) ) {
  15093. dataShow[ prop ] = propTween.start;
  15094. if ( hidden ) {
  15095. propTween.end = propTween.start;
  15096. propTween.start = 0;
  15097. }
  15098. }
  15099. }
  15100. }
  15101. function propFilter( props, specialEasing ) {
  15102. var index, name, easing, value, hooks;
  15103. // camelCase, specialEasing and expand cssHook pass
  15104. for ( index in props ) {
  15105. name = camelCase( index );
  15106. easing = specialEasing[ name ];
  15107. value = props[ index ];
  15108. if ( Array.isArray( value ) ) {
  15109. easing = value[ 1 ];
  15110. value = props[ index ] = value[ 0 ];
  15111. }
  15112. if ( index !== name ) {
  15113. props[ name ] = value;
  15114. delete props[ index ];
  15115. }
  15116. hooks = jQuery.cssHooks[ name ];
  15117. if ( hooks && "expand" in hooks ) {
  15118. value = hooks.expand( value );
  15119. delete props[ name ];
  15120. // Not quite $.extend, this won't overwrite existing keys.
  15121. // Reusing 'index' because we have the correct "name"
  15122. for ( index in value ) {
  15123. if ( !( index in props ) ) {
  15124. props[ index ] = value[ index ];
  15125. specialEasing[ index ] = easing;
  15126. }
  15127. }
  15128. } else {
  15129. specialEasing[ name ] = easing;
  15130. }
  15131. }
  15132. }
  15133. function Animation( elem, properties, options ) {
  15134. var result,
  15135. stopped,
  15136. index = 0,
  15137. length = Animation.prefilters.length,
  15138. deferred = jQuery.Deferred().always( function() {
  15139. // Don't match elem in the :animated selector
  15140. delete tick.elem;
  15141. } ),
  15142. tick = function() {
  15143. if ( stopped ) {
  15144. return false;
  15145. }
  15146. var currentTime = fxNow || createFxNow(),
  15147. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15148. // Support: Android 2.3 only
  15149. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15150. temp = remaining / animation.duration || 0,
  15151. percent = 1 - temp,
  15152. index = 0,
  15153. length = animation.tweens.length;
  15154. for ( ; index < length; index++ ) {
  15155. animation.tweens[ index ].run( percent );
  15156. }
  15157. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15158. // If there's more to do, yield
  15159. if ( percent < 1 && length ) {
  15160. return remaining;
  15161. }
  15162. // If this was an empty animation, synthesize a final progress notification
  15163. if ( !length ) {
  15164. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15165. }
  15166. // Resolve the animation and report its conclusion
  15167. deferred.resolveWith( elem, [ animation ] );
  15168. return false;
  15169. },
  15170. animation = deferred.promise( {
  15171. elem: elem,
  15172. props: jQuery.extend( {}, properties ),
  15173. opts: jQuery.extend( true, {
  15174. specialEasing: {},
  15175. easing: jQuery.easing._default
  15176. }, options ),
  15177. originalProperties: properties,
  15178. originalOptions: options,
  15179. startTime: fxNow || createFxNow(),
  15180. duration: options.duration,
  15181. tweens: [],
  15182. createTween: function( prop, end ) {
  15183. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15184. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15185. animation.tweens.push( tween );
  15186. return tween;
  15187. },
  15188. stop: function( gotoEnd ) {
  15189. var index = 0,
  15190. // If we are going to the end, we want to run all the tweens
  15191. // otherwise we skip this part
  15192. length = gotoEnd ? animation.tweens.length : 0;
  15193. if ( stopped ) {
  15194. return this;
  15195. }
  15196. stopped = true;
  15197. for ( ; index < length; index++ ) {
  15198. animation.tweens[ index ].run( 1 );
  15199. }
  15200. // Resolve when we played the last frame; otherwise, reject
  15201. if ( gotoEnd ) {
  15202. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15203. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15204. } else {
  15205. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15206. }
  15207. return this;
  15208. }
  15209. } ),
  15210. props = animation.props;
  15211. propFilter( props, animation.opts.specialEasing );
  15212. for ( ; index < length; index++ ) {
  15213. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15214. if ( result ) {
  15215. if ( isFunction( result.stop ) ) {
  15216. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15217. result.stop.bind( result );
  15218. }
  15219. return result;
  15220. }
  15221. }
  15222. jQuery.map( props, createTween, animation );
  15223. if ( isFunction( animation.opts.start ) ) {
  15224. animation.opts.start.call( elem, animation );
  15225. }
  15226. // Attach callbacks from options
  15227. animation
  15228. .progress( animation.opts.progress )
  15229. .done( animation.opts.done, animation.opts.complete )
  15230. .fail( animation.opts.fail )
  15231. .always( animation.opts.always );
  15232. jQuery.fx.timer(
  15233. jQuery.extend( tick, {
  15234. elem: elem,
  15235. anim: animation,
  15236. queue: animation.opts.queue
  15237. } )
  15238. );
  15239. return animation;
  15240. }
  15241. jQuery.Animation = jQuery.extend( Animation, {
  15242. tweeners: {
  15243. "*": [ function( prop, value ) {
  15244. var tween = this.createTween( prop, value );
  15245. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15246. return tween;
  15247. } ]
  15248. },
  15249. tweener: function( props, callback ) {
  15250. if ( isFunction( props ) ) {
  15251. callback = props;
  15252. props = [ "*" ];
  15253. } else {
  15254. props = props.match( rnothtmlwhite );
  15255. }
  15256. var prop,
  15257. index = 0,
  15258. length = props.length;
  15259. for ( ; index < length; index++ ) {
  15260. prop = props[ index ];
  15261. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15262. Animation.tweeners[ prop ].unshift( callback );
  15263. }
  15264. },
  15265. prefilters: [ defaultPrefilter ],
  15266. prefilter: function( callback, prepend ) {
  15267. if ( prepend ) {
  15268. Animation.prefilters.unshift( callback );
  15269. } else {
  15270. Animation.prefilters.push( callback );
  15271. }
  15272. }
  15273. } );
  15274. jQuery.speed = function( speed, easing, fn ) {
  15275. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15276. complete: fn || !fn && easing ||
  15277. isFunction( speed ) && speed,
  15278. duration: speed,
  15279. easing: fn && easing || easing && !isFunction( easing ) && easing
  15280. };
  15281. // Go to the end state if fx are off
  15282. if ( jQuery.fx.off ) {
  15283. opt.duration = 0;
  15284. } else {
  15285. if ( typeof opt.duration !== "number" ) {
  15286. if ( opt.duration in jQuery.fx.speeds ) {
  15287. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15288. } else {
  15289. opt.duration = jQuery.fx.speeds._default;
  15290. }
  15291. }
  15292. }
  15293. // Normalize opt.queue - true/undefined/null -> "fx"
  15294. if ( opt.queue == null || opt.queue === true ) {
  15295. opt.queue = "fx";
  15296. }
  15297. // Queueing
  15298. opt.old = opt.complete;
  15299. opt.complete = function() {
  15300. if ( isFunction( opt.old ) ) {
  15301. opt.old.call( this );
  15302. }
  15303. if ( opt.queue ) {
  15304. jQuery.dequeue( this, opt.queue );
  15305. }
  15306. };
  15307. return opt;
  15308. };
  15309. jQuery.fn.extend( {
  15310. fadeTo: function( speed, to, easing, callback ) {
  15311. // Show any hidden elements after setting opacity to 0
  15312. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15313. // Animate to the value specified
  15314. .end().animate( { opacity: to }, speed, easing, callback );
  15315. },
  15316. animate: function( prop, speed, easing, callback ) {
  15317. var empty = jQuery.isEmptyObject( prop ),
  15318. optall = jQuery.speed( speed, easing, callback ),
  15319. doAnimation = function() {
  15320. // Operate on a copy of prop so per-property easing won't be lost
  15321. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15322. // Empty animations, or finishing resolves immediately
  15323. if ( empty || dataPriv.get( this, "finish" ) ) {
  15324. anim.stop( true );
  15325. }
  15326. };
  15327. doAnimation.finish = doAnimation;
  15328. return empty || optall.queue === false ?
  15329. this.each( doAnimation ) :
  15330. this.queue( optall.queue, doAnimation );
  15331. },
  15332. stop: function( type, clearQueue, gotoEnd ) {
  15333. var stopQueue = function( hooks ) {
  15334. var stop = hooks.stop;
  15335. delete hooks.stop;
  15336. stop( gotoEnd );
  15337. };
  15338. if ( typeof type !== "string" ) {
  15339. gotoEnd = clearQueue;
  15340. clearQueue = type;
  15341. type = undefined;
  15342. }
  15343. if ( clearQueue && type !== false ) {
  15344. this.queue( type || "fx", [] );
  15345. }
  15346. return this.each( function() {
  15347. var dequeue = true,
  15348. index = type != null && type + "queueHooks",
  15349. timers = jQuery.timers,
  15350. data = dataPriv.get( this );
  15351. if ( index ) {
  15352. if ( data[ index ] && data[ index ].stop ) {
  15353. stopQueue( data[ index ] );
  15354. }
  15355. } else {
  15356. for ( index in data ) {
  15357. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15358. stopQueue( data[ index ] );
  15359. }
  15360. }
  15361. }
  15362. for ( index = timers.length; index--; ) {
  15363. if ( timers[ index ].elem === this &&
  15364. ( type == null || timers[ index ].queue === type ) ) {
  15365. timers[ index ].anim.stop( gotoEnd );
  15366. dequeue = false;
  15367. timers.splice( index, 1 );
  15368. }
  15369. }
  15370. // Start the next in the queue if the last step wasn't forced.
  15371. // Timers currently will call their complete callbacks, which
  15372. // will dequeue but only if they were gotoEnd.
  15373. if ( dequeue || !gotoEnd ) {
  15374. jQuery.dequeue( this, type );
  15375. }
  15376. } );
  15377. },
  15378. finish: function( type ) {
  15379. if ( type !== false ) {
  15380. type = type || "fx";
  15381. }
  15382. return this.each( function() {
  15383. var index,
  15384. data = dataPriv.get( this ),
  15385. queue = data[ type + "queue" ],
  15386. hooks = data[ type + "queueHooks" ],
  15387. timers = jQuery.timers,
  15388. length = queue ? queue.length : 0;
  15389. // Enable finishing flag on private data
  15390. data.finish = true;
  15391. // Empty the queue first
  15392. jQuery.queue( this, type, [] );
  15393. if ( hooks && hooks.stop ) {
  15394. hooks.stop.call( this, true );
  15395. }
  15396. // Look for any active animations, and finish them
  15397. for ( index = timers.length; index--; ) {
  15398. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15399. timers[ index ].anim.stop( true );
  15400. timers.splice( index, 1 );
  15401. }
  15402. }
  15403. // Look for any animations in the old queue and finish them
  15404. for ( index = 0; index < length; index++ ) {
  15405. if ( queue[ index ] && queue[ index ].finish ) {
  15406. queue[ index ].finish.call( this );
  15407. }
  15408. }
  15409. // Turn off finishing flag
  15410. delete data.finish;
  15411. } );
  15412. }
  15413. } );
  15414. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15415. var cssFn = jQuery.fn[ name ];
  15416. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15417. return speed == null || typeof speed === "boolean" ?
  15418. cssFn.apply( this, arguments ) :
  15419. this.animate( genFx( name, true ), speed, easing, callback );
  15420. };
  15421. } );
  15422. // Generate shortcuts for custom animations
  15423. jQuery.each( {
  15424. slideDown: genFx( "show" ),
  15425. slideUp: genFx( "hide" ),
  15426. slideToggle: genFx( "toggle" ),
  15427. fadeIn: { opacity: "show" },
  15428. fadeOut: { opacity: "hide" },
  15429. fadeToggle: { opacity: "toggle" }
  15430. }, function( name, props ) {
  15431. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15432. return this.animate( props, speed, easing, callback );
  15433. };
  15434. } );
  15435. jQuery.timers = [];
  15436. jQuery.fx.tick = function() {
  15437. var timer,
  15438. i = 0,
  15439. timers = jQuery.timers;
  15440. fxNow = Date.now();
  15441. for ( ; i < timers.length; i++ ) {
  15442. timer = timers[ i ];
  15443. // Run the timer and safely remove it when done (allowing for external removal)
  15444. if ( !timer() && timers[ i ] === timer ) {
  15445. timers.splice( i--, 1 );
  15446. }
  15447. }
  15448. if ( !timers.length ) {
  15449. jQuery.fx.stop();
  15450. }
  15451. fxNow = undefined;
  15452. };
  15453. jQuery.fx.timer = function( timer ) {
  15454. jQuery.timers.push( timer );
  15455. jQuery.fx.start();
  15456. };
  15457. jQuery.fx.interval = 13;
  15458. jQuery.fx.start = function() {
  15459. if ( inProgress ) {
  15460. return;
  15461. }
  15462. inProgress = true;
  15463. schedule();
  15464. };
  15465. jQuery.fx.stop = function() {
  15466. inProgress = null;
  15467. };
  15468. jQuery.fx.speeds = {
  15469. slow: 600,
  15470. fast: 200,
  15471. // Default speed
  15472. _default: 400
  15473. };
  15474. // Based off of the plugin by Clint Helfers, with permission.
  15475. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15476. jQuery.fn.delay = function( time, type ) {
  15477. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15478. type = type || "fx";
  15479. return this.queue( type, function( next, hooks ) {
  15480. var timeout = window.setTimeout( next, time );
  15481. hooks.stop = function() {
  15482. window.clearTimeout( timeout );
  15483. };
  15484. } );
  15485. };
  15486. ( function() {
  15487. var input = document.createElement( "input" ),
  15488. select = document.createElement( "select" ),
  15489. opt = select.appendChild( document.createElement( "option" ) );
  15490. input.type = "checkbox";
  15491. // Support: Android <=4.3 only
  15492. // Default value for a checkbox should be "on"
  15493. support.checkOn = input.value !== "";
  15494. // Support: IE <=11 only
  15495. // Must access selectedIndex to make default options select
  15496. support.optSelected = opt.selected;
  15497. // Support: IE <=11 only
  15498. // An input loses its value after becoming a radio
  15499. input = document.createElement( "input" );
  15500. input.value = "t";
  15501. input.type = "radio";
  15502. support.radioValue = input.value === "t";
  15503. } )();
  15504. var boolHook,
  15505. attrHandle = jQuery.expr.attrHandle;
  15506. jQuery.fn.extend( {
  15507. attr: function( name, value ) {
  15508. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15509. },
  15510. removeAttr: function( name ) {
  15511. return this.each( function() {
  15512. jQuery.removeAttr( this, name );
  15513. } );
  15514. }
  15515. } );
  15516. jQuery.extend( {
  15517. attr: function( elem, name, value ) {
  15518. var ret, hooks,
  15519. nType = elem.nodeType;
  15520. // Don't get/set attributes on text, comment and attribute nodes
  15521. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15522. return;
  15523. }
  15524. // Fallback to prop when attributes are not supported
  15525. if ( typeof elem.getAttribute === "undefined" ) {
  15526. return jQuery.prop( elem, name, value );
  15527. }
  15528. // Attribute hooks are determined by the lowercase version
  15529. // Grab necessary hook if one is defined
  15530. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15531. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15532. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15533. }
  15534. if ( value !== undefined ) {
  15535. if ( value === null ) {
  15536. jQuery.removeAttr( elem, name );
  15537. return;
  15538. }
  15539. if ( hooks && "set" in hooks &&
  15540. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15541. return ret;
  15542. }
  15543. elem.setAttribute( name, value + "" );
  15544. return value;
  15545. }
  15546. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15547. return ret;
  15548. }
  15549. ret = jQuery.find.attr( elem, name );
  15550. // Non-existent attributes return null, we normalize to undefined
  15551. return ret == null ? undefined : ret;
  15552. },
  15553. attrHooks: {
  15554. type: {
  15555. set: function( elem, value ) {
  15556. if ( !support.radioValue && value === "radio" &&
  15557. nodeName( elem, "input" ) ) {
  15558. var val = elem.value;
  15559. elem.setAttribute( "type", value );
  15560. if ( val ) {
  15561. elem.value = val;
  15562. }
  15563. return value;
  15564. }
  15565. }
  15566. }
  15567. },
  15568. removeAttr: function( elem, value ) {
  15569. var name,
  15570. i = 0,
  15571. // Attribute names can contain non-HTML whitespace characters
  15572. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15573. attrNames = value && value.match( rnothtmlwhite );
  15574. if ( attrNames && elem.nodeType === 1 ) {
  15575. while ( ( name = attrNames[ i++ ] ) ) {
  15576. elem.removeAttribute( name );
  15577. }
  15578. }
  15579. }
  15580. } );
  15581. // Hooks for boolean attributes
  15582. boolHook = {
  15583. set: function( elem, value, name ) {
  15584. if ( value === false ) {
  15585. // Remove boolean attributes when set to false
  15586. jQuery.removeAttr( elem, name );
  15587. } else {
  15588. elem.setAttribute( name, name );
  15589. }
  15590. return name;
  15591. }
  15592. };
  15593. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15594. var getter = attrHandle[ name ] || jQuery.find.attr;
  15595. attrHandle[ name ] = function( elem, name, isXML ) {
  15596. var ret, handle,
  15597. lowercaseName = name.toLowerCase();
  15598. if ( !isXML ) {
  15599. // Avoid an infinite loop by temporarily removing this function from the getter
  15600. handle = attrHandle[ lowercaseName ];
  15601. attrHandle[ lowercaseName ] = ret;
  15602. ret = getter( elem, name, isXML ) != null ?
  15603. lowercaseName :
  15604. null;
  15605. attrHandle[ lowercaseName ] = handle;
  15606. }
  15607. return ret;
  15608. };
  15609. } );
  15610. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15611. rclickable = /^(?:a|area)$/i;
  15612. jQuery.fn.extend( {
  15613. prop: function( name, value ) {
  15614. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15615. },
  15616. removeProp: function( name ) {
  15617. return this.each( function() {
  15618. delete this[ jQuery.propFix[ name ] || name ];
  15619. } );
  15620. }
  15621. } );
  15622. jQuery.extend( {
  15623. prop: function( elem, name, value ) {
  15624. var ret, hooks,
  15625. nType = elem.nodeType;
  15626. // Don't get/set properties on text, comment and attribute nodes
  15627. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15628. return;
  15629. }
  15630. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15631. // Fix name and attach hooks
  15632. name = jQuery.propFix[ name ] || name;
  15633. hooks = jQuery.propHooks[ name ];
  15634. }
  15635. if ( value !== undefined ) {
  15636. if ( hooks && "set" in hooks &&
  15637. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15638. return ret;
  15639. }
  15640. return ( elem[ name ] = value );
  15641. }
  15642. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15643. return ret;
  15644. }
  15645. return elem[ name ];
  15646. },
  15647. propHooks: {
  15648. tabIndex: {
  15649. get: function( elem ) {
  15650. // Support: IE <=9 - 11 only
  15651. // elem.tabIndex doesn't always return the
  15652. // correct value when it hasn't been explicitly set
  15653. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15654. // Use proper attribute retrieval(#12072)
  15655. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15656. if ( tabindex ) {
  15657. return parseInt( tabindex, 10 );
  15658. }
  15659. if (
  15660. rfocusable.test( elem.nodeName ) ||
  15661. rclickable.test( elem.nodeName ) &&
  15662. elem.href
  15663. ) {
  15664. return 0;
  15665. }
  15666. return -1;
  15667. }
  15668. }
  15669. },
  15670. propFix: {
  15671. "for": "htmlFor",
  15672. "class": "className"
  15673. }
  15674. } );
  15675. // Support: IE <=11 only
  15676. // Accessing the selectedIndex property
  15677. // forces the browser to respect setting selected
  15678. // on the option
  15679. // The getter ensures a default option is selected
  15680. // when in an optgroup
  15681. // eslint rule "no-unused-expressions" is disabled for this code
  15682. // since it considers such accessions noop
  15683. if ( !support.optSelected ) {
  15684. jQuery.propHooks.selected = {
  15685. get: function( elem ) {
  15686. /* eslint no-unused-expressions: "off" */
  15687. var parent = elem.parentNode;
  15688. if ( parent && parent.parentNode ) {
  15689. parent.parentNode.selectedIndex;
  15690. }
  15691. return null;
  15692. },
  15693. set: function( elem ) {
  15694. /* eslint no-unused-expressions: "off" */
  15695. var parent = elem.parentNode;
  15696. if ( parent ) {
  15697. parent.selectedIndex;
  15698. if ( parent.parentNode ) {
  15699. parent.parentNode.selectedIndex;
  15700. }
  15701. }
  15702. }
  15703. };
  15704. }
  15705. jQuery.each( [
  15706. "tabIndex",
  15707. "readOnly",
  15708. "maxLength",
  15709. "cellSpacing",
  15710. "cellPadding",
  15711. "rowSpan",
  15712. "colSpan",
  15713. "useMap",
  15714. "frameBorder",
  15715. "contentEditable"
  15716. ], function() {
  15717. jQuery.propFix[ this.toLowerCase() ] = this;
  15718. } );
  15719. // Strip and collapse whitespace according to HTML spec
  15720. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15721. function stripAndCollapse( value ) {
  15722. var tokens = value.match( rnothtmlwhite ) || [];
  15723. return tokens.join( " " );
  15724. }
  15725. function getClass( elem ) {
  15726. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15727. }
  15728. function classesToArray( value ) {
  15729. if ( Array.isArray( value ) ) {
  15730. return value;
  15731. }
  15732. if ( typeof value === "string" ) {
  15733. return value.match( rnothtmlwhite ) || [];
  15734. }
  15735. return [];
  15736. }
  15737. jQuery.fn.extend( {
  15738. addClass: function( value ) {
  15739. var classes, elem, cur, curValue, clazz, j, finalValue,
  15740. i = 0;
  15741. if ( isFunction( value ) ) {
  15742. return this.each( function( j ) {
  15743. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15744. } );
  15745. }
  15746. classes = classesToArray( value );
  15747. if ( classes.length ) {
  15748. while ( ( elem = this[ i++ ] ) ) {
  15749. curValue = getClass( elem );
  15750. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15751. if ( cur ) {
  15752. j = 0;
  15753. while ( ( clazz = classes[ j++ ] ) ) {
  15754. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15755. cur += clazz + " ";
  15756. }
  15757. }
  15758. // Only assign if different to avoid unneeded rendering.
  15759. finalValue = stripAndCollapse( cur );
  15760. if ( curValue !== finalValue ) {
  15761. elem.setAttribute( "class", finalValue );
  15762. }
  15763. }
  15764. }
  15765. }
  15766. return this;
  15767. },
  15768. removeClass: function( value ) {
  15769. var classes, elem, cur, curValue, clazz, j, finalValue,
  15770. i = 0;
  15771. if ( isFunction( value ) ) {
  15772. return this.each( function( j ) {
  15773. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15774. } );
  15775. }
  15776. if ( !arguments.length ) {
  15777. return this.attr( "class", "" );
  15778. }
  15779. classes = classesToArray( value );
  15780. if ( classes.length ) {
  15781. while ( ( elem = this[ i++ ] ) ) {
  15782. curValue = getClass( elem );
  15783. // This expression is here for better compressibility (see addClass)
  15784. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15785. if ( cur ) {
  15786. j = 0;
  15787. while ( ( clazz = classes[ j++ ] ) ) {
  15788. // Remove *all* instances
  15789. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15790. cur = cur.replace( " " + clazz + " ", " " );
  15791. }
  15792. }
  15793. // Only assign if different to avoid unneeded rendering.
  15794. finalValue = stripAndCollapse( cur );
  15795. if ( curValue !== finalValue ) {
  15796. elem.setAttribute( "class", finalValue );
  15797. }
  15798. }
  15799. }
  15800. }
  15801. return this;
  15802. },
  15803. toggleClass: function( value, stateVal ) {
  15804. var type = typeof value,
  15805. isValidValue = type === "string" || Array.isArray( value );
  15806. if ( typeof stateVal === "boolean" && isValidValue ) {
  15807. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15808. }
  15809. if ( isFunction( value ) ) {
  15810. return this.each( function( i ) {
  15811. jQuery( this ).toggleClass(
  15812. value.call( this, i, getClass( this ), stateVal ),
  15813. stateVal
  15814. );
  15815. } );
  15816. }
  15817. return this.each( function() {
  15818. var className, i, self, classNames;
  15819. if ( isValidValue ) {
  15820. // Toggle individual class names
  15821. i = 0;
  15822. self = jQuery( this );
  15823. classNames = classesToArray( value );
  15824. while ( ( className = classNames[ i++ ] ) ) {
  15825. // Check each className given, space separated list
  15826. if ( self.hasClass( className ) ) {
  15827. self.removeClass( className );
  15828. } else {
  15829. self.addClass( className );
  15830. }
  15831. }
  15832. // Toggle whole class name
  15833. } else if ( value === undefined || type === "boolean" ) {
  15834. className = getClass( this );
  15835. if ( className ) {
  15836. // Store className if set
  15837. dataPriv.set( this, "__className__", className );
  15838. }
  15839. // If the element has a class name or if we're passed `false`,
  15840. // then remove the whole classname (if there was one, the above saved it).
  15841. // Otherwise bring back whatever was previously saved (if anything),
  15842. // falling back to the empty string if nothing was stored.
  15843. if ( this.setAttribute ) {
  15844. this.setAttribute( "class",
  15845. className || value === false ?
  15846. "" :
  15847. dataPriv.get( this, "__className__" ) || ""
  15848. );
  15849. }
  15850. }
  15851. } );
  15852. },
  15853. hasClass: function( selector ) {
  15854. var className, elem,
  15855. i = 0;
  15856. className = " " + selector + " ";
  15857. while ( ( elem = this[ i++ ] ) ) {
  15858. if ( elem.nodeType === 1 &&
  15859. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15860. return true;
  15861. }
  15862. }
  15863. return false;
  15864. }
  15865. } );
  15866. var rreturn = /\r/g;
  15867. jQuery.fn.extend( {
  15868. val: function( value ) {
  15869. var hooks, ret, valueIsFunction,
  15870. elem = this[ 0 ];
  15871. if ( !arguments.length ) {
  15872. if ( elem ) {
  15873. hooks = jQuery.valHooks[ elem.type ] ||
  15874. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15875. if ( hooks &&
  15876. "get" in hooks &&
  15877. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15878. ) {
  15879. return ret;
  15880. }
  15881. ret = elem.value;
  15882. // Handle most common string cases
  15883. if ( typeof ret === "string" ) {
  15884. return ret.replace( rreturn, "" );
  15885. }
  15886. // Handle cases where value is null/undef or number
  15887. return ret == null ? "" : ret;
  15888. }
  15889. return;
  15890. }
  15891. valueIsFunction = isFunction( value );
  15892. return this.each( function( i ) {
  15893. var val;
  15894. if ( this.nodeType !== 1 ) {
  15895. return;
  15896. }
  15897. if ( valueIsFunction ) {
  15898. val = value.call( this, i, jQuery( this ).val() );
  15899. } else {
  15900. val = value;
  15901. }
  15902. // Treat null/undefined as ""; convert numbers to string
  15903. if ( val == null ) {
  15904. val = "";
  15905. } else if ( typeof val === "number" ) {
  15906. val += "";
  15907. } else if ( Array.isArray( val ) ) {
  15908. val = jQuery.map( val, function( value ) {
  15909. return value == null ? "" : value + "";
  15910. } );
  15911. }
  15912. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15913. // If set returns undefined, fall back to normal setting
  15914. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15915. this.value = val;
  15916. }
  15917. } );
  15918. }
  15919. } );
  15920. jQuery.extend( {
  15921. valHooks: {
  15922. option: {
  15923. get: function( elem ) {
  15924. var val = jQuery.find.attr( elem, "value" );
  15925. return val != null ?
  15926. val :
  15927. // Support: IE <=10 - 11 only
  15928. // option.text throws exceptions (#14686, #14858)
  15929. // Strip and collapse whitespace
  15930. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15931. stripAndCollapse( jQuery.text( elem ) );
  15932. }
  15933. },
  15934. select: {
  15935. get: function( elem ) {
  15936. var value, option, i,
  15937. options = elem.options,
  15938. index = elem.selectedIndex,
  15939. one = elem.type === "select-one",
  15940. values = one ? null : [],
  15941. max = one ? index + 1 : options.length;
  15942. if ( index < 0 ) {
  15943. i = max;
  15944. } else {
  15945. i = one ? index : 0;
  15946. }
  15947. // Loop through all the selected options
  15948. for ( ; i < max; i++ ) {
  15949. option = options[ i ];
  15950. // Support: IE <=9 only
  15951. // IE8-9 doesn't update selected after form reset (#2551)
  15952. if ( ( option.selected || i === index ) &&
  15953. // Don't return options that are disabled or in a disabled optgroup
  15954. !option.disabled &&
  15955. ( !option.parentNode.disabled ||
  15956. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15957. // Get the specific value for the option
  15958. value = jQuery( option ).val();
  15959. // We don't need an array for one selects
  15960. if ( one ) {
  15961. return value;
  15962. }
  15963. // Multi-Selects return an array
  15964. values.push( value );
  15965. }
  15966. }
  15967. return values;
  15968. },
  15969. set: function( elem, value ) {
  15970. var optionSet, option,
  15971. options = elem.options,
  15972. values = jQuery.makeArray( value ),
  15973. i = options.length;
  15974. while ( i-- ) {
  15975. option = options[ i ];
  15976. /* eslint-disable no-cond-assign */
  15977. if ( option.selected =
  15978. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15979. ) {
  15980. optionSet = true;
  15981. }
  15982. /* eslint-enable no-cond-assign */
  15983. }
  15984. // Force browsers to behave consistently when non-matching value is set
  15985. if ( !optionSet ) {
  15986. elem.selectedIndex = -1;
  15987. }
  15988. return values;
  15989. }
  15990. }
  15991. }
  15992. } );
  15993. // Radios and checkboxes getter/setter
  15994. jQuery.each( [ "radio", "checkbox" ], function() {
  15995. jQuery.valHooks[ this ] = {
  15996. set: function( elem, value ) {
  15997. if ( Array.isArray( value ) ) {
  15998. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15999. }
  16000. }
  16001. };
  16002. if ( !support.checkOn ) {
  16003. jQuery.valHooks[ this ].get = function( elem ) {
  16004. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16005. };
  16006. }
  16007. } );
  16008. // Return jQuery for attributes-only inclusion
  16009. support.focusin = "onfocusin" in window;
  16010. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16011. stopPropagationCallback = function( e ) {
  16012. e.stopPropagation();
  16013. };
  16014. jQuery.extend( jQuery.event, {
  16015. trigger: function( event, data, elem, onlyHandlers ) {
  16016. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16017. eventPath = [ elem || document ],
  16018. type = hasOwn.call( event, "type" ) ? event.type : event,
  16019. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16020. cur = lastElement = tmp = elem = elem || document;
  16021. // Don't do events on text and comment nodes
  16022. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16023. return;
  16024. }
  16025. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16026. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16027. return;
  16028. }
  16029. if ( type.indexOf( "." ) > -1 ) {
  16030. // Namespaced trigger; create a regexp to match event type in handle()
  16031. namespaces = type.split( "." );
  16032. type = namespaces.shift();
  16033. namespaces.sort();
  16034. }
  16035. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16036. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16037. event = event[ jQuery.expando ] ?
  16038. event :
  16039. new jQuery.Event( type, typeof event === "object" && event );
  16040. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16041. event.isTrigger = onlyHandlers ? 2 : 3;
  16042. event.namespace = namespaces.join( "." );
  16043. event.rnamespace = event.namespace ?
  16044. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16045. null;
  16046. // Clean up the event in case it is being reused
  16047. event.result = undefined;
  16048. if ( !event.target ) {
  16049. event.target = elem;
  16050. }
  16051. // Clone any incoming data and prepend the event, creating the handler arg list
  16052. data = data == null ?
  16053. [ event ] :
  16054. jQuery.makeArray( data, [ event ] );
  16055. // Allow special events to draw outside the lines
  16056. special = jQuery.event.special[ type ] || {};
  16057. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16058. return;
  16059. }
  16060. // Determine event propagation path in advance, per W3C events spec (#9951)
  16061. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16062. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16063. bubbleType = special.delegateType || type;
  16064. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16065. cur = cur.parentNode;
  16066. }
  16067. for ( ; cur; cur = cur.parentNode ) {
  16068. eventPath.push( cur );
  16069. tmp = cur;
  16070. }
  16071. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16072. if ( tmp === ( elem.ownerDocument || document ) ) {
  16073. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16074. }
  16075. }
  16076. // Fire handlers on the event path
  16077. i = 0;
  16078. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16079. lastElement = cur;
  16080. event.type = i > 1 ?
  16081. bubbleType :
  16082. special.bindType || type;
  16083. // jQuery handler
  16084. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16085. dataPriv.get( cur, "handle" );
  16086. if ( handle ) {
  16087. handle.apply( cur, data );
  16088. }
  16089. // Native handler
  16090. handle = ontype && cur[ ontype ];
  16091. if ( handle && handle.apply && acceptData( cur ) ) {
  16092. event.result = handle.apply( cur, data );
  16093. if ( event.result === false ) {
  16094. event.preventDefault();
  16095. }
  16096. }
  16097. }
  16098. event.type = type;
  16099. // If nobody prevented the default action, do it now
  16100. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16101. if ( ( !special._default ||
  16102. special._default.apply( eventPath.pop(), data ) === false ) &&
  16103. acceptData( elem ) ) {
  16104. // Call a native DOM method on the target with the same name as the event.
  16105. // Don't do default actions on window, that's where global variables be (#6170)
  16106. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16107. // Don't re-trigger an onFOO event when we call its FOO() method
  16108. tmp = elem[ ontype ];
  16109. if ( tmp ) {
  16110. elem[ ontype ] = null;
  16111. }
  16112. // Prevent re-triggering of the same event, since we already bubbled it above
  16113. jQuery.event.triggered = type;
  16114. if ( event.isPropagationStopped() ) {
  16115. lastElement.addEventListener( type, stopPropagationCallback );
  16116. }
  16117. elem[ type ]();
  16118. if ( event.isPropagationStopped() ) {
  16119. lastElement.removeEventListener( type, stopPropagationCallback );
  16120. }
  16121. jQuery.event.triggered = undefined;
  16122. if ( tmp ) {
  16123. elem[ ontype ] = tmp;
  16124. }
  16125. }
  16126. }
  16127. }
  16128. return event.result;
  16129. },
  16130. // Piggyback on a donor event to simulate a different one
  16131. // Used only for `focus(in | out)` events
  16132. simulate: function( type, elem, event ) {
  16133. var e = jQuery.extend(
  16134. new jQuery.Event(),
  16135. event,
  16136. {
  16137. type: type,
  16138. isSimulated: true
  16139. }
  16140. );
  16141. jQuery.event.trigger( e, null, elem );
  16142. }
  16143. } );
  16144. jQuery.fn.extend( {
  16145. trigger: function( type, data ) {
  16146. return this.each( function() {
  16147. jQuery.event.trigger( type, data, this );
  16148. } );
  16149. },
  16150. triggerHandler: function( type, data ) {
  16151. var elem = this[ 0 ];
  16152. if ( elem ) {
  16153. return jQuery.event.trigger( type, data, elem, true );
  16154. }
  16155. }
  16156. } );
  16157. // Support: Firefox <=44
  16158. // Firefox doesn't have focus(in | out) events
  16159. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16160. //
  16161. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16162. // focus(in | out) events fire after focus & blur events,
  16163. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16164. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16165. if ( !support.focusin ) {
  16166. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16167. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16168. var handler = function( event ) {
  16169. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16170. };
  16171. jQuery.event.special[ fix ] = {
  16172. setup: function() {
  16173. var doc = this.ownerDocument || this,
  16174. attaches = dataPriv.access( doc, fix );
  16175. if ( !attaches ) {
  16176. doc.addEventListener( orig, handler, true );
  16177. }
  16178. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16179. },
  16180. teardown: function() {
  16181. var doc = this.ownerDocument || this,
  16182. attaches = dataPriv.access( doc, fix ) - 1;
  16183. if ( !attaches ) {
  16184. doc.removeEventListener( orig, handler, true );
  16185. dataPriv.remove( doc, fix );
  16186. } else {
  16187. dataPriv.access( doc, fix, attaches );
  16188. }
  16189. }
  16190. };
  16191. } );
  16192. }
  16193. var location = window.location;
  16194. var nonce = Date.now();
  16195. var rquery = ( /\?/ );
  16196. // Cross-browser xml parsing
  16197. jQuery.parseXML = function( data ) {
  16198. var xml;
  16199. if ( !data || typeof data !== "string" ) {
  16200. return null;
  16201. }
  16202. // Support: IE 9 - 11 only
  16203. // IE throws on parseFromString with invalid input.
  16204. try {
  16205. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16206. } catch ( e ) {
  16207. xml = undefined;
  16208. }
  16209. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16210. jQuery.error( "Invalid XML: " + data );
  16211. }
  16212. return xml;
  16213. };
  16214. var
  16215. rbracket = /\[\]$/,
  16216. rCRLF = /\r?\n/g,
  16217. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16218. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16219. function buildParams( prefix, obj, traditional, add ) {
  16220. var name;
  16221. if ( Array.isArray( obj ) ) {
  16222. // Serialize array item.
  16223. jQuery.each( obj, function( i, v ) {
  16224. if ( traditional || rbracket.test( prefix ) ) {
  16225. // Treat each array item as a scalar.
  16226. add( prefix, v );
  16227. } else {
  16228. // Item is non-scalar (array or object), encode its numeric index.
  16229. buildParams(
  16230. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16231. v,
  16232. traditional,
  16233. add
  16234. );
  16235. }
  16236. } );
  16237. } else if ( !traditional && toType( obj ) === "object" ) {
  16238. // Serialize object item.
  16239. for ( name in obj ) {
  16240. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16241. }
  16242. } else {
  16243. // Serialize scalar item.
  16244. add( prefix, obj );
  16245. }
  16246. }
  16247. // Serialize an array of form elements or a set of
  16248. // key/values into a query string
  16249. jQuery.param = function( a, traditional ) {
  16250. var prefix,
  16251. s = [],
  16252. add = function( key, valueOrFunction ) {
  16253. // If value is a function, invoke it and use its return value
  16254. var value = isFunction( valueOrFunction ) ?
  16255. valueOrFunction() :
  16256. valueOrFunction;
  16257. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16258. encodeURIComponent( value == null ? "" : value );
  16259. };
  16260. if ( a == null ) {
  16261. return "";
  16262. }
  16263. // If an array was passed in, assume that it is an array of form elements.
  16264. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16265. // Serialize the form elements
  16266. jQuery.each( a, function() {
  16267. add( this.name, this.value );
  16268. } );
  16269. } else {
  16270. // If traditional, encode the "old" way (the way 1.3.2 or older
  16271. // did it), otherwise encode params recursively.
  16272. for ( prefix in a ) {
  16273. buildParams( prefix, a[ prefix ], traditional, add );
  16274. }
  16275. }
  16276. // Return the resulting serialization
  16277. return s.join( "&" );
  16278. };
  16279. jQuery.fn.extend( {
  16280. serialize: function() {
  16281. return jQuery.param( this.serializeArray() );
  16282. },
  16283. serializeArray: function() {
  16284. return this.map( function() {
  16285. // Can add propHook for "elements" to filter or add form elements
  16286. var elements = jQuery.prop( this, "elements" );
  16287. return elements ? jQuery.makeArray( elements ) : this;
  16288. } )
  16289. .filter( function() {
  16290. var type = this.type;
  16291. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16292. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16293. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16294. ( this.checked || !rcheckableType.test( type ) );
  16295. } )
  16296. .map( function( i, elem ) {
  16297. var val = jQuery( this ).val();
  16298. if ( val == null ) {
  16299. return null;
  16300. }
  16301. if ( Array.isArray( val ) ) {
  16302. return jQuery.map( val, function( val ) {
  16303. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16304. } );
  16305. }
  16306. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16307. } ).get();
  16308. }
  16309. } );
  16310. var
  16311. r20 = /%20/g,
  16312. rhash = /#.*$/,
  16313. rantiCache = /([?&])_=[^&]*/,
  16314. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16315. // #7653, #8125, #8152: local protocol detection
  16316. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16317. rnoContent = /^(?:GET|HEAD)$/,
  16318. rprotocol = /^\/\//,
  16319. /* Prefilters
  16320. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16321. * 2) These are called:
  16322. * - BEFORE asking for a transport
  16323. * - AFTER param serialization (s.data is a string if s.processData is true)
  16324. * 3) key is the dataType
  16325. * 4) the catchall symbol "*" can be used
  16326. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16327. */
  16328. prefilters = {},
  16329. /* Transports bindings
  16330. * 1) key is the dataType
  16331. * 2) the catchall symbol "*" can be used
  16332. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16333. */
  16334. transports = {},
  16335. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16336. allTypes = "*/".concat( "*" ),
  16337. // Anchor tag for parsing the document origin
  16338. originAnchor = document.createElement( "a" );
  16339. originAnchor.href = location.href;
  16340. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16341. function addToPrefiltersOrTransports( structure ) {
  16342. // dataTypeExpression is optional and defaults to "*"
  16343. return function( dataTypeExpression, func ) {
  16344. if ( typeof dataTypeExpression !== "string" ) {
  16345. func = dataTypeExpression;
  16346. dataTypeExpression = "*";
  16347. }
  16348. var dataType,
  16349. i = 0,
  16350. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16351. if ( isFunction( func ) ) {
  16352. // For each dataType in the dataTypeExpression
  16353. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16354. // Prepend if requested
  16355. if ( dataType[ 0 ] === "+" ) {
  16356. dataType = dataType.slice( 1 ) || "*";
  16357. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16358. // Otherwise append
  16359. } else {
  16360. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16361. }
  16362. }
  16363. }
  16364. };
  16365. }
  16366. // Base inspection function for prefilters and transports
  16367. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16368. var inspected = {},
  16369. seekingTransport = ( structure === transports );
  16370. function inspect( dataType ) {
  16371. var selected;
  16372. inspected[ dataType ] = true;
  16373. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16374. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16375. if ( typeof dataTypeOrTransport === "string" &&
  16376. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16377. options.dataTypes.unshift( dataTypeOrTransport );
  16378. inspect( dataTypeOrTransport );
  16379. return false;
  16380. } else if ( seekingTransport ) {
  16381. return !( selected = dataTypeOrTransport );
  16382. }
  16383. } );
  16384. return selected;
  16385. }
  16386. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16387. }
  16388. // A special extend for ajax options
  16389. // that takes "flat" options (not to be deep extended)
  16390. // Fixes #9887
  16391. function ajaxExtend( target, src ) {
  16392. var key, deep,
  16393. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16394. for ( key in src ) {
  16395. if ( src[ key ] !== undefined ) {
  16396. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16397. }
  16398. }
  16399. if ( deep ) {
  16400. jQuery.extend( true, target, deep );
  16401. }
  16402. return target;
  16403. }
  16404. /* Handles responses to an ajax request:
  16405. * - finds the right dataType (mediates between content-type and expected dataType)
  16406. * - returns the corresponding response
  16407. */
  16408. function ajaxHandleResponses( s, jqXHR, responses ) {
  16409. var ct, type, finalDataType, firstDataType,
  16410. contents = s.contents,
  16411. dataTypes = s.dataTypes;
  16412. // Remove auto dataType and get content-type in the process
  16413. while ( dataTypes[ 0 ] === "*" ) {
  16414. dataTypes.shift();
  16415. if ( ct === undefined ) {
  16416. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16417. }
  16418. }
  16419. // Check if we're dealing with a known content-type
  16420. if ( ct ) {
  16421. for ( type in contents ) {
  16422. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16423. dataTypes.unshift( type );
  16424. break;
  16425. }
  16426. }
  16427. }
  16428. // Check to see if we have a response for the expected dataType
  16429. if ( dataTypes[ 0 ] in responses ) {
  16430. finalDataType = dataTypes[ 0 ];
  16431. } else {
  16432. // Try convertible dataTypes
  16433. for ( type in responses ) {
  16434. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16435. finalDataType = type;
  16436. break;
  16437. }
  16438. if ( !firstDataType ) {
  16439. firstDataType = type;
  16440. }
  16441. }
  16442. // Or just use first one
  16443. finalDataType = finalDataType || firstDataType;
  16444. }
  16445. // If we found a dataType
  16446. // We add the dataType to the list if needed
  16447. // and return the corresponding response
  16448. if ( finalDataType ) {
  16449. if ( finalDataType !== dataTypes[ 0 ] ) {
  16450. dataTypes.unshift( finalDataType );
  16451. }
  16452. return responses[ finalDataType ];
  16453. }
  16454. }
  16455. /* Chain conversions given the request and the original response
  16456. * Also sets the responseXXX fields on the jqXHR instance
  16457. */
  16458. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16459. var conv2, current, conv, tmp, prev,
  16460. converters = {},
  16461. // Work with a copy of dataTypes in case we need to modify it for conversion
  16462. dataTypes = s.dataTypes.slice();
  16463. // Create converters map with lowercased keys
  16464. if ( dataTypes[ 1 ] ) {
  16465. for ( conv in s.converters ) {
  16466. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16467. }
  16468. }
  16469. current = dataTypes.shift();
  16470. // Convert to each sequential dataType
  16471. while ( current ) {
  16472. if ( s.responseFields[ current ] ) {
  16473. jqXHR[ s.responseFields[ current ] ] = response;
  16474. }
  16475. // Apply the dataFilter if provided
  16476. if ( !prev && isSuccess && s.dataFilter ) {
  16477. response = s.dataFilter( response, s.dataType );
  16478. }
  16479. prev = current;
  16480. current = dataTypes.shift();
  16481. if ( current ) {
  16482. // There's only work to do if current dataType is non-auto
  16483. if ( current === "*" ) {
  16484. current = prev;
  16485. // Convert response if prev dataType is non-auto and differs from current
  16486. } else if ( prev !== "*" && prev !== current ) {
  16487. // Seek a direct converter
  16488. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16489. // If none found, seek a pair
  16490. if ( !conv ) {
  16491. for ( conv2 in converters ) {
  16492. // If conv2 outputs current
  16493. tmp = conv2.split( " " );
  16494. if ( tmp[ 1 ] === current ) {
  16495. // If prev can be converted to accepted input
  16496. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16497. converters[ "* " + tmp[ 0 ] ];
  16498. if ( conv ) {
  16499. // Condense equivalence converters
  16500. if ( conv === true ) {
  16501. conv = converters[ conv2 ];
  16502. // Otherwise, insert the intermediate dataType
  16503. } else if ( converters[ conv2 ] !== true ) {
  16504. current = tmp[ 0 ];
  16505. dataTypes.unshift( tmp[ 1 ] );
  16506. }
  16507. break;
  16508. }
  16509. }
  16510. }
  16511. }
  16512. // Apply converter (if not an equivalence)
  16513. if ( conv !== true ) {
  16514. // Unless errors are allowed to bubble, catch and return them
  16515. if ( conv && s.throws ) {
  16516. response = conv( response );
  16517. } else {
  16518. try {
  16519. response = conv( response );
  16520. } catch ( e ) {
  16521. return {
  16522. state: "parsererror",
  16523. error: conv ? e : "No conversion from " + prev + " to " + current
  16524. };
  16525. }
  16526. }
  16527. }
  16528. }
  16529. }
  16530. }
  16531. return { state: "success", data: response };
  16532. }
  16533. jQuery.extend( {
  16534. // Counter for holding the number of active queries
  16535. active: 0,
  16536. // Last-Modified header cache for next request
  16537. lastModified: {},
  16538. etag: {},
  16539. ajaxSettings: {
  16540. url: location.href,
  16541. type: "GET",
  16542. isLocal: rlocalProtocol.test( location.protocol ),
  16543. global: true,
  16544. processData: true,
  16545. async: true,
  16546. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16547. /*
  16548. timeout: 0,
  16549. data: null,
  16550. dataType: null,
  16551. username: null,
  16552. password: null,
  16553. cache: null,
  16554. throws: false,
  16555. traditional: false,
  16556. headers: {},
  16557. */
  16558. accepts: {
  16559. "*": allTypes,
  16560. text: "text/plain",
  16561. html: "text/html",
  16562. xml: "application/xml, text/xml",
  16563. json: "application/json, text/javascript"
  16564. },
  16565. contents: {
  16566. xml: /\bxml\b/,
  16567. html: /\bhtml/,
  16568. json: /\bjson\b/
  16569. },
  16570. responseFields: {
  16571. xml: "responseXML",
  16572. text: "responseText",
  16573. json: "responseJSON"
  16574. },
  16575. // Data converters
  16576. // Keys separate source (or catchall "*") and destination types with a single space
  16577. converters: {
  16578. // Convert anything to text
  16579. "* text": String,
  16580. // Text to html (true = no transformation)
  16581. "text html": true,
  16582. // Evaluate text as a json expression
  16583. "text json": JSON.parse,
  16584. // Parse text as xml
  16585. "text xml": jQuery.parseXML
  16586. },
  16587. // For options that shouldn't be deep extended:
  16588. // you can add your own custom options here if
  16589. // and when you create one that shouldn't be
  16590. // deep extended (see ajaxExtend)
  16591. flatOptions: {
  16592. url: true,
  16593. context: true
  16594. }
  16595. },
  16596. // Creates a full fledged settings object into target
  16597. // with both ajaxSettings and settings fields.
  16598. // If target is omitted, writes into ajaxSettings.
  16599. ajaxSetup: function( target, settings ) {
  16600. return settings ?
  16601. // Building a settings object
  16602. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16603. // Extending ajaxSettings
  16604. ajaxExtend( jQuery.ajaxSettings, target );
  16605. },
  16606. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16607. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16608. // Main method
  16609. ajax: function( url, options ) {
  16610. // If url is an object, simulate pre-1.5 signature
  16611. if ( typeof url === "object" ) {
  16612. options = url;
  16613. url = undefined;
  16614. }
  16615. // Force options to be an object
  16616. options = options || {};
  16617. var transport,
  16618. // URL without anti-cache param
  16619. cacheURL,
  16620. // Response headers
  16621. responseHeadersString,
  16622. responseHeaders,
  16623. // timeout handle
  16624. timeoutTimer,
  16625. // Url cleanup var
  16626. urlAnchor,
  16627. // Request state (becomes false upon send and true upon completion)
  16628. completed,
  16629. // To know if global events are to be dispatched
  16630. fireGlobals,
  16631. // Loop variable
  16632. i,
  16633. // uncached part of the url
  16634. uncached,
  16635. // Create the final options object
  16636. s = jQuery.ajaxSetup( {}, options ),
  16637. // Callbacks context
  16638. callbackContext = s.context || s,
  16639. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16640. globalEventContext = s.context &&
  16641. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16642. jQuery( callbackContext ) :
  16643. jQuery.event,
  16644. // Deferreds
  16645. deferred = jQuery.Deferred(),
  16646. completeDeferred = jQuery.Callbacks( "once memory" ),
  16647. // Status-dependent callbacks
  16648. statusCode = s.statusCode || {},
  16649. // Headers (they are sent all at once)
  16650. requestHeaders = {},
  16651. requestHeadersNames = {},
  16652. // Default abort message
  16653. strAbort = "canceled",
  16654. // Fake xhr
  16655. jqXHR = {
  16656. readyState: 0,
  16657. // Builds headers hashtable if needed
  16658. getResponseHeader: function( key ) {
  16659. var match;
  16660. if ( completed ) {
  16661. if ( !responseHeaders ) {
  16662. responseHeaders = {};
  16663. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16664. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16665. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16666. .concat( match[ 2 ] );
  16667. }
  16668. }
  16669. match = responseHeaders[ key.toLowerCase() + " " ];
  16670. }
  16671. return match == null ? null : match.join( ", " );
  16672. },
  16673. // Raw string
  16674. getAllResponseHeaders: function() {
  16675. return completed ? responseHeadersString : null;
  16676. },
  16677. // Caches the header
  16678. setRequestHeader: function( name, value ) {
  16679. if ( completed == null ) {
  16680. name = requestHeadersNames[ name.toLowerCase() ] =
  16681. requestHeadersNames[ name.toLowerCase() ] || name;
  16682. requestHeaders[ name ] = value;
  16683. }
  16684. return this;
  16685. },
  16686. // Overrides response content-type header
  16687. overrideMimeType: function( type ) {
  16688. if ( completed == null ) {
  16689. s.mimeType = type;
  16690. }
  16691. return this;
  16692. },
  16693. // Status-dependent callbacks
  16694. statusCode: function( map ) {
  16695. var code;
  16696. if ( map ) {
  16697. if ( completed ) {
  16698. // Execute the appropriate callbacks
  16699. jqXHR.always( map[ jqXHR.status ] );
  16700. } else {
  16701. // Lazy-add the new callbacks in a way that preserves old ones
  16702. for ( code in map ) {
  16703. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16704. }
  16705. }
  16706. }
  16707. return this;
  16708. },
  16709. // Cancel the request
  16710. abort: function( statusText ) {
  16711. var finalText = statusText || strAbort;
  16712. if ( transport ) {
  16713. transport.abort( finalText );
  16714. }
  16715. done( 0, finalText );
  16716. return this;
  16717. }
  16718. };
  16719. // Attach deferreds
  16720. deferred.promise( jqXHR );
  16721. // Add protocol if not provided (prefilters might expect it)
  16722. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16723. // We also use the url parameter if available
  16724. s.url = ( ( url || s.url || location.href ) + "" )
  16725. .replace( rprotocol, location.protocol + "//" );
  16726. // Alias method option to type as per ticket #12004
  16727. s.type = options.method || options.type || s.method || s.type;
  16728. // Extract dataTypes list
  16729. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16730. // A cross-domain request is in order when the origin doesn't match the current origin.
  16731. if ( s.crossDomain == null ) {
  16732. urlAnchor = document.createElement( "a" );
  16733. // Support: IE <=8 - 11, Edge 12 - 15
  16734. // IE throws exception on accessing the href property if url is malformed,
  16735. // e.g. http://example.com:80x/
  16736. try {
  16737. urlAnchor.href = s.url;
  16738. // Support: IE <=8 - 11 only
  16739. // Anchor's host property isn't correctly set when s.url is relative
  16740. urlAnchor.href = urlAnchor.href;
  16741. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16742. urlAnchor.protocol + "//" + urlAnchor.host;
  16743. } catch ( e ) {
  16744. // If there is an error parsing the URL, assume it is crossDomain,
  16745. // it can be rejected by the transport if it is invalid
  16746. s.crossDomain = true;
  16747. }
  16748. }
  16749. // Convert data if not already a string
  16750. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16751. s.data = jQuery.param( s.data, s.traditional );
  16752. }
  16753. // Apply prefilters
  16754. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16755. // If request was aborted inside a prefilter, stop there
  16756. if ( completed ) {
  16757. return jqXHR;
  16758. }
  16759. // We can fire global events as of now if asked to
  16760. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16761. fireGlobals = jQuery.event && s.global;
  16762. // Watch for a new set of requests
  16763. if ( fireGlobals && jQuery.active++ === 0 ) {
  16764. jQuery.event.trigger( "ajaxStart" );
  16765. }
  16766. // Uppercase the type
  16767. s.type = s.type.toUpperCase();
  16768. // Determine if request has content
  16769. s.hasContent = !rnoContent.test( s.type );
  16770. // Save the URL in case we're toying with the If-Modified-Since
  16771. // and/or If-None-Match header later on
  16772. // Remove hash to simplify url manipulation
  16773. cacheURL = s.url.replace( rhash, "" );
  16774. // More options handling for requests with no content
  16775. if ( !s.hasContent ) {
  16776. // Remember the hash so we can put it back
  16777. uncached = s.url.slice( cacheURL.length );
  16778. // If data is available and should be processed, append data to url
  16779. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16780. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16781. // #9682: remove data so that it's not used in an eventual retry
  16782. delete s.data;
  16783. }
  16784. // Add or update anti-cache param if needed
  16785. if ( s.cache === false ) {
  16786. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16787. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16788. }
  16789. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16790. s.url = cacheURL + uncached;
  16791. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16792. } else if ( s.data && s.processData &&
  16793. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16794. s.data = s.data.replace( r20, "+" );
  16795. }
  16796. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16797. if ( s.ifModified ) {
  16798. if ( jQuery.lastModified[ cacheURL ] ) {
  16799. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16800. }
  16801. if ( jQuery.etag[ cacheURL ] ) {
  16802. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16803. }
  16804. }
  16805. // Set the correct header, if data is being sent
  16806. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16807. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16808. }
  16809. // Set the Accepts header for the server, depending on the dataType
  16810. jqXHR.setRequestHeader(
  16811. "Accept",
  16812. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16813. s.accepts[ s.dataTypes[ 0 ] ] +
  16814. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16815. s.accepts[ "*" ]
  16816. );
  16817. // Check for headers option
  16818. for ( i in s.headers ) {
  16819. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16820. }
  16821. // Allow custom headers/mimetypes and early abort
  16822. if ( s.beforeSend &&
  16823. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16824. // Abort if not done already and return
  16825. return jqXHR.abort();
  16826. }
  16827. // Aborting is no longer a cancellation
  16828. strAbort = "abort";
  16829. // Install callbacks on deferreds
  16830. completeDeferred.add( s.complete );
  16831. jqXHR.done( s.success );
  16832. jqXHR.fail( s.error );
  16833. // Get transport
  16834. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16835. // If no transport, we auto-abort
  16836. if ( !transport ) {
  16837. done( -1, "No Transport" );
  16838. } else {
  16839. jqXHR.readyState = 1;
  16840. // Send global event
  16841. if ( fireGlobals ) {
  16842. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16843. }
  16844. // If request was aborted inside ajaxSend, stop there
  16845. if ( completed ) {
  16846. return jqXHR;
  16847. }
  16848. // Timeout
  16849. if ( s.async && s.timeout > 0 ) {
  16850. timeoutTimer = window.setTimeout( function() {
  16851. jqXHR.abort( "timeout" );
  16852. }, s.timeout );
  16853. }
  16854. try {
  16855. completed = false;
  16856. transport.send( requestHeaders, done );
  16857. } catch ( e ) {
  16858. // Rethrow post-completion exceptions
  16859. if ( completed ) {
  16860. throw e;
  16861. }
  16862. // Propagate others as results
  16863. done( -1, e );
  16864. }
  16865. }
  16866. // Callback for when everything is done
  16867. function done( status, nativeStatusText, responses, headers ) {
  16868. var isSuccess, success, error, response, modified,
  16869. statusText = nativeStatusText;
  16870. // Ignore repeat invocations
  16871. if ( completed ) {
  16872. return;
  16873. }
  16874. completed = true;
  16875. // Clear timeout if it exists
  16876. if ( timeoutTimer ) {
  16877. window.clearTimeout( timeoutTimer );
  16878. }
  16879. // Dereference transport for early garbage collection
  16880. // (no matter how long the jqXHR object will be used)
  16881. transport = undefined;
  16882. // Cache response headers
  16883. responseHeadersString = headers || "";
  16884. // Set readyState
  16885. jqXHR.readyState = status > 0 ? 4 : 0;
  16886. // Determine if successful
  16887. isSuccess = status >= 200 && status < 300 || status === 304;
  16888. // Get response data
  16889. if ( responses ) {
  16890. response = ajaxHandleResponses( s, jqXHR, responses );
  16891. }
  16892. // Convert no matter what (that way responseXXX fields are always set)
  16893. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16894. // If successful, handle type chaining
  16895. if ( isSuccess ) {
  16896. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16897. if ( s.ifModified ) {
  16898. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16899. if ( modified ) {
  16900. jQuery.lastModified[ cacheURL ] = modified;
  16901. }
  16902. modified = jqXHR.getResponseHeader( "etag" );
  16903. if ( modified ) {
  16904. jQuery.etag[ cacheURL ] = modified;
  16905. }
  16906. }
  16907. // if no content
  16908. if ( status === 204 || s.type === "HEAD" ) {
  16909. statusText = "nocontent";
  16910. // if not modified
  16911. } else if ( status === 304 ) {
  16912. statusText = "notmodified";
  16913. // If we have data, let's convert it
  16914. } else {
  16915. statusText = response.state;
  16916. success = response.data;
  16917. error = response.error;
  16918. isSuccess = !error;
  16919. }
  16920. } else {
  16921. // Extract error from statusText and normalize for non-aborts
  16922. error = statusText;
  16923. if ( status || !statusText ) {
  16924. statusText = "error";
  16925. if ( status < 0 ) {
  16926. status = 0;
  16927. }
  16928. }
  16929. }
  16930. // Set data for the fake xhr object
  16931. jqXHR.status = status;
  16932. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16933. // Success/Error
  16934. if ( isSuccess ) {
  16935. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16936. } else {
  16937. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16938. }
  16939. // Status-dependent callbacks
  16940. jqXHR.statusCode( statusCode );
  16941. statusCode = undefined;
  16942. if ( fireGlobals ) {
  16943. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16944. [ jqXHR, s, isSuccess ? success : error ] );
  16945. }
  16946. // Complete
  16947. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16948. if ( fireGlobals ) {
  16949. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16950. // Handle the global AJAX counter
  16951. if ( !( --jQuery.active ) ) {
  16952. jQuery.event.trigger( "ajaxStop" );
  16953. }
  16954. }
  16955. }
  16956. return jqXHR;
  16957. },
  16958. getJSON: function( url, data, callback ) {
  16959. return jQuery.get( url, data, callback, "json" );
  16960. },
  16961. getScript: function( url, callback ) {
  16962. return jQuery.get( url, undefined, callback, "script" );
  16963. }
  16964. } );
  16965. jQuery.each( [ "get", "post" ], function( i, method ) {
  16966. jQuery[ method ] = function( url, data, callback, type ) {
  16967. // Shift arguments if data argument was omitted
  16968. if ( isFunction( data ) ) {
  16969. type = type || callback;
  16970. callback = data;
  16971. data = undefined;
  16972. }
  16973. // The url can be an options object (which then must have .url)
  16974. return jQuery.ajax( jQuery.extend( {
  16975. url: url,
  16976. type: method,
  16977. dataType: type,
  16978. data: data,
  16979. success: callback
  16980. }, jQuery.isPlainObject( url ) && url ) );
  16981. };
  16982. } );
  16983. jQuery._evalUrl = function( url, options ) {
  16984. return jQuery.ajax( {
  16985. url: url,
  16986. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16987. type: "GET",
  16988. dataType: "script",
  16989. cache: true,
  16990. async: false,
  16991. global: false,
  16992. // Only evaluate the response if it is successful (gh-4126)
  16993. // dataFilter is not invoked for failure responses, so using it instead
  16994. // of the default converter is kludgy but it works.
  16995. converters: {
  16996. "text script": function() {}
  16997. },
  16998. dataFilter: function( response ) {
  16999. jQuery.globalEval( response, options );
  17000. }
  17001. } );
  17002. };
  17003. jQuery.fn.extend( {
  17004. wrapAll: function( html ) {
  17005. var wrap;
  17006. if ( this[ 0 ] ) {
  17007. if ( isFunction( html ) ) {
  17008. html = html.call( this[ 0 ] );
  17009. }
  17010. // The elements to wrap the target around
  17011. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17012. if ( this[ 0 ].parentNode ) {
  17013. wrap.insertBefore( this[ 0 ] );
  17014. }
  17015. wrap.map( function() {
  17016. var elem = this;
  17017. while ( elem.firstElementChild ) {
  17018. elem = elem.firstElementChild;
  17019. }
  17020. return elem;
  17021. } ).append( this );
  17022. }
  17023. return this;
  17024. },
  17025. wrapInner: function( html ) {
  17026. if ( isFunction( html ) ) {
  17027. return this.each( function( i ) {
  17028. jQuery( this ).wrapInner( html.call( this, i ) );
  17029. } );
  17030. }
  17031. return this.each( function() {
  17032. var self = jQuery( this ),
  17033. contents = self.contents();
  17034. if ( contents.length ) {
  17035. contents.wrapAll( html );
  17036. } else {
  17037. self.append( html );
  17038. }
  17039. } );
  17040. },
  17041. wrap: function( html ) {
  17042. var htmlIsFunction = isFunction( html );
  17043. return this.each( function( i ) {
  17044. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17045. } );
  17046. },
  17047. unwrap: function( selector ) {
  17048. this.parent( selector ).not( "body" ).each( function() {
  17049. jQuery( this ).replaceWith( this.childNodes );
  17050. } );
  17051. return this;
  17052. }
  17053. } );
  17054. jQuery.expr.pseudos.hidden = function( elem ) {
  17055. return !jQuery.expr.pseudos.visible( elem );
  17056. };
  17057. jQuery.expr.pseudos.visible = function( elem ) {
  17058. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17059. };
  17060. jQuery.ajaxSettings.xhr = function() {
  17061. try {
  17062. return new window.XMLHttpRequest();
  17063. } catch ( e ) {}
  17064. };
  17065. var xhrSuccessStatus = {
  17066. // File protocol always yields status code 0, assume 200
  17067. 0: 200,
  17068. // Support: IE <=9 only
  17069. // #1450: sometimes IE returns 1223 when it should be 204
  17070. 1223: 204
  17071. },
  17072. xhrSupported = jQuery.ajaxSettings.xhr();
  17073. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17074. support.ajax = xhrSupported = !!xhrSupported;
  17075. jQuery.ajaxTransport( function( options ) {
  17076. var callback, errorCallback;
  17077. // Cross domain only allowed if supported through XMLHttpRequest
  17078. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17079. return {
  17080. send: function( headers, complete ) {
  17081. var i,
  17082. xhr = options.xhr();
  17083. xhr.open(
  17084. options.type,
  17085. options.url,
  17086. options.async,
  17087. options.username,
  17088. options.password
  17089. );
  17090. // Apply custom fields if provided
  17091. if ( options.xhrFields ) {
  17092. for ( i in options.xhrFields ) {
  17093. xhr[ i ] = options.xhrFields[ i ];
  17094. }
  17095. }
  17096. // Override mime type if needed
  17097. if ( options.mimeType && xhr.overrideMimeType ) {
  17098. xhr.overrideMimeType( options.mimeType );
  17099. }
  17100. // X-Requested-With header
  17101. // For cross-domain requests, seeing as conditions for a preflight are
  17102. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17103. // (it can always be set on a per-request basis or even using ajaxSetup)
  17104. // For same-domain requests, won't change header if already provided.
  17105. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17106. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17107. }
  17108. // Set headers
  17109. for ( i in headers ) {
  17110. xhr.setRequestHeader( i, headers[ i ] );
  17111. }
  17112. // Callback
  17113. callback = function( type ) {
  17114. return function() {
  17115. if ( callback ) {
  17116. callback = errorCallback = xhr.onload =
  17117. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17118. xhr.onreadystatechange = null;
  17119. if ( type === "abort" ) {
  17120. xhr.abort();
  17121. } else if ( type === "error" ) {
  17122. // Support: IE <=9 only
  17123. // On a manual native abort, IE9 throws
  17124. // errors on any property access that is not readyState
  17125. if ( typeof xhr.status !== "number" ) {
  17126. complete( 0, "error" );
  17127. } else {
  17128. complete(
  17129. // File: protocol always yields status 0; see #8605, #14207
  17130. xhr.status,
  17131. xhr.statusText
  17132. );
  17133. }
  17134. } else {
  17135. complete(
  17136. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17137. xhr.statusText,
  17138. // Support: IE <=9 only
  17139. // IE9 has no XHR2 but throws on binary (trac-11426)
  17140. // For XHR2 non-text, let the caller handle it (gh-2498)
  17141. ( xhr.responseType || "text" ) !== "text" ||
  17142. typeof xhr.responseText !== "string" ?
  17143. { binary: xhr.response } :
  17144. { text: xhr.responseText },
  17145. xhr.getAllResponseHeaders()
  17146. );
  17147. }
  17148. }
  17149. };
  17150. };
  17151. // Listen to events
  17152. xhr.onload = callback();
  17153. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17154. // Support: IE 9 only
  17155. // Use onreadystatechange to replace onabort
  17156. // to handle uncaught aborts
  17157. if ( xhr.onabort !== undefined ) {
  17158. xhr.onabort = errorCallback;
  17159. } else {
  17160. xhr.onreadystatechange = function() {
  17161. // Check readyState before timeout as it changes
  17162. if ( xhr.readyState === 4 ) {
  17163. // Allow onerror to be called first,
  17164. // but that will not handle a native abort
  17165. // Also, save errorCallback to a variable
  17166. // as xhr.onerror cannot be accessed
  17167. window.setTimeout( function() {
  17168. if ( callback ) {
  17169. errorCallback();
  17170. }
  17171. } );
  17172. }
  17173. };
  17174. }
  17175. // Create the abort callback
  17176. callback = callback( "abort" );
  17177. try {
  17178. // Do send the request (this may raise an exception)
  17179. xhr.send( options.hasContent && options.data || null );
  17180. } catch ( e ) {
  17181. // #14683: Only rethrow if this hasn't been notified as an error yet
  17182. if ( callback ) {
  17183. throw e;
  17184. }
  17185. }
  17186. },
  17187. abort: function() {
  17188. if ( callback ) {
  17189. callback();
  17190. }
  17191. }
  17192. };
  17193. }
  17194. } );
  17195. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17196. jQuery.ajaxPrefilter( function( s ) {
  17197. if ( s.crossDomain ) {
  17198. s.contents.script = false;
  17199. }
  17200. } );
  17201. // Install script dataType
  17202. jQuery.ajaxSetup( {
  17203. accepts: {
  17204. script: "text/javascript, application/javascript, " +
  17205. "application/ecmascript, application/x-ecmascript"
  17206. },
  17207. contents: {
  17208. script: /\b(?:java|ecma)script\b/
  17209. },
  17210. converters: {
  17211. "text script": function( text ) {
  17212. jQuery.globalEval( text );
  17213. return text;
  17214. }
  17215. }
  17216. } );
  17217. // Handle cache's special case and crossDomain
  17218. jQuery.ajaxPrefilter( "script", function( s ) {
  17219. if ( s.cache === undefined ) {
  17220. s.cache = false;
  17221. }
  17222. if ( s.crossDomain ) {
  17223. s.type = "GET";
  17224. }
  17225. } );
  17226. // Bind script tag hack transport
  17227. jQuery.ajaxTransport( "script", function( s ) {
  17228. // This transport only deals with cross domain or forced-by-attrs requests
  17229. if ( s.crossDomain || s.scriptAttrs ) {
  17230. var script, callback;
  17231. return {
  17232. send: function( _, complete ) {
  17233. script = jQuery( "<script>" )
  17234. .attr( s.scriptAttrs || {} )
  17235. .prop( { charset: s.scriptCharset, src: s.url } )
  17236. .on( "load error", callback = function( evt ) {
  17237. script.remove();
  17238. callback = null;
  17239. if ( evt ) {
  17240. complete( evt.type === "error" ? 404 : 200, evt.type );
  17241. }
  17242. } );
  17243. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17244. document.head.appendChild( script[ 0 ] );
  17245. },
  17246. abort: function() {
  17247. if ( callback ) {
  17248. callback();
  17249. }
  17250. }
  17251. };
  17252. }
  17253. } );
  17254. var oldCallbacks = [],
  17255. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17256. // Default jsonp settings
  17257. jQuery.ajaxSetup( {
  17258. jsonp: "callback",
  17259. jsonpCallback: function() {
  17260. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17261. this[ callback ] = true;
  17262. return callback;
  17263. }
  17264. } );
  17265. // Detect, normalize options and install callbacks for jsonp requests
  17266. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17267. var callbackName, overwritten, responseContainer,
  17268. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17269. "url" :
  17270. typeof s.data === "string" &&
  17271. ( s.contentType || "" )
  17272. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17273. rjsonp.test( s.data ) && "data"
  17274. );
  17275. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17276. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17277. // Get callback name, remembering preexisting value associated with it
  17278. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17279. s.jsonpCallback() :
  17280. s.jsonpCallback;
  17281. // Insert callback into url or form data
  17282. if ( jsonProp ) {
  17283. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17284. } else if ( s.jsonp !== false ) {
  17285. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17286. }
  17287. // Use data converter to retrieve json after script execution
  17288. s.converters[ "script json" ] = function() {
  17289. if ( !responseContainer ) {
  17290. jQuery.error( callbackName + " was not called" );
  17291. }
  17292. return responseContainer[ 0 ];
  17293. };
  17294. // Force json dataType
  17295. s.dataTypes[ 0 ] = "json";
  17296. // Install callback
  17297. overwritten = window[ callbackName ];
  17298. window[ callbackName ] = function() {
  17299. responseContainer = arguments;
  17300. };
  17301. // Clean-up function (fires after converters)
  17302. jqXHR.always( function() {
  17303. // If previous value didn't exist - remove it
  17304. if ( overwritten === undefined ) {
  17305. jQuery( window ).removeProp( callbackName );
  17306. // Otherwise restore preexisting value
  17307. } else {
  17308. window[ callbackName ] = overwritten;
  17309. }
  17310. // Save back as free
  17311. if ( s[ callbackName ] ) {
  17312. // Make sure that re-using the options doesn't screw things around
  17313. s.jsonpCallback = originalSettings.jsonpCallback;
  17314. // Save the callback name for future use
  17315. oldCallbacks.push( callbackName );
  17316. }
  17317. // Call if it was a function and we have a response
  17318. if ( responseContainer && isFunction( overwritten ) ) {
  17319. overwritten( responseContainer[ 0 ] );
  17320. }
  17321. responseContainer = overwritten = undefined;
  17322. } );
  17323. // Delegate to script
  17324. return "script";
  17325. }
  17326. } );
  17327. // Support: Safari 8 only
  17328. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17329. // collapse sibling forms: the second one becomes a child of the first one.
  17330. // Because of that, this security measure has to be disabled in Safari 8.
  17331. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17332. support.createHTMLDocument = ( function() {
  17333. var body = document.implementation.createHTMLDocument( "" ).body;
  17334. body.innerHTML = "<form></form><form></form>";
  17335. return body.childNodes.length === 2;
  17336. } )();
  17337. // Argument "data" should be string of html
  17338. // context (optional): If specified, the fragment will be created in this context,
  17339. // defaults to document
  17340. // keepScripts (optional): If true, will include scripts passed in the html string
  17341. jQuery.parseHTML = function( data, context, keepScripts ) {
  17342. if ( typeof data !== "string" ) {
  17343. return [];
  17344. }
  17345. if ( typeof context === "boolean" ) {
  17346. keepScripts = context;
  17347. context = false;
  17348. }
  17349. var base, parsed, scripts;
  17350. if ( !context ) {
  17351. // Stop scripts or inline event handlers from being executed immediately
  17352. // by using document.implementation
  17353. if ( support.createHTMLDocument ) {
  17354. context = document.implementation.createHTMLDocument( "" );
  17355. // Set the base href for the created document
  17356. // so any parsed elements with URLs
  17357. // are based on the document's URL (gh-2965)
  17358. base = context.createElement( "base" );
  17359. base.href = document.location.href;
  17360. context.head.appendChild( base );
  17361. } else {
  17362. context = document;
  17363. }
  17364. }
  17365. parsed = rsingleTag.exec( data );
  17366. scripts = !keepScripts && [];
  17367. // Single tag
  17368. if ( parsed ) {
  17369. return [ context.createElement( parsed[ 1 ] ) ];
  17370. }
  17371. parsed = buildFragment( [ data ], context, scripts );
  17372. if ( scripts && scripts.length ) {
  17373. jQuery( scripts ).remove();
  17374. }
  17375. return jQuery.merge( [], parsed.childNodes );
  17376. };
  17377. /**
  17378. * Load a url into a page
  17379. */
  17380. jQuery.fn.load = function( url, params, callback ) {
  17381. var selector, type, response,
  17382. self = this,
  17383. off = url.indexOf( " " );
  17384. if ( off > -1 ) {
  17385. selector = stripAndCollapse( url.slice( off ) );
  17386. url = url.slice( 0, off );
  17387. }
  17388. // If it's a function
  17389. if ( isFunction( params ) ) {
  17390. // We assume that it's the callback
  17391. callback = params;
  17392. params = undefined;
  17393. // Otherwise, build a param string
  17394. } else if ( params && typeof params === "object" ) {
  17395. type = "POST";
  17396. }
  17397. // If we have elements to modify, make the request
  17398. if ( self.length > 0 ) {
  17399. jQuery.ajax( {
  17400. url: url,
  17401. // If "type" variable is undefined, then "GET" method will be used.
  17402. // Make value of this field explicit since
  17403. // user can override it through ajaxSetup method
  17404. type: type || "GET",
  17405. dataType: "html",
  17406. data: params
  17407. } ).done( function( responseText ) {
  17408. // Save response for use in complete callback
  17409. response = arguments;
  17410. self.html( selector ?
  17411. // If a selector was specified, locate the right elements in a dummy div
  17412. // Exclude scripts to avoid IE 'Permission Denied' errors
  17413. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17414. // Otherwise use the full result
  17415. responseText );
  17416. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17417. // but they are ignored because response was set above.
  17418. // If it fails, this function gets "jqXHR", "status", "error"
  17419. } ).always( callback && function( jqXHR, status ) {
  17420. self.each( function() {
  17421. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17422. } );
  17423. } );
  17424. }
  17425. return this;
  17426. };
  17427. // Attach a bunch of functions for handling common AJAX events
  17428. jQuery.each( [
  17429. "ajaxStart",
  17430. "ajaxStop",
  17431. "ajaxComplete",
  17432. "ajaxError",
  17433. "ajaxSuccess",
  17434. "ajaxSend"
  17435. ], function( i, type ) {
  17436. jQuery.fn[ type ] = function( fn ) {
  17437. return this.on( type, fn );
  17438. };
  17439. } );
  17440. jQuery.expr.pseudos.animated = function( elem ) {
  17441. return jQuery.grep( jQuery.timers, function( fn ) {
  17442. return elem === fn.elem;
  17443. } ).length;
  17444. };
  17445. jQuery.offset = {
  17446. setOffset: function( elem, options, i ) {
  17447. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17448. position = jQuery.css( elem, "position" ),
  17449. curElem = jQuery( elem ),
  17450. props = {};
  17451. // Set position first, in-case top/left are set even on static elem
  17452. if ( position === "static" ) {
  17453. elem.style.position = "relative";
  17454. }
  17455. curOffset = curElem.offset();
  17456. curCSSTop = jQuery.css( elem, "top" );
  17457. curCSSLeft = jQuery.css( elem, "left" );
  17458. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17459. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17460. // Need to be able to calculate position if either
  17461. // top or left is auto and position is either absolute or fixed
  17462. if ( calculatePosition ) {
  17463. curPosition = curElem.position();
  17464. curTop = curPosition.top;
  17465. curLeft = curPosition.left;
  17466. } else {
  17467. curTop = parseFloat( curCSSTop ) || 0;
  17468. curLeft = parseFloat( curCSSLeft ) || 0;
  17469. }
  17470. if ( isFunction( options ) ) {
  17471. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17472. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17473. }
  17474. if ( options.top != null ) {
  17475. props.top = ( options.top - curOffset.top ) + curTop;
  17476. }
  17477. if ( options.left != null ) {
  17478. props.left = ( options.left - curOffset.left ) + curLeft;
  17479. }
  17480. if ( "using" in options ) {
  17481. options.using.call( elem, props );
  17482. } else {
  17483. curElem.css( props );
  17484. }
  17485. }
  17486. };
  17487. jQuery.fn.extend( {
  17488. // offset() relates an element's border box to the document origin
  17489. offset: function( options ) {
  17490. // Preserve chaining for setter
  17491. if ( arguments.length ) {
  17492. return options === undefined ?
  17493. this :
  17494. this.each( function( i ) {
  17495. jQuery.offset.setOffset( this, options, i );
  17496. } );
  17497. }
  17498. var rect, win,
  17499. elem = this[ 0 ];
  17500. if ( !elem ) {
  17501. return;
  17502. }
  17503. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17504. // Support: IE <=11 only
  17505. // Running getBoundingClientRect on a
  17506. // disconnected node in IE throws an error
  17507. if ( !elem.getClientRects().length ) {
  17508. return { top: 0, left: 0 };
  17509. }
  17510. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17511. rect = elem.getBoundingClientRect();
  17512. win = elem.ownerDocument.defaultView;
  17513. return {
  17514. top: rect.top + win.pageYOffset,
  17515. left: rect.left + win.pageXOffset
  17516. };
  17517. },
  17518. // position() relates an element's margin box to its offset parent's padding box
  17519. // This corresponds to the behavior of CSS absolute positioning
  17520. position: function() {
  17521. if ( !this[ 0 ] ) {
  17522. return;
  17523. }
  17524. var offsetParent, offset, doc,
  17525. elem = this[ 0 ],
  17526. parentOffset = { top: 0, left: 0 };
  17527. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17528. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17529. // Assume position:fixed implies availability of getBoundingClientRect
  17530. offset = elem.getBoundingClientRect();
  17531. } else {
  17532. offset = this.offset();
  17533. // Account for the *real* offset parent, which can be the document or its root element
  17534. // when a statically positioned element is identified
  17535. doc = elem.ownerDocument;
  17536. offsetParent = elem.offsetParent || doc.documentElement;
  17537. while ( offsetParent &&
  17538. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17539. jQuery.css( offsetParent, "position" ) === "static" ) {
  17540. offsetParent = offsetParent.parentNode;
  17541. }
  17542. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17543. // Incorporate borders into its offset, since they are outside its content origin
  17544. parentOffset = jQuery( offsetParent ).offset();
  17545. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17546. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17547. }
  17548. }
  17549. // Subtract parent offsets and element margins
  17550. return {
  17551. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17552. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17553. };
  17554. },
  17555. // This method will return documentElement in the following cases:
  17556. // 1) For the element inside the iframe without offsetParent, this method will return
  17557. // documentElement of the parent window
  17558. // 2) For the hidden or detached element
  17559. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17560. //
  17561. // but those exceptions were never presented as a real life use-cases
  17562. // and might be considered as more preferable results.
  17563. //
  17564. // This logic, however, is not guaranteed and can change at any point in the future
  17565. offsetParent: function() {
  17566. return this.map( function() {
  17567. var offsetParent = this.offsetParent;
  17568. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17569. offsetParent = offsetParent.offsetParent;
  17570. }
  17571. return offsetParent || documentElement;
  17572. } );
  17573. }
  17574. } );
  17575. // Create scrollLeft and scrollTop methods
  17576. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17577. var top = "pageYOffset" === prop;
  17578. jQuery.fn[ method ] = function( val ) {
  17579. return access( this, function( elem, method, val ) {
  17580. // Coalesce documents and windows
  17581. var win;
  17582. if ( isWindow( elem ) ) {
  17583. win = elem;
  17584. } else if ( elem.nodeType === 9 ) {
  17585. win = elem.defaultView;
  17586. }
  17587. if ( val === undefined ) {
  17588. return win ? win[ prop ] : elem[ method ];
  17589. }
  17590. if ( win ) {
  17591. win.scrollTo(
  17592. !top ? val : win.pageXOffset,
  17593. top ? val : win.pageYOffset
  17594. );
  17595. } else {
  17596. elem[ method ] = val;
  17597. }
  17598. }, method, val, arguments.length );
  17599. };
  17600. } );
  17601. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17602. // Add the top/left cssHooks using jQuery.fn.position
  17603. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17604. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17605. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17606. // rather than make the css module depend on the offset module, just check for it here
  17607. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17608. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17609. function( elem, computed ) {
  17610. if ( computed ) {
  17611. computed = curCSS( elem, prop );
  17612. // If curCSS returns percentage, fallback to offset
  17613. return rnumnonpx.test( computed ) ?
  17614. jQuery( elem ).position()[ prop ] + "px" :
  17615. computed;
  17616. }
  17617. }
  17618. );
  17619. } );
  17620. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17621. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17622. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17623. function( defaultExtra, funcName ) {
  17624. // Margin is only for outerHeight, outerWidth
  17625. jQuery.fn[ funcName ] = function( margin, value ) {
  17626. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17627. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17628. return access( this, function( elem, type, value ) {
  17629. var doc;
  17630. if ( isWindow( elem ) ) {
  17631. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17632. return funcName.indexOf( "outer" ) === 0 ?
  17633. elem[ "inner" + name ] :
  17634. elem.document.documentElement[ "client" + name ];
  17635. }
  17636. // Get document width or height
  17637. if ( elem.nodeType === 9 ) {
  17638. doc = elem.documentElement;
  17639. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17640. // whichever is greatest
  17641. return Math.max(
  17642. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17643. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17644. doc[ "client" + name ]
  17645. );
  17646. }
  17647. return value === undefined ?
  17648. // Get width or height on the element, requesting but not forcing parseFloat
  17649. jQuery.css( elem, type, extra ) :
  17650. // Set width or height on the element
  17651. jQuery.style( elem, type, value, extra );
  17652. }, type, chainable ? margin : undefined, chainable );
  17653. };
  17654. } );
  17655. } );
  17656. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17657. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17658. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17659. function( i, name ) {
  17660. // Handle event binding
  17661. jQuery.fn[ name ] = function( data, fn ) {
  17662. return arguments.length > 0 ?
  17663. this.on( name, null, data, fn ) :
  17664. this.trigger( name );
  17665. };
  17666. } );
  17667. jQuery.fn.extend( {
  17668. hover: function( fnOver, fnOut ) {
  17669. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17670. }
  17671. } );
  17672. jQuery.fn.extend( {
  17673. bind: function( types, data, fn ) {
  17674. return this.on( types, null, data, fn );
  17675. },
  17676. unbind: function( types, fn ) {
  17677. return this.off( types, null, fn );
  17678. },
  17679. delegate: function( selector, types, data, fn ) {
  17680. return this.on( types, selector, data, fn );
  17681. },
  17682. undelegate: function( selector, types, fn ) {
  17683. // ( namespace ) or ( selector, types [, fn] )
  17684. return arguments.length === 1 ?
  17685. this.off( selector, "**" ) :
  17686. this.off( types, selector || "**", fn );
  17687. }
  17688. } );
  17689. // Bind a function to a context, optionally partially applying any
  17690. // arguments.
  17691. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17692. // However, it is not slated for removal any time soon
  17693. jQuery.proxy = function( fn, context ) {
  17694. var tmp, args, proxy;
  17695. if ( typeof context === "string" ) {
  17696. tmp = fn[ context ];
  17697. context = fn;
  17698. fn = tmp;
  17699. }
  17700. // Quick check to determine if target is callable, in the spec
  17701. // this throws a TypeError, but we will just return undefined.
  17702. if ( !isFunction( fn ) ) {
  17703. return undefined;
  17704. }
  17705. // Simulated bind
  17706. args = slice.call( arguments, 2 );
  17707. proxy = function() {
  17708. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17709. };
  17710. // Set the guid of unique handler to the same of original handler, so it can be removed
  17711. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17712. return proxy;
  17713. };
  17714. jQuery.holdReady = function( hold ) {
  17715. if ( hold ) {
  17716. jQuery.readyWait++;
  17717. } else {
  17718. jQuery.ready( true );
  17719. }
  17720. };
  17721. jQuery.isArray = Array.isArray;
  17722. jQuery.parseJSON = JSON.parse;
  17723. jQuery.nodeName = nodeName;
  17724. jQuery.isFunction = isFunction;
  17725. jQuery.isWindow = isWindow;
  17726. jQuery.camelCase = camelCase;
  17727. jQuery.type = toType;
  17728. jQuery.now = Date.now;
  17729. jQuery.isNumeric = function( obj ) {
  17730. // As of jQuery 3.0, isNumeric is limited to
  17731. // strings and numbers (primitives or objects)
  17732. // that can be coerced to finite numbers (gh-2662)
  17733. var type = jQuery.type( obj );
  17734. return ( type === "number" || type === "string" ) &&
  17735. // parseFloat NaNs numeric-cast false positives ("")
  17736. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17737. // subtraction forces infinities to NaN
  17738. !isNaN( obj - parseFloat( obj ) );
  17739. };
  17740. // Register as a named AMD module, since jQuery can be concatenated with other
  17741. // files that may use define, but not via a proper concatenation script that
  17742. // understands anonymous AMD modules. A named AMD is safest and most robust
  17743. // way to register. Lowercase jquery is used because AMD module names are
  17744. // derived from file names, and jQuery is normally delivered in a lowercase
  17745. // file name. Do this after creating the global so that if an AMD module wants
  17746. // to call noConflict to hide this version of jQuery, it will work.
  17747. // Note that for maximum portability, libraries that are not jQuery should
  17748. // declare themselves as anonymous modules, and avoid setting a global if an
  17749. // AMD loader is present. jQuery is a special case. For more information, see
  17750. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17751. if ( true ) {
  17752. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17753. return jQuery;
  17754. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17755. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17756. }
  17757. var
  17758. // Map over jQuery in case of overwrite
  17759. _jQuery = window.jQuery,
  17760. // Map over the $ in case of overwrite
  17761. _$ = window.$;
  17762. jQuery.noConflict = function( deep ) {
  17763. if ( window.$ === jQuery ) {
  17764. window.$ = _$;
  17765. }
  17766. if ( deep && window.jQuery === jQuery ) {
  17767. window.jQuery = _jQuery;
  17768. }
  17769. return jQuery;
  17770. };
  17771. // Expose jQuery and $ identifiers, even in AMD
  17772. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17773. // and CommonJS for browser emulators (#13566)
  17774. if ( !noGlobal ) {
  17775. window.jQuery = window.$ = jQuery;
  17776. }
  17777. return jQuery;
  17778. } );
  17779. /***/ }),
  17780. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17781. /*!************************************************!*\
  17782. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17783. \************************************************/
  17784. /*! exports provided: default */
  17785. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17786. "use strict";
  17787. __webpack_require__.r(__webpack_exports__);
  17788. var classCallCheck = function (instance, Constructor) {
  17789. if (!(instance instanceof Constructor)) {
  17790. throw new TypeError("Cannot call a class as a function");
  17791. }
  17792. };
  17793. var createClass = function () {
  17794. function defineProperties(target, props) {
  17795. for (var i = 0; i < props.length; i++) {
  17796. var descriptor = props[i];
  17797. descriptor.enumerable = descriptor.enumerable || false;
  17798. descriptor.configurable = true;
  17799. if ("value" in descriptor) descriptor.writable = true;
  17800. Object.defineProperty(target, descriptor.key, descriptor);
  17801. }
  17802. }
  17803. return function (Constructor, protoProps, staticProps) {
  17804. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17805. if (staticProps) defineProperties(Constructor, staticProps);
  17806. return Constructor;
  17807. };
  17808. }();
  17809. var _extends = Object.assign || function (target) {
  17810. for (var i = 1; i < arguments.length; i++) {
  17811. var source = arguments[i];
  17812. for (var key in source) {
  17813. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17814. target[key] = source[key];
  17815. }
  17816. }
  17817. }
  17818. return target;
  17819. };
  17820. var inherits = function (subClass, superClass) {
  17821. if (typeof superClass !== "function" && superClass !== null) {
  17822. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17823. }
  17824. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17825. constructor: {
  17826. value: subClass,
  17827. enumerable: false,
  17828. writable: true,
  17829. configurable: true
  17830. }
  17831. });
  17832. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17833. };
  17834. var possibleConstructorReturn = function (self, call) {
  17835. if (!self) {
  17836. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17837. }
  17838. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17839. };
  17840. var Connector = function () {
  17841. /**
  17842. * Create a new class instance.
  17843. */
  17844. function Connector(options) {
  17845. classCallCheck(this, Connector);
  17846. /**
  17847. * Default connector options.
  17848. */
  17849. this._defaultOptions = {
  17850. auth: {
  17851. headers: {}
  17852. },
  17853. authEndpoint: '/broadcasting/auth',
  17854. broadcaster: 'pusher',
  17855. csrfToken: null,
  17856. host: null,
  17857. key: null,
  17858. namespace: 'App.Events'
  17859. };
  17860. this.setOptions(options);
  17861. this.connect();
  17862. }
  17863. /**
  17864. * Merge the custom options with the defaults.
  17865. */
  17866. createClass(Connector, [{
  17867. key: 'setOptions',
  17868. value: function setOptions(options) {
  17869. this.options = _extends(this._defaultOptions, options);
  17870. if (this.csrfToken()) {
  17871. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17872. }
  17873. return options;
  17874. }
  17875. /**
  17876. * Extract the CSRF token from the page.
  17877. */
  17878. }, {
  17879. key: 'csrfToken',
  17880. value: function csrfToken() {
  17881. var selector = void 0;
  17882. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17883. return window['Laravel'].csrfToken;
  17884. } else if (this.options.csrfToken) {
  17885. return this.options.csrfToken;
  17886. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17887. return selector.getAttribute('content');
  17888. }
  17889. return null;
  17890. }
  17891. }]);
  17892. return Connector;
  17893. }();
  17894. /**
  17895. * This class represents a basic channel.
  17896. */
  17897. var Channel = function () {
  17898. function Channel() {
  17899. classCallCheck(this, Channel);
  17900. }
  17901. createClass(Channel, [{
  17902. key: 'listenForWhisper',
  17903. /**
  17904. * Listen for a whisper event on the channel instance.
  17905. */
  17906. value: function listenForWhisper(event, callback) {
  17907. return this.listen('.client-' + event, callback);
  17908. }
  17909. /**
  17910. * Listen for an event on the channel instance.
  17911. */
  17912. }, {
  17913. key: 'notification',
  17914. value: function notification(callback) {
  17915. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17916. }
  17917. /**
  17918. * Stop listening for a whispser event on the channel instance.
  17919. */
  17920. }, {
  17921. key: 'stopListeningForWhisper',
  17922. value: function stopListeningForWhisper(event) {
  17923. return this.stopListening('.client-' + event);
  17924. }
  17925. }]);
  17926. return Channel;
  17927. }();
  17928. /**
  17929. * Event name formatter
  17930. */
  17931. var EventFormatter = function () {
  17932. /**
  17933. * Create a new class instance.
  17934. */
  17935. function EventFormatter(namespace) {
  17936. classCallCheck(this, EventFormatter);
  17937. this.setNamespace(namespace);
  17938. }
  17939. /**
  17940. * Format the given event name.
  17941. */
  17942. createClass(EventFormatter, [{
  17943. key: 'format',
  17944. value: function format(event) {
  17945. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17946. return event.substr(1);
  17947. } else if (this.namespace) {
  17948. event = this.namespace + '.' + event;
  17949. }
  17950. return event.replace(/\./g, '\\');
  17951. }
  17952. /**
  17953. * Set the event namespace.
  17954. */
  17955. }, {
  17956. key: 'setNamespace',
  17957. value: function setNamespace(value) {
  17958. this.namespace = value;
  17959. }
  17960. }]);
  17961. return EventFormatter;
  17962. }();
  17963. /**
  17964. * This class represents a Pusher channel.
  17965. */
  17966. var PusherChannel = function (_Channel) {
  17967. inherits(PusherChannel, _Channel);
  17968. /**
  17969. * Create a new class instance.
  17970. */
  17971. function PusherChannel(pusher, name, options) {
  17972. classCallCheck(this, PusherChannel);
  17973. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17974. _this.name = name;
  17975. _this.pusher = pusher;
  17976. _this.options = options;
  17977. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17978. _this.subscribe();
  17979. return _this;
  17980. }
  17981. /**
  17982. * Subscribe to a Pusher channel.
  17983. */
  17984. createClass(PusherChannel, [{
  17985. key: 'subscribe',
  17986. value: function subscribe() {
  17987. this.subscription = this.pusher.subscribe(this.name);
  17988. }
  17989. /**
  17990. * Unsubscribe from a Pusher channel.
  17991. */
  17992. }, {
  17993. key: 'unsubscribe',
  17994. value: function unsubscribe() {
  17995. this.pusher.unsubscribe(this.name);
  17996. }
  17997. /**
  17998. * Listen for an event on the channel instance.
  17999. */
  18000. }, {
  18001. key: 'listen',
  18002. value: function listen(event, callback) {
  18003. this.on(this.eventFormatter.format(event), callback);
  18004. return this;
  18005. }
  18006. /**
  18007. * Stop listening for an event on the channel instance.
  18008. */
  18009. }, {
  18010. key: 'stopListening',
  18011. value: function stopListening(event) {
  18012. this.subscription.unbind(this.eventFormatter.format(event));
  18013. return this;
  18014. }
  18015. /**
  18016. * Bind a channel to an event.
  18017. */
  18018. }, {
  18019. key: 'on',
  18020. value: function on(event, callback) {
  18021. this.subscription.bind(event, callback);
  18022. return this;
  18023. }
  18024. }]);
  18025. return PusherChannel;
  18026. }(Channel);
  18027. /**
  18028. * This class represents a Pusher private channel.
  18029. */
  18030. var PusherPrivateChannel = function (_PusherChannel) {
  18031. inherits(PusherPrivateChannel, _PusherChannel);
  18032. function PusherPrivateChannel() {
  18033. classCallCheck(this, PusherPrivateChannel);
  18034. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18035. }
  18036. createClass(PusherPrivateChannel, [{
  18037. key: 'whisper',
  18038. /**
  18039. * Trigger client event on the channel.
  18040. */
  18041. value: function whisper(eventName, data) {
  18042. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18043. return this;
  18044. }
  18045. }]);
  18046. return PusherPrivateChannel;
  18047. }(PusherChannel);
  18048. /**
  18049. * This class represents a Pusher presence channel.
  18050. */
  18051. var PusherPresenceChannel = function (_PusherChannel) {
  18052. inherits(PusherPresenceChannel, _PusherChannel);
  18053. function PusherPresenceChannel() {
  18054. classCallCheck(this, PusherPresenceChannel);
  18055. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18056. }
  18057. createClass(PusherPresenceChannel, [{
  18058. key: 'here',
  18059. /**
  18060. * Register a callback to be called anytime the member list changes.
  18061. */
  18062. value: function here(callback) {
  18063. this.on('pusher:subscription_succeeded', function (data) {
  18064. callback(Object.keys(data.members).map(function (k) {
  18065. return data.members[k];
  18066. }));
  18067. });
  18068. return this;
  18069. }
  18070. /**
  18071. * Listen for someone joining the channel.
  18072. */
  18073. }, {
  18074. key: 'joining',
  18075. value: function joining(callback) {
  18076. this.on('pusher:member_added', function (member) {
  18077. callback(member.info);
  18078. });
  18079. return this;
  18080. }
  18081. /**
  18082. * Listen for someone leaving the channel.
  18083. */
  18084. }, {
  18085. key: 'leaving',
  18086. value: function leaving(callback) {
  18087. this.on('pusher:member_removed', function (member) {
  18088. callback(member.info);
  18089. });
  18090. return this;
  18091. }
  18092. /**
  18093. * Trigger client event on the channel.
  18094. */
  18095. }, {
  18096. key: 'whisper',
  18097. value: function whisper(eventName, data) {
  18098. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18099. return this;
  18100. }
  18101. }]);
  18102. return PusherPresenceChannel;
  18103. }(PusherChannel);
  18104. /**
  18105. * This class represents a Socket.io channel.
  18106. */
  18107. var SocketIoChannel = function (_Channel) {
  18108. inherits(SocketIoChannel, _Channel);
  18109. /**
  18110. * Create a new class instance.
  18111. */
  18112. function SocketIoChannel(socket, name, options) {
  18113. classCallCheck(this, SocketIoChannel);
  18114. /**
  18115. * The event callbacks applied to the channel.
  18116. */
  18117. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18118. _this.events = {};
  18119. _this.name = name;
  18120. _this.socket = socket;
  18121. _this.options = options;
  18122. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18123. _this.subscribe();
  18124. _this.configureReconnector();
  18125. return _this;
  18126. }
  18127. /**
  18128. * Subscribe to a Socket.io channel.
  18129. */
  18130. createClass(SocketIoChannel, [{
  18131. key: 'subscribe',
  18132. value: function subscribe() {
  18133. this.socket.emit('subscribe', {
  18134. channel: this.name,
  18135. auth: this.options.auth || {}
  18136. });
  18137. }
  18138. /**
  18139. * Unsubscribe from channel and ubind event callbacks.
  18140. */
  18141. }, {
  18142. key: 'unsubscribe',
  18143. value: function unsubscribe() {
  18144. this.unbind();
  18145. this.socket.emit('unsubscribe', {
  18146. channel: this.name,
  18147. auth: this.options.auth || {}
  18148. });
  18149. }
  18150. /**
  18151. * Listen for an event on the channel instance.
  18152. */
  18153. }, {
  18154. key: 'listen',
  18155. value: function listen(event, callback) {
  18156. this.on(this.eventFormatter.format(event), callback);
  18157. return this;
  18158. }
  18159. /**
  18160. * Stop listening for an event on the channel instance.
  18161. */
  18162. }, {
  18163. key: 'stopListening',
  18164. value: function stopListening(event) {
  18165. var name = this.eventFormatter.format(event);
  18166. this.socket.removeListener(name);
  18167. delete this.events[name];
  18168. return this;
  18169. }
  18170. /**
  18171. * Bind the channel's socket to an event and store the callback.
  18172. */
  18173. }, {
  18174. key: 'on',
  18175. value: function on(event, callback) {
  18176. var _this2 = this;
  18177. var listener = function listener(channel, data) {
  18178. if (_this2.name == channel) {
  18179. callback(data);
  18180. }
  18181. };
  18182. this.socket.on(event, listener);
  18183. this.bind(event, listener);
  18184. }
  18185. /**
  18186. * Attach a 'reconnect' listener and bind the event.
  18187. */
  18188. }, {
  18189. key: 'configureReconnector',
  18190. value: function configureReconnector() {
  18191. var _this3 = this;
  18192. var listener = function listener() {
  18193. _this3.subscribe();
  18194. };
  18195. this.socket.on('reconnect', listener);
  18196. this.bind('reconnect', listener);
  18197. }
  18198. /**
  18199. * Bind the channel's socket to an event and store the callback.
  18200. */
  18201. }, {
  18202. key: 'bind',
  18203. value: function bind(event, callback) {
  18204. this.events[event] = this.events[event] || [];
  18205. this.events[event].push(callback);
  18206. }
  18207. /**
  18208. * Unbind the channel's socket from all stored event callbacks.
  18209. */
  18210. }, {
  18211. key: 'unbind',
  18212. value: function unbind() {
  18213. var _this4 = this;
  18214. Object.keys(this.events).forEach(function (event) {
  18215. _this4.events[event].forEach(function (callback) {
  18216. _this4.socket.removeListener(event, callback);
  18217. });
  18218. delete _this4.events[event];
  18219. });
  18220. }
  18221. }]);
  18222. return SocketIoChannel;
  18223. }(Channel);
  18224. /**
  18225. * This class represents a Socket.io presence channel.
  18226. */
  18227. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18228. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18229. function SocketIoPrivateChannel() {
  18230. classCallCheck(this, SocketIoPrivateChannel);
  18231. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18232. }
  18233. createClass(SocketIoPrivateChannel, [{
  18234. key: 'whisper',
  18235. /**
  18236. * Trigger client event on the channel.
  18237. */
  18238. value: function whisper(eventName, data) {
  18239. this.socket.emit('client event', {
  18240. channel: this.name,
  18241. event: 'client-' + eventName,
  18242. data: data
  18243. });
  18244. return this;
  18245. }
  18246. }]);
  18247. return SocketIoPrivateChannel;
  18248. }(SocketIoChannel);
  18249. /**
  18250. * This class represents a Socket.io presence channel.
  18251. */
  18252. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18253. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18254. function SocketIoPresenceChannel() {
  18255. classCallCheck(this, SocketIoPresenceChannel);
  18256. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18257. }
  18258. createClass(SocketIoPresenceChannel, [{
  18259. key: 'here',
  18260. /**
  18261. * Register a callback to be called anytime the member list changes.
  18262. */
  18263. value: function here(callback) {
  18264. this.on('presence:subscribed', function (members) {
  18265. callback(members.map(function (m) {
  18266. return m.user_info;
  18267. }));
  18268. });
  18269. return this;
  18270. }
  18271. /**
  18272. * Listen for someone joining the channel.
  18273. */
  18274. }, {
  18275. key: 'joining',
  18276. value: function joining(callback) {
  18277. this.on('presence:joining', function (member) {
  18278. return callback(member.user_info);
  18279. });
  18280. return this;
  18281. }
  18282. /**
  18283. * Listen for someone leaving the channel.
  18284. */
  18285. }, {
  18286. key: 'leaving',
  18287. value: function leaving(callback) {
  18288. this.on('presence:leaving', function (member) {
  18289. return callback(member.user_info);
  18290. });
  18291. return this;
  18292. }
  18293. }]);
  18294. return SocketIoPresenceChannel;
  18295. }(SocketIoPrivateChannel);
  18296. /**
  18297. * This class represents a null channel.
  18298. */
  18299. var NullChannel = function (_Channel) {
  18300. inherits(NullChannel, _Channel);
  18301. function NullChannel() {
  18302. classCallCheck(this, NullChannel);
  18303. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18304. }
  18305. createClass(NullChannel, [{
  18306. key: 'subscribe',
  18307. /**
  18308. * Subscribe to a channel.
  18309. */
  18310. value: function subscribe() {}
  18311. //
  18312. /**
  18313. * Unsubscribe from a channel.
  18314. */
  18315. }, {
  18316. key: 'unsubscribe',
  18317. value: function unsubscribe() {}
  18318. //
  18319. /**
  18320. * Listen for an event on the channel instance.
  18321. */
  18322. }, {
  18323. key: 'listen',
  18324. value: function listen(event, callback) {
  18325. return this;
  18326. }
  18327. /**
  18328. * Stop listening for an event on the channel instance.
  18329. */
  18330. }, {
  18331. key: 'stopListening',
  18332. value: function stopListening(event) {
  18333. return this;
  18334. }
  18335. /**
  18336. * Bind a channel to an event.
  18337. */
  18338. }, {
  18339. key: 'on',
  18340. value: function on(event, callback) {
  18341. return this;
  18342. }
  18343. }]);
  18344. return NullChannel;
  18345. }(Channel);
  18346. /**
  18347. * This class represents a null private channel.
  18348. */
  18349. var NullPrivateChannel = function (_NullChannel) {
  18350. inherits(NullPrivateChannel, _NullChannel);
  18351. function NullPrivateChannel() {
  18352. classCallCheck(this, NullPrivateChannel);
  18353. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18354. }
  18355. createClass(NullPrivateChannel, [{
  18356. key: 'whisper',
  18357. /**
  18358. * Trigger client event on the channel.
  18359. */
  18360. value: function whisper(eventName, data) {
  18361. return this;
  18362. }
  18363. }]);
  18364. return NullPrivateChannel;
  18365. }(NullChannel);
  18366. /**
  18367. * This class represents a null presence channel.
  18368. */
  18369. var NullPresenceChannel = function (_NullChannel) {
  18370. inherits(NullPresenceChannel, _NullChannel);
  18371. function NullPresenceChannel() {
  18372. classCallCheck(this, NullPresenceChannel);
  18373. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18374. }
  18375. createClass(NullPresenceChannel, [{
  18376. key: 'here',
  18377. /**
  18378. * Register a callback to be called anytime the member list changes.
  18379. */
  18380. value: function here(callback) {
  18381. return this;
  18382. }
  18383. /**
  18384. * Listen for someone joining the channel.
  18385. */
  18386. }, {
  18387. key: 'joining',
  18388. value: function joining(callback) {
  18389. return this;
  18390. }
  18391. /**
  18392. * Listen for someone leaving the channel.
  18393. */
  18394. }, {
  18395. key: 'leaving',
  18396. value: function leaving(callback) {
  18397. return this;
  18398. }
  18399. /**
  18400. * Trigger client event on the channel.
  18401. */
  18402. }, {
  18403. key: 'whisper',
  18404. value: function whisper(eventName, data) {
  18405. return this;
  18406. }
  18407. }]);
  18408. return NullPresenceChannel;
  18409. }(NullChannel);
  18410. /**
  18411. * This class creates a connector to Pusher.
  18412. */
  18413. var PusherConnector = function (_Connector) {
  18414. inherits(PusherConnector, _Connector);
  18415. function PusherConnector() {
  18416. classCallCheck(this, PusherConnector);
  18417. /**
  18418. * All of the subscribed channel names.
  18419. */
  18420. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18421. _this.channels = {};
  18422. return _this;
  18423. }
  18424. /**
  18425. * Create a fresh Pusher connection.
  18426. */
  18427. createClass(PusherConnector, [{
  18428. key: 'connect',
  18429. value: function connect() {
  18430. if (typeof this.options.client !== 'undefined') {
  18431. this.pusher = this.options.client;
  18432. } else {
  18433. this.pusher = new Pusher(this.options.key, this.options);
  18434. }
  18435. }
  18436. /**
  18437. * Listen for an event on a channel instance.
  18438. */
  18439. }, {
  18440. key: 'listen',
  18441. value: function listen(name, event, callback) {
  18442. return this.channel(name).listen(event, callback);
  18443. }
  18444. /**
  18445. * Get a channel instance by name.
  18446. */
  18447. }, {
  18448. key: 'channel',
  18449. value: function channel(name) {
  18450. if (!this.channels[name]) {
  18451. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18452. }
  18453. return this.channels[name];
  18454. }
  18455. /**
  18456. * Get a private channel instance by name.
  18457. */
  18458. }, {
  18459. key: 'privateChannel',
  18460. value: function privateChannel(name) {
  18461. if (!this.channels['private-' + name]) {
  18462. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18463. }
  18464. return this.channels['private-' + name];
  18465. }
  18466. /**
  18467. * Get a presence channel instance by name.
  18468. */
  18469. }, {
  18470. key: 'presenceChannel',
  18471. value: function presenceChannel(name) {
  18472. if (!this.channels['presence-' + name]) {
  18473. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18474. }
  18475. return this.channels['presence-' + name];
  18476. }
  18477. /**
  18478. * Leave the given channel, as well as its private and presence variants.
  18479. */
  18480. }, {
  18481. key: 'leave',
  18482. value: function leave(name) {
  18483. var _this2 = this;
  18484. var channels = [name, 'private-' + name, 'presence-' + name];
  18485. channels.forEach(function (name, index) {
  18486. _this2.leaveChannel(name);
  18487. });
  18488. }
  18489. /**
  18490. * Leave the given channel.
  18491. */
  18492. }, {
  18493. key: 'leaveChannel',
  18494. value: function leaveChannel(name) {
  18495. if (this.channels[name]) {
  18496. this.channels[name].unsubscribe();
  18497. delete this.channels[name];
  18498. }
  18499. }
  18500. /**
  18501. * Get the socket ID for the connection.
  18502. */
  18503. }, {
  18504. key: 'socketId',
  18505. value: function socketId() {
  18506. return this.pusher.connection.socket_id;
  18507. }
  18508. /**
  18509. * Disconnect Pusher connection.
  18510. */
  18511. }, {
  18512. key: 'disconnect',
  18513. value: function disconnect() {
  18514. this.pusher.disconnect();
  18515. }
  18516. }]);
  18517. return PusherConnector;
  18518. }(Connector);
  18519. /**
  18520. * This class creates a connnector to a Socket.io server.
  18521. */
  18522. var SocketIoConnector = function (_Connector) {
  18523. inherits(SocketIoConnector, _Connector);
  18524. function SocketIoConnector() {
  18525. classCallCheck(this, SocketIoConnector);
  18526. /**
  18527. * All of the subscribed channel names.
  18528. */
  18529. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18530. _this.channels = {};
  18531. return _this;
  18532. }
  18533. /**
  18534. * Create a fresh Socket.io connection.
  18535. */
  18536. createClass(SocketIoConnector, [{
  18537. key: 'connect',
  18538. value: function connect() {
  18539. var io = this.getSocketIO();
  18540. this.socket = io(this.options.host, this.options);
  18541. return this.socket;
  18542. }
  18543. /**
  18544. * Get socket.io module from global scope or options.
  18545. */
  18546. }, {
  18547. key: 'getSocketIO',
  18548. value: function getSocketIO() {
  18549. if (typeof this.options.client !== 'undefined') {
  18550. return this.options.client;
  18551. }
  18552. if (typeof io !== 'undefined') {
  18553. return io;
  18554. }
  18555. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18556. }
  18557. /**
  18558. * Listen for an event on a channel instance.
  18559. */
  18560. }, {
  18561. key: 'listen',
  18562. value: function listen(name, event, callback) {
  18563. return this.channel(name).listen(event, callback);
  18564. }
  18565. /**
  18566. * Get a channel instance by name.
  18567. */
  18568. }, {
  18569. key: 'channel',
  18570. value: function channel(name) {
  18571. if (!this.channels[name]) {
  18572. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18573. }
  18574. return this.channels[name];
  18575. }
  18576. /**
  18577. * Get a private channel instance by name.
  18578. */
  18579. }, {
  18580. key: 'privateChannel',
  18581. value: function privateChannel(name) {
  18582. if (!this.channels['private-' + name]) {
  18583. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18584. }
  18585. return this.channels['private-' + name];
  18586. }
  18587. /**
  18588. * Get a presence channel instance by name.
  18589. */
  18590. }, {
  18591. key: 'presenceChannel',
  18592. value: function presenceChannel(name) {
  18593. if (!this.channels['presence-' + name]) {
  18594. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18595. }
  18596. return this.channels['presence-' + name];
  18597. }
  18598. /**
  18599. * Leave the given channel, as well as its private and presence variants.
  18600. */
  18601. }, {
  18602. key: 'leave',
  18603. value: function leave(name) {
  18604. var _this2 = this;
  18605. var channels = [name, 'private-' + name, 'presence-' + name];
  18606. channels.forEach(function (name) {
  18607. _this2.leaveChannel(name);
  18608. });
  18609. }
  18610. /**
  18611. * Leave the given channel.
  18612. */
  18613. }, {
  18614. key: 'leaveChannel',
  18615. value: function leaveChannel(name) {
  18616. if (this.channels[name]) {
  18617. this.channels[name].unsubscribe();
  18618. delete this.channels[name];
  18619. }
  18620. }
  18621. /**
  18622. * Get the socket ID for the connection.
  18623. */
  18624. }, {
  18625. key: 'socketId',
  18626. value: function socketId() {
  18627. return this.socket.id;
  18628. }
  18629. /**
  18630. * Disconnect Socketio connection.
  18631. */
  18632. }, {
  18633. key: 'disconnect',
  18634. value: function disconnect() {
  18635. this.socket.disconnect();
  18636. }
  18637. }]);
  18638. return SocketIoConnector;
  18639. }(Connector);
  18640. /**
  18641. * This class creates a null connector.
  18642. */
  18643. var NullConnector = function (_Connector) {
  18644. inherits(NullConnector, _Connector);
  18645. function NullConnector() {
  18646. classCallCheck(this, NullConnector);
  18647. /**
  18648. * All of the subscribed channel names.
  18649. */
  18650. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18651. _this.channels = {};
  18652. return _this;
  18653. }
  18654. /**
  18655. * Create a fresh connection.
  18656. */
  18657. createClass(NullConnector, [{
  18658. key: 'connect',
  18659. value: function connect() {}
  18660. //
  18661. /**
  18662. * Listen for an event on a channel instance.
  18663. */
  18664. }, {
  18665. key: 'listen',
  18666. value: function listen(name, event, callback) {
  18667. return new NullChannel();
  18668. }
  18669. /**
  18670. * Get a channel instance by name.
  18671. */
  18672. }, {
  18673. key: 'channel',
  18674. value: function channel(name) {
  18675. return new NullChannel();
  18676. }
  18677. /**
  18678. * Get a private channel instance by name.
  18679. */
  18680. }, {
  18681. key: 'privateChannel',
  18682. value: function privateChannel(name) {
  18683. return new NullPrivateChannel();
  18684. }
  18685. /**
  18686. * Get a presence channel instance by name.
  18687. */
  18688. }, {
  18689. key: 'presenceChannel',
  18690. value: function presenceChannel(name) {
  18691. return new NullPresenceChannel();
  18692. }
  18693. /**
  18694. * Leave the given channel, as well as its private and presence variants.
  18695. */
  18696. }, {
  18697. key: 'leave',
  18698. value: function leave(name) {}
  18699. //
  18700. /**
  18701. * Leave the given channel.
  18702. */
  18703. }, {
  18704. key: 'leaveChannel',
  18705. value: function leaveChannel(name) {}
  18706. //
  18707. /**
  18708. * Get the socket ID for the connection.
  18709. */
  18710. }, {
  18711. key: 'socketId',
  18712. value: function socketId() {
  18713. return 'fake-socket-id';
  18714. }
  18715. /**
  18716. * Disconnect the connection.
  18717. */
  18718. }, {
  18719. key: 'disconnect',
  18720. value: function disconnect() {
  18721. //
  18722. }
  18723. }]);
  18724. return NullConnector;
  18725. }(Connector);
  18726. /**
  18727. * This class is the primary API for interacting with broadcasting.
  18728. */
  18729. var Echo = function () {
  18730. /**
  18731. * Create a new class instance.
  18732. */
  18733. function Echo(options) {
  18734. classCallCheck(this, Echo);
  18735. this.options = options;
  18736. this.connect();
  18737. if (!this.options.withoutInterceptors) {
  18738. this.registerInterceptors();
  18739. }
  18740. }
  18741. /**
  18742. * Get a channel instance by name.
  18743. */
  18744. createClass(Echo, [{
  18745. key: 'channel',
  18746. value: function channel(_channel) {
  18747. return this.connector.channel(_channel);
  18748. }
  18749. /**
  18750. * Create a new connection.
  18751. */
  18752. }, {
  18753. key: 'connect',
  18754. value: function connect() {
  18755. if (this.options.broadcaster == 'pusher') {
  18756. this.connector = new PusherConnector(this.options);
  18757. } else if (this.options.broadcaster == 'socket.io') {
  18758. this.connector = new SocketIoConnector(this.options);
  18759. } else if (this.options.broadcaster == 'null') {
  18760. this.connector = new NullConnector(this.options);
  18761. } else if (typeof this.options.broadcaster == 'function') {
  18762. this.connector = new this.options.broadcaster(this.options);
  18763. }
  18764. }
  18765. /**
  18766. * Disconnect from the Echo server.
  18767. */
  18768. }, {
  18769. key: 'disconnect',
  18770. value: function disconnect() {
  18771. this.connector.disconnect();
  18772. }
  18773. /**
  18774. * Get a presence channel instance by name.
  18775. */
  18776. }, {
  18777. key: 'join',
  18778. value: function join(channel) {
  18779. return this.connector.presenceChannel(channel);
  18780. }
  18781. /**
  18782. * Leave the given channel, as well as its private and presence variants.
  18783. */
  18784. }, {
  18785. key: 'leave',
  18786. value: function leave(channel) {
  18787. this.connector.leave(channel);
  18788. }
  18789. /**
  18790. * Leave the given channel.
  18791. */
  18792. }, {
  18793. key: 'leaveChannel',
  18794. value: function leaveChannel(channel) {
  18795. this.connector.leaveChannel(channel);
  18796. }
  18797. /**
  18798. * Listen for an event on a channel instance.
  18799. */
  18800. }, {
  18801. key: 'listen',
  18802. value: function listen(channel, event, callback) {
  18803. return this.connector.listen(channel, event, callback);
  18804. }
  18805. /**
  18806. * Get a private channel instance by name.
  18807. */
  18808. }, {
  18809. key: 'private',
  18810. value: function _private(channel) {
  18811. return this.connector.privateChannel(channel);
  18812. }
  18813. /**
  18814. * Get the Socket ID for the connection.
  18815. */
  18816. }, {
  18817. key: 'socketId',
  18818. value: function socketId() {
  18819. return this.connector.socketId();
  18820. }
  18821. /**
  18822. * Register 3rd party request interceptiors. These are used to automatically
  18823. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18824. */
  18825. }, {
  18826. key: 'registerInterceptors',
  18827. value: function registerInterceptors() {
  18828. if (typeof Vue === 'function' && Vue.http) {
  18829. this.registerVueRequestInterceptor();
  18830. }
  18831. if (typeof axios === 'function') {
  18832. this.registerAxiosRequestInterceptor();
  18833. }
  18834. if (typeof jQuery === 'function') {
  18835. this.registerjQueryAjaxSetup();
  18836. }
  18837. }
  18838. /**
  18839. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18840. */
  18841. }, {
  18842. key: 'registerVueRequestInterceptor',
  18843. value: function registerVueRequestInterceptor() {
  18844. var _this = this;
  18845. Vue.http.interceptors.push(function (request, next) {
  18846. if (_this.socketId()) {
  18847. request.headers.set('X-Socket-ID', _this.socketId());
  18848. }
  18849. next();
  18850. });
  18851. }
  18852. /**
  18853. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18854. */
  18855. }, {
  18856. key: 'registerAxiosRequestInterceptor',
  18857. value: function registerAxiosRequestInterceptor() {
  18858. var _this2 = this;
  18859. axios.interceptors.request.use(function (config) {
  18860. if (_this2.socketId()) {
  18861. config.headers['X-Socket-Id'] = _this2.socketId();
  18862. }
  18863. return config;
  18864. });
  18865. }
  18866. /**
  18867. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18868. */
  18869. }, {
  18870. key: 'registerjQueryAjaxSetup',
  18871. value: function registerjQueryAjaxSetup() {
  18872. var _this3 = this;
  18873. if (typeof jQuery.ajax != 'undefined') {
  18874. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18875. if (_this3.socketId()) {
  18876. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18877. }
  18878. });
  18879. }
  18880. }
  18881. }]);
  18882. return Echo;
  18883. }();
  18884. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18885. /***/ }),
  18886. /***/ "./node_modules/lodash/lodash.js":
  18887. /*!***************************************!*\
  18888. !*** ./node_modules/lodash/lodash.js ***!
  18889. \***************************************/
  18890. /*! no static exports found */
  18891. /***/ (function(module, exports, __webpack_require__) {
  18892. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18893. * @license
  18894. * Lodash <https://lodash.com/>
  18895. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18896. * Released under MIT license <https://lodash.com/license>
  18897. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18898. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18899. */
  18900. ;(function() {
  18901. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18902. var undefined;
  18903. /** Used as the semantic version number. */
  18904. var VERSION = '4.17.15';
  18905. /** Used as the size to enable large array optimizations. */
  18906. var LARGE_ARRAY_SIZE = 200;
  18907. /** Error message constants. */
  18908. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18909. FUNC_ERROR_TEXT = 'Expected a function';
  18910. /** Used to stand-in for `undefined` hash values. */
  18911. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18912. /** Used as the maximum memoize cache size. */
  18913. var MAX_MEMOIZE_SIZE = 500;
  18914. /** Used as the internal argument placeholder. */
  18915. var PLACEHOLDER = '__lodash_placeholder__';
  18916. /** Used to compose bitmasks for cloning. */
  18917. var CLONE_DEEP_FLAG = 1,
  18918. CLONE_FLAT_FLAG = 2,
  18919. CLONE_SYMBOLS_FLAG = 4;
  18920. /** Used to compose bitmasks for value comparisons. */
  18921. var COMPARE_PARTIAL_FLAG = 1,
  18922. COMPARE_UNORDERED_FLAG = 2;
  18923. /** Used to compose bitmasks for function metadata. */
  18924. var WRAP_BIND_FLAG = 1,
  18925. WRAP_BIND_KEY_FLAG = 2,
  18926. WRAP_CURRY_BOUND_FLAG = 4,
  18927. WRAP_CURRY_FLAG = 8,
  18928. WRAP_CURRY_RIGHT_FLAG = 16,
  18929. WRAP_PARTIAL_FLAG = 32,
  18930. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18931. WRAP_ARY_FLAG = 128,
  18932. WRAP_REARG_FLAG = 256,
  18933. WRAP_FLIP_FLAG = 512;
  18934. /** Used as default options for `_.truncate`. */
  18935. var DEFAULT_TRUNC_LENGTH = 30,
  18936. DEFAULT_TRUNC_OMISSION = '...';
  18937. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18938. var HOT_COUNT = 800,
  18939. HOT_SPAN = 16;
  18940. /** Used to indicate the type of lazy iteratees. */
  18941. var LAZY_FILTER_FLAG = 1,
  18942. LAZY_MAP_FLAG = 2,
  18943. LAZY_WHILE_FLAG = 3;
  18944. /** Used as references for various `Number` constants. */
  18945. var INFINITY = 1 / 0,
  18946. MAX_SAFE_INTEGER = 9007199254740991,
  18947. MAX_INTEGER = 1.7976931348623157e+308,
  18948. NAN = 0 / 0;
  18949. /** Used as references for the maximum length and index of an array. */
  18950. var MAX_ARRAY_LENGTH = 4294967295,
  18951. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18952. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18953. /** Used to associate wrap methods with their bit flags. */
  18954. var wrapFlags = [
  18955. ['ary', WRAP_ARY_FLAG],
  18956. ['bind', WRAP_BIND_FLAG],
  18957. ['bindKey', WRAP_BIND_KEY_FLAG],
  18958. ['curry', WRAP_CURRY_FLAG],
  18959. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18960. ['flip', WRAP_FLIP_FLAG],
  18961. ['partial', WRAP_PARTIAL_FLAG],
  18962. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18963. ['rearg', WRAP_REARG_FLAG]
  18964. ];
  18965. /** `Object#toString` result references. */
  18966. var argsTag = '[object Arguments]',
  18967. arrayTag = '[object Array]',
  18968. asyncTag = '[object AsyncFunction]',
  18969. boolTag = '[object Boolean]',
  18970. dateTag = '[object Date]',
  18971. domExcTag = '[object DOMException]',
  18972. errorTag = '[object Error]',
  18973. funcTag = '[object Function]',
  18974. genTag = '[object GeneratorFunction]',
  18975. mapTag = '[object Map]',
  18976. numberTag = '[object Number]',
  18977. nullTag = '[object Null]',
  18978. objectTag = '[object Object]',
  18979. promiseTag = '[object Promise]',
  18980. proxyTag = '[object Proxy]',
  18981. regexpTag = '[object RegExp]',
  18982. setTag = '[object Set]',
  18983. stringTag = '[object String]',
  18984. symbolTag = '[object Symbol]',
  18985. undefinedTag = '[object Undefined]',
  18986. weakMapTag = '[object WeakMap]',
  18987. weakSetTag = '[object WeakSet]';
  18988. var arrayBufferTag = '[object ArrayBuffer]',
  18989. dataViewTag = '[object DataView]',
  18990. float32Tag = '[object Float32Array]',
  18991. float64Tag = '[object Float64Array]',
  18992. int8Tag = '[object Int8Array]',
  18993. int16Tag = '[object Int16Array]',
  18994. int32Tag = '[object Int32Array]',
  18995. uint8Tag = '[object Uint8Array]',
  18996. uint8ClampedTag = '[object Uint8ClampedArray]',
  18997. uint16Tag = '[object Uint16Array]',
  18998. uint32Tag = '[object Uint32Array]';
  18999. /** Used to match empty string literals in compiled template source. */
  19000. var reEmptyStringLeading = /\b__p \+= '';/g,
  19001. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19002. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19003. /** Used to match HTML entities and HTML characters. */
  19004. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19005. reUnescapedHtml = /[&<>"']/g,
  19006. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19007. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19008. /** Used to match template delimiters. */
  19009. var reEscape = /<%-([\s\S]+?)%>/g,
  19010. reEvaluate = /<%([\s\S]+?)%>/g,
  19011. reInterpolate = /<%=([\s\S]+?)%>/g;
  19012. /** Used to match property names within property paths. */
  19013. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19014. reIsPlainProp = /^\w*$/,
  19015. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19016. /**
  19017. * Used to match `RegExp`
  19018. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19019. */
  19020. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19021. reHasRegExpChar = RegExp(reRegExpChar.source);
  19022. /** Used to match leading and trailing whitespace. */
  19023. var reTrim = /^\s+|\s+$/g,
  19024. reTrimStart = /^\s+/,
  19025. reTrimEnd = /\s+$/;
  19026. /** Used to match wrap detail comments. */
  19027. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19028. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19029. reSplitDetails = /,? & /;
  19030. /** Used to match words composed of alphanumeric characters. */
  19031. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19032. /** Used to match backslashes in property paths. */
  19033. var reEscapeChar = /\\(\\)?/g;
  19034. /**
  19035. * Used to match
  19036. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19037. */
  19038. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19039. /** Used to match `RegExp` flags from their coerced string values. */
  19040. var reFlags = /\w*$/;
  19041. /** Used to detect bad signed hexadecimal string values. */
  19042. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19043. /** Used to detect binary string values. */
  19044. var reIsBinary = /^0b[01]+$/i;
  19045. /** Used to detect host constructors (Safari). */
  19046. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19047. /** Used to detect octal string values. */
  19048. var reIsOctal = /^0o[0-7]+$/i;
  19049. /** Used to detect unsigned integer values. */
  19050. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19051. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19052. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19053. /** Used to ensure capturing order of template delimiters. */
  19054. var reNoMatch = /($^)/;
  19055. /** Used to match unescaped characters in compiled string literals. */
  19056. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19057. /** Used to compose unicode character classes. */
  19058. var rsAstralRange = '\\ud800-\\udfff',
  19059. rsComboMarksRange = '\\u0300-\\u036f',
  19060. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19061. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19062. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19063. rsDingbatRange = '\\u2700-\\u27bf',
  19064. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19065. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19066. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19067. rsPunctuationRange = '\\u2000-\\u206f',
  19068. 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',
  19069. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19070. rsVarRange = '\\ufe0e\\ufe0f',
  19071. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19072. /** Used to compose unicode capture groups. */
  19073. var rsApos = "['\u2019]",
  19074. rsAstral = '[' + rsAstralRange + ']',
  19075. rsBreak = '[' + rsBreakRange + ']',
  19076. rsCombo = '[' + rsComboRange + ']',
  19077. rsDigits = '\\d+',
  19078. rsDingbat = '[' + rsDingbatRange + ']',
  19079. rsLower = '[' + rsLowerRange + ']',
  19080. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19081. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19082. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19083. rsNonAstral = '[^' + rsAstralRange + ']',
  19084. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19085. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19086. rsUpper = '[' + rsUpperRange + ']',
  19087. rsZWJ = '\\u200d';
  19088. /** Used to compose unicode regexes. */
  19089. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19090. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19091. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19092. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19093. reOptMod = rsModifier + '?',
  19094. rsOptVar = '[' + rsVarRange + ']?',
  19095. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19096. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19097. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19098. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19099. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19100. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19101. /** Used to match apostrophes. */
  19102. var reApos = RegExp(rsApos, 'g');
  19103. /**
  19104. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19105. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19106. */
  19107. var reComboMark = RegExp(rsCombo, 'g');
  19108. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19109. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19110. /** Used to match complex or compound words. */
  19111. var reUnicodeWord = RegExp([
  19112. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19113. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19114. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19115. rsUpper + '+' + rsOptContrUpper,
  19116. rsOrdUpper,
  19117. rsOrdLower,
  19118. rsDigits,
  19119. rsEmoji
  19120. ].join('|'), 'g');
  19121. /** 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/). */
  19122. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19123. /** Used to detect strings that need a more robust regexp to match words. */
  19124. 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 ]/;
  19125. /** Used to assign default `context` object properties. */
  19126. var contextProps = [
  19127. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19128. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19129. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19130. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19131. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19132. ];
  19133. /** Used to make template sourceURLs easier to identify. */
  19134. var templateCounter = -1;
  19135. /** Used to identify `toStringTag` values of typed arrays. */
  19136. var typedArrayTags = {};
  19137. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19138. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19139. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19140. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19141. typedArrayTags[uint32Tag] = true;
  19142. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19143. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19144. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19145. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19146. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19147. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19148. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19149. typedArrayTags[weakMapTag] = false;
  19150. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19151. var cloneableTags = {};
  19152. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19153. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19154. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19155. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19156. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19157. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19158. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19159. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19160. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19161. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19162. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19163. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19164. cloneableTags[weakMapTag] = false;
  19165. /** Used to map Latin Unicode letters to basic Latin letters. */
  19166. var deburredLetters = {
  19167. // Latin-1 Supplement block.
  19168. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19169. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19170. '\xc7': 'C', '\xe7': 'c',
  19171. '\xd0': 'D', '\xf0': 'd',
  19172. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19173. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19174. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19175. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19176. '\xd1': 'N', '\xf1': 'n',
  19177. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19178. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19179. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19180. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19181. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19182. '\xc6': 'Ae', '\xe6': 'ae',
  19183. '\xde': 'Th', '\xfe': 'th',
  19184. '\xdf': 'ss',
  19185. // Latin Extended-A block.
  19186. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19187. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19188. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19189. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19190. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19191. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19192. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19193. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19194. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19195. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19196. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19197. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19198. '\u0134': 'J', '\u0135': 'j',
  19199. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19200. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19201. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19202. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19203. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19204. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19205. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19206. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19207. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19208. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19209. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19210. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19211. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19212. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19213. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19214. '\u0174': 'W', '\u0175': 'w',
  19215. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19216. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19217. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19218. '\u0132': 'IJ', '\u0133': 'ij',
  19219. '\u0152': 'Oe', '\u0153': 'oe',
  19220. '\u0149': "'n", '\u017f': 's'
  19221. };
  19222. /** Used to map characters to HTML entities. */
  19223. var htmlEscapes = {
  19224. '&': '&amp;',
  19225. '<': '&lt;',
  19226. '>': '&gt;',
  19227. '"': '&quot;',
  19228. "'": '&#39;'
  19229. };
  19230. /** Used to map HTML entities to characters. */
  19231. var htmlUnescapes = {
  19232. '&amp;': '&',
  19233. '&lt;': '<',
  19234. '&gt;': '>',
  19235. '&quot;': '"',
  19236. '&#39;': "'"
  19237. };
  19238. /** Used to escape characters for inclusion in compiled string literals. */
  19239. var stringEscapes = {
  19240. '\\': '\\',
  19241. "'": "'",
  19242. '\n': 'n',
  19243. '\r': 'r',
  19244. '\u2028': 'u2028',
  19245. '\u2029': 'u2029'
  19246. };
  19247. /** Built-in method references without a dependency on `root`. */
  19248. var freeParseFloat = parseFloat,
  19249. freeParseInt = parseInt;
  19250. /** Detect free variable `global` from Node.js. */
  19251. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19252. /** Detect free variable `self`. */
  19253. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19254. /** Used as a reference to the global object. */
  19255. var root = freeGlobal || freeSelf || Function('return this')();
  19256. /** Detect free variable `exports`. */
  19257. var freeExports = true && exports && !exports.nodeType && exports;
  19258. /** Detect free variable `module`. */
  19259. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19260. /** Detect the popular CommonJS extension `module.exports`. */
  19261. var moduleExports = freeModule && freeModule.exports === freeExports;
  19262. /** Detect free variable `process` from Node.js. */
  19263. var freeProcess = moduleExports && freeGlobal.process;
  19264. /** Used to access faster Node.js helpers. */
  19265. var nodeUtil = (function() {
  19266. try {
  19267. // Use `util.types` for Node.js 10+.
  19268. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19269. if (types) {
  19270. return types;
  19271. }
  19272. // Legacy `process.binding('util')` for Node.js < 10.
  19273. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19274. } catch (e) {}
  19275. }());
  19276. /* Node.js helper references. */
  19277. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19278. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19279. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19280. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19281. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19282. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19283. /*--------------------------------------------------------------------------*/
  19284. /**
  19285. * A faster alternative to `Function#apply`, this function invokes `func`
  19286. * with the `this` binding of `thisArg` and the arguments of `args`.
  19287. *
  19288. * @private
  19289. * @param {Function} func The function to invoke.
  19290. * @param {*} thisArg The `this` binding of `func`.
  19291. * @param {Array} args The arguments to invoke `func` with.
  19292. * @returns {*} Returns the result of `func`.
  19293. */
  19294. function apply(func, thisArg, args) {
  19295. switch (args.length) {
  19296. case 0: return func.call(thisArg);
  19297. case 1: return func.call(thisArg, args[0]);
  19298. case 2: return func.call(thisArg, args[0], args[1]);
  19299. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19300. }
  19301. return func.apply(thisArg, args);
  19302. }
  19303. /**
  19304. * A specialized version of `baseAggregator` for arrays.
  19305. *
  19306. * @private
  19307. * @param {Array} [array] The array to iterate over.
  19308. * @param {Function} setter The function to set `accumulator` values.
  19309. * @param {Function} iteratee The iteratee to transform keys.
  19310. * @param {Object} accumulator The initial aggregated object.
  19311. * @returns {Function} Returns `accumulator`.
  19312. */
  19313. function arrayAggregator(array, setter, iteratee, accumulator) {
  19314. var index = -1,
  19315. length = array == null ? 0 : array.length;
  19316. while (++index < length) {
  19317. var value = array[index];
  19318. setter(accumulator, value, iteratee(value), array);
  19319. }
  19320. return accumulator;
  19321. }
  19322. /**
  19323. * A specialized version of `_.forEach` for arrays without support for
  19324. * iteratee shorthands.
  19325. *
  19326. * @private
  19327. * @param {Array} [array] The array to iterate over.
  19328. * @param {Function} iteratee The function invoked per iteration.
  19329. * @returns {Array} Returns `array`.
  19330. */
  19331. function arrayEach(array, iteratee) {
  19332. var index = -1,
  19333. length = array == null ? 0 : array.length;
  19334. while (++index < length) {
  19335. if (iteratee(array[index], index, array) === false) {
  19336. break;
  19337. }
  19338. }
  19339. return array;
  19340. }
  19341. /**
  19342. * A specialized version of `_.forEachRight` for arrays without support for
  19343. * iteratee shorthands.
  19344. *
  19345. * @private
  19346. * @param {Array} [array] The array to iterate over.
  19347. * @param {Function} iteratee The function invoked per iteration.
  19348. * @returns {Array} Returns `array`.
  19349. */
  19350. function arrayEachRight(array, iteratee) {
  19351. var length = array == null ? 0 : array.length;
  19352. while (length--) {
  19353. if (iteratee(array[length], length, array) === false) {
  19354. break;
  19355. }
  19356. }
  19357. return array;
  19358. }
  19359. /**
  19360. * A specialized version of `_.every` for arrays without support for
  19361. * iteratee shorthands.
  19362. *
  19363. * @private
  19364. * @param {Array} [array] The array to iterate over.
  19365. * @param {Function} predicate The function invoked per iteration.
  19366. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19367. * else `false`.
  19368. */
  19369. function arrayEvery(array, predicate) {
  19370. var index = -1,
  19371. length = array == null ? 0 : array.length;
  19372. while (++index < length) {
  19373. if (!predicate(array[index], index, array)) {
  19374. return false;
  19375. }
  19376. }
  19377. return true;
  19378. }
  19379. /**
  19380. * A specialized version of `_.filter` for arrays without support for
  19381. * iteratee shorthands.
  19382. *
  19383. * @private
  19384. * @param {Array} [array] The array to iterate over.
  19385. * @param {Function} predicate The function invoked per iteration.
  19386. * @returns {Array} Returns the new filtered array.
  19387. */
  19388. function arrayFilter(array, predicate) {
  19389. var index = -1,
  19390. length = array == null ? 0 : array.length,
  19391. resIndex = 0,
  19392. result = [];
  19393. while (++index < length) {
  19394. var value = array[index];
  19395. if (predicate(value, index, array)) {
  19396. result[resIndex++] = value;
  19397. }
  19398. }
  19399. return result;
  19400. }
  19401. /**
  19402. * A specialized version of `_.includes` for arrays without support for
  19403. * specifying an index to search from.
  19404. *
  19405. * @private
  19406. * @param {Array} [array] The array to inspect.
  19407. * @param {*} target The value to search for.
  19408. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19409. */
  19410. function arrayIncludes(array, value) {
  19411. var length = array == null ? 0 : array.length;
  19412. return !!length && baseIndexOf(array, value, 0) > -1;
  19413. }
  19414. /**
  19415. * This function is like `arrayIncludes` except that it accepts a comparator.
  19416. *
  19417. * @private
  19418. * @param {Array} [array] The array to inspect.
  19419. * @param {*} target The value to search for.
  19420. * @param {Function} comparator The comparator invoked per element.
  19421. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19422. */
  19423. function arrayIncludesWith(array, value, comparator) {
  19424. var index = -1,
  19425. length = array == null ? 0 : array.length;
  19426. while (++index < length) {
  19427. if (comparator(value, array[index])) {
  19428. return true;
  19429. }
  19430. }
  19431. return false;
  19432. }
  19433. /**
  19434. * A specialized version of `_.map` for arrays without support for iteratee
  19435. * shorthands.
  19436. *
  19437. * @private
  19438. * @param {Array} [array] The array to iterate over.
  19439. * @param {Function} iteratee The function invoked per iteration.
  19440. * @returns {Array} Returns the new mapped array.
  19441. */
  19442. function arrayMap(array, iteratee) {
  19443. var index = -1,
  19444. length = array == null ? 0 : array.length,
  19445. result = Array(length);
  19446. while (++index < length) {
  19447. result[index] = iteratee(array[index], index, array);
  19448. }
  19449. return result;
  19450. }
  19451. /**
  19452. * Appends the elements of `values` to `array`.
  19453. *
  19454. * @private
  19455. * @param {Array} array The array to modify.
  19456. * @param {Array} values The values to append.
  19457. * @returns {Array} Returns `array`.
  19458. */
  19459. function arrayPush(array, values) {
  19460. var index = -1,
  19461. length = values.length,
  19462. offset = array.length;
  19463. while (++index < length) {
  19464. array[offset + index] = values[index];
  19465. }
  19466. return array;
  19467. }
  19468. /**
  19469. * A specialized version of `_.reduce` for arrays without support for
  19470. * iteratee shorthands.
  19471. *
  19472. * @private
  19473. * @param {Array} [array] The array to iterate over.
  19474. * @param {Function} iteratee The function invoked per iteration.
  19475. * @param {*} [accumulator] The initial value.
  19476. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19477. * the initial value.
  19478. * @returns {*} Returns the accumulated value.
  19479. */
  19480. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19481. var index = -1,
  19482. length = array == null ? 0 : array.length;
  19483. if (initAccum && length) {
  19484. accumulator = array[++index];
  19485. }
  19486. while (++index < length) {
  19487. accumulator = iteratee(accumulator, array[index], index, array);
  19488. }
  19489. return accumulator;
  19490. }
  19491. /**
  19492. * A specialized version of `_.reduceRight` for arrays without support for
  19493. * iteratee shorthands.
  19494. *
  19495. * @private
  19496. * @param {Array} [array] The array to iterate over.
  19497. * @param {Function} iteratee The function invoked per iteration.
  19498. * @param {*} [accumulator] The initial value.
  19499. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19500. * the initial value.
  19501. * @returns {*} Returns the accumulated value.
  19502. */
  19503. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19504. var length = array == null ? 0 : array.length;
  19505. if (initAccum && length) {
  19506. accumulator = array[--length];
  19507. }
  19508. while (length--) {
  19509. accumulator = iteratee(accumulator, array[length], length, array);
  19510. }
  19511. return accumulator;
  19512. }
  19513. /**
  19514. * A specialized version of `_.some` for arrays without support for iteratee
  19515. * shorthands.
  19516. *
  19517. * @private
  19518. * @param {Array} [array] The array to iterate over.
  19519. * @param {Function} predicate The function invoked per iteration.
  19520. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19521. * else `false`.
  19522. */
  19523. function arraySome(array, predicate) {
  19524. var index = -1,
  19525. length = array == null ? 0 : array.length;
  19526. while (++index < length) {
  19527. if (predicate(array[index], index, array)) {
  19528. return true;
  19529. }
  19530. }
  19531. return false;
  19532. }
  19533. /**
  19534. * Gets the size of an ASCII `string`.
  19535. *
  19536. * @private
  19537. * @param {string} string The string inspect.
  19538. * @returns {number} Returns the string size.
  19539. */
  19540. var asciiSize = baseProperty('length');
  19541. /**
  19542. * Converts an ASCII `string` to an array.
  19543. *
  19544. * @private
  19545. * @param {string} string The string to convert.
  19546. * @returns {Array} Returns the converted array.
  19547. */
  19548. function asciiToArray(string) {
  19549. return string.split('');
  19550. }
  19551. /**
  19552. * Splits an ASCII `string` into an array of its words.
  19553. *
  19554. * @private
  19555. * @param {string} The string to inspect.
  19556. * @returns {Array} Returns the words of `string`.
  19557. */
  19558. function asciiWords(string) {
  19559. return string.match(reAsciiWord) || [];
  19560. }
  19561. /**
  19562. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19563. * without support for iteratee shorthands, which iterates over `collection`
  19564. * using `eachFunc`.
  19565. *
  19566. * @private
  19567. * @param {Array|Object} collection The collection to inspect.
  19568. * @param {Function} predicate The function invoked per iteration.
  19569. * @param {Function} eachFunc The function to iterate over `collection`.
  19570. * @returns {*} Returns the found element or its key, else `undefined`.
  19571. */
  19572. function baseFindKey(collection, predicate, eachFunc) {
  19573. var result;
  19574. eachFunc(collection, function(value, key, collection) {
  19575. if (predicate(value, key, collection)) {
  19576. result = key;
  19577. return false;
  19578. }
  19579. });
  19580. return result;
  19581. }
  19582. /**
  19583. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19584. * support for iteratee shorthands.
  19585. *
  19586. * @private
  19587. * @param {Array} array The array to inspect.
  19588. * @param {Function} predicate The function invoked per iteration.
  19589. * @param {number} fromIndex The index to search from.
  19590. * @param {boolean} [fromRight] Specify iterating from right to left.
  19591. * @returns {number} Returns the index of the matched value, else `-1`.
  19592. */
  19593. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19594. var length = array.length,
  19595. index = fromIndex + (fromRight ? 1 : -1);
  19596. while ((fromRight ? index-- : ++index < length)) {
  19597. if (predicate(array[index], index, array)) {
  19598. return index;
  19599. }
  19600. }
  19601. return -1;
  19602. }
  19603. /**
  19604. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19605. *
  19606. * @private
  19607. * @param {Array} array The array to inspect.
  19608. * @param {*} value The value to search for.
  19609. * @param {number} fromIndex The index to search from.
  19610. * @returns {number} Returns the index of the matched value, else `-1`.
  19611. */
  19612. function baseIndexOf(array, value, fromIndex) {
  19613. return value === value
  19614. ? strictIndexOf(array, value, fromIndex)
  19615. : baseFindIndex(array, baseIsNaN, fromIndex);
  19616. }
  19617. /**
  19618. * This function is like `baseIndexOf` except that it accepts a comparator.
  19619. *
  19620. * @private
  19621. * @param {Array} array The array to inspect.
  19622. * @param {*} value The value to search for.
  19623. * @param {number} fromIndex The index to search from.
  19624. * @param {Function} comparator The comparator invoked per element.
  19625. * @returns {number} Returns the index of the matched value, else `-1`.
  19626. */
  19627. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19628. var index = fromIndex - 1,
  19629. length = array.length;
  19630. while (++index < length) {
  19631. if (comparator(array[index], value)) {
  19632. return index;
  19633. }
  19634. }
  19635. return -1;
  19636. }
  19637. /**
  19638. * The base implementation of `_.isNaN` without support for number objects.
  19639. *
  19640. * @private
  19641. * @param {*} value The value to check.
  19642. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19643. */
  19644. function baseIsNaN(value) {
  19645. return value !== value;
  19646. }
  19647. /**
  19648. * The base implementation of `_.mean` and `_.meanBy` without support for
  19649. * iteratee shorthands.
  19650. *
  19651. * @private
  19652. * @param {Array} array The array to iterate over.
  19653. * @param {Function} iteratee The function invoked per iteration.
  19654. * @returns {number} Returns the mean.
  19655. */
  19656. function baseMean(array, iteratee) {
  19657. var length = array == null ? 0 : array.length;
  19658. return length ? (baseSum(array, iteratee) / length) : NAN;
  19659. }
  19660. /**
  19661. * The base implementation of `_.property` without support for deep paths.
  19662. *
  19663. * @private
  19664. * @param {string} key The key of the property to get.
  19665. * @returns {Function} Returns the new accessor function.
  19666. */
  19667. function baseProperty(key) {
  19668. return function(object) {
  19669. return object == null ? undefined : object[key];
  19670. };
  19671. }
  19672. /**
  19673. * The base implementation of `_.propertyOf` without support for deep paths.
  19674. *
  19675. * @private
  19676. * @param {Object} object The object to query.
  19677. * @returns {Function} Returns the new accessor function.
  19678. */
  19679. function basePropertyOf(object) {
  19680. return function(key) {
  19681. return object == null ? undefined : object[key];
  19682. };
  19683. }
  19684. /**
  19685. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19686. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19687. *
  19688. * @private
  19689. * @param {Array|Object} collection The collection to iterate over.
  19690. * @param {Function} iteratee The function invoked per iteration.
  19691. * @param {*} accumulator The initial value.
  19692. * @param {boolean} initAccum Specify using the first or last element of
  19693. * `collection` as the initial value.
  19694. * @param {Function} eachFunc The function to iterate over `collection`.
  19695. * @returns {*} Returns the accumulated value.
  19696. */
  19697. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19698. eachFunc(collection, function(value, index, collection) {
  19699. accumulator = initAccum
  19700. ? (initAccum = false, value)
  19701. : iteratee(accumulator, value, index, collection);
  19702. });
  19703. return accumulator;
  19704. }
  19705. /**
  19706. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19707. * sort order of `array` and replaces criteria objects with their corresponding
  19708. * values.
  19709. *
  19710. * @private
  19711. * @param {Array} array The array to sort.
  19712. * @param {Function} comparer The function to define sort order.
  19713. * @returns {Array} Returns `array`.
  19714. */
  19715. function baseSortBy(array, comparer) {
  19716. var length = array.length;
  19717. array.sort(comparer);
  19718. while (length--) {
  19719. array[length] = array[length].value;
  19720. }
  19721. return array;
  19722. }
  19723. /**
  19724. * The base implementation of `_.sum` and `_.sumBy` without support for
  19725. * iteratee shorthands.
  19726. *
  19727. * @private
  19728. * @param {Array} array The array to iterate over.
  19729. * @param {Function} iteratee The function invoked per iteration.
  19730. * @returns {number} Returns the sum.
  19731. */
  19732. function baseSum(array, iteratee) {
  19733. var result,
  19734. index = -1,
  19735. length = array.length;
  19736. while (++index < length) {
  19737. var current = iteratee(array[index]);
  19738. if (current !== undefined) {
  19739. result = result === undefined ? current : (result + current);
  19740. }
  19741. }
  19742. return result;
  19743. }
  19744. /**
  19745. * The base implementation of `_.times` without support for iteratee shorthands
  19746. * or max array length checks.
  19747. *
  19748. * @private
  19749. * @param {number} n The number of times to invoke `iteratee`.
  19750. * @param {Function} iteratee The function invoked per iteration.
  19751. * @returns {Array} Returns the array of results.
  19752. */
  19753. function baseTimes(n, iteratee) {
  19754. var index = -1,
  19755. result = Array(n);
  19756. while (++index < n) {
  19757. result[index] = iteratee(index);
  19758. }
  19759. return result;
  19760. }
  19761. /**
  19762. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19763. * of key-value pairs for `object` corresponding to the property names of `props`.
  19764. *
  19765. * @private
  19766. * @param {Object} object The object to query.
  19767. * @param {Array} props The property names to get values for.
  19768. * @returns {Object} Returns the key-value pairs.
  19769. */
  19770. function baseToPairs(object, props) {
  19771. return arrayMap(props, function(key) {
  19772. return [key, object[key]];
  19773. });
  19774. }
  19775. /**
  19776. * The base implementation of `_.unary` without support for storing metadata.
  19777. *
  19778. * @private
  19779. * @param {Function} func The function to cap arguments for.
  19780. * @returns {Function} Returns the new capped function.
  19781. */
  19782. function baseUnary(func) {
  19783. return function(value) {
  19784. return func(value);
  19785. };
  19786. }
  19787. /**
  19788. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19789. * array of `object` property values corresponding to the property names
  19790. * of `props`.
  19791. *
  19792. * @private
  19793. * @param {Object} object The object to query.
  19794. * @param {Array} props The property names to get values for.
  19795. * @returns {Object} Returns the array of property values.
  19796. */
  19797. function baseValues(object, props) {
  19798. return arrayMap(props, function(key) {
  19799. return object[key];
  19800. });
  19801. }
  19802. /**
  19803. * Checks if a `cache` value for `key` exists.
  19804. *
  19805. * @private
  19806. * @param {Object} cache The cache to query.
  19807. * @param {string} key The key of the entry to check.
  19808. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19809. */
  19810. function cacheHas(cache, key) {
  19811. return cache.has(key);
  19812. }
  19813. /**
  19814. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19815. * that is not found in the character symbols.
  19816. *
  19817. * @private
  19818. * @param {Array} strSymbols The string symbols to inspect.
  19819. * @param {Array} chrSymbols The character symbols to find.
  19820. * @returns {number} Returns the index of the first unmatched string symbol.
  19821. */
  19822. function charsStartIndex(strSymbols, chrSymbols) {
  19823. var index = -1,
  19824. length = strSymbols.length;
  19825. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19826. return index;
  19827. }
  19828. /**
  19829. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19830. * that is not found in the character symbols.
  19831. *
  19832. * @private
  19833. * @param {Array} strSymbols The string symbols to inspect.
  19834. * @param {Array} chrSymbols The character symbols to find.
  19835. * @returns {number} Returns the index of the last unmatched string symbol.
  19836. */
  19837. function charsEndIndex(strSymbols, chrSymbols) {
  19838. var index = strSymbols.length;
  19839. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19840. return index;
  19841. }
  19842. /**
  19843. * Gets the number of `placeholder` occurrences in `array`.
  19844. *
  19845. * @private
  19846. * @param {Array} array The array to inspect.
  19847. * @param {*} placeholder The placeholder to search for.
  19848. * @returns {number} Returns the placeholder count.
  19849. */
  19850. function countHolders(array, placeholder) {
  19851. var length = array.length,
  19852. result = 0;
  19853. while (length--) {
  19854. if (array[length] === placeholder) {
  19855. ++result;
  19856. }
  19857. }
  19858. return result;
  19859. }
  19860. /**
  19861. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19862. * letters to basic Latin letters.
  19863. *
  19864. * @private
  19865. * @param {string} letter The matched letter to deburr.
  19866. * @returns {string} Returns the deburred letter.
  19867. */
  19868. var deburrLetter = basePropertyOf(deburredLetters);
  19869. /**
  19870. * Used by `_.escape` to convert characters to HTML entities.
  19871. *
  19872. * @private
  19873. * @param {string} chr The matched character to escape.
  19874. * @returns {string} Returns the escaped character.
  19875. */
  19876. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19877. /**
  19878. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19879. *
  19880. * @private
  19881. * @param {string} chr The matched character to escape.
  19882. * @returns {string} Returns the escaped character.
  19883. */
  19884. function escapeStringChar(chr) {
  19885. return '\\' + stringEscapes[chr];
  19886. }
  19887. /**
  19888. * Gets the value at `key` of `object`.
  19889. *
  19890. * @private
  19891. * @param {Object} [object] The object to query.
  19892. * @param {string} key The key of the property to get.
  19893. * @returns {*} Returns the property value.
  19894. */
  19895. function getValue(object, key) {
  19896. return object == null ? undefined : object[key];
  19897. }
  19898. /**
  19899. * Checks if `string` contains Unicode symbols.
  19900. *
  19901. * @private
  19902. * @param {string} string The string to inspect.
  19903. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19904. */
  19905. function hasUnicode(string) {
  19906. return reHasUnicode.test(string);
  19907. }
  19908. /**
  19909. * Checks if `string` contains a word composed of Unicode symbols.
  19910. *
  19911. * @private
  19912. * @param {string} string The string to inspect.
  19913. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19914. */
  19915. function hasUnicodeWord(string) {
  19916. return reHasUnicodeWord.test(string);
  19917. }
  19918. /**
  19919. * Converts `iterator` to an array.
  19920. *
  19921. * @private
  19922. * @param {Object} iterator The iterator to convert.
  19923. * @returns {Array} Returns the converted array.
  19924. */
  19925. function iteratorToArray(iterator) {
  19926. var data,
  19927. result = [];
  19928. while (!(data = iterator.next()).done) {
  19929. result.push(data.value);
  19930. }
  19931. return result;
  19932. }
  19933. /**
  19934. * Converts `map` to its key-value pairs.
  19935. *
  19936. * @private
  19937. * @param {Object} map The map to convert.
  19938. * @returns {Array} Returns the key-value pairs.
  19939. */
  19940. function mapToArray(map) {
  19941. var index = -1,
  19942. result = Array(map.size);
  19943. map.forEach(function(value, key) {
  19944. result[++index] = [key, value];
  19945. });
  19946. return result;
  19947. }
  19948. /**
  19949. * Creates a unary function that invokes `func` with its argument transformed.
  19950. *
  19951. * @private
  19952. * @param {Function} func The function to wrap.
  19953. * @param {Function} transform The argument transform.
  19954. * @returns {Function} Returns the new function.
  19955. */
  19956. function overArg(func, transform) {
  19957. return function(arg) {
  19958. return func(transform(arg));
  19959. };
  19960. }
  19961. /**
  19962. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19963. * and returns an array of their indexes.
  19964. *
  19965. * @private
  19966. * @param {Array} array The array to modify.
  19967. * @param {*} placeholder The placeholder to replace.
  19968. * @returns {Array} Returns the new array of placeholder indexes.
  19969. */
  19970. function replaceHolders(array, placeholder) {
  19971. var index = -1,
  19972. length = array.length,
  19973. resIndex = 0,
  19974. result = [];
  19975. while (++index < length) {
  19976. var value = array[index];
  19977. if (value === placeholder || value === PLACEHOLDER) {
  19978. array[index] = PLACEHOLDER;
  19979. result[resIndex++] = index;
  19980. }
  19981. }
  19982. return result;
  19983. }
  19984. /**
  19985. * Converts `set` to an array of its values.
  19986. *
  19987. * @private
  19988. * @param {Object} set The set to convert.
  19989. * @returns {Array} Returns the values.
  19990. */
  19991. function setToArray(set) {
  19992. var index = -1,
  19993. result = Array(set.size);
  19994. set.forEach(function(value) {
  19995. result[++index] = value;
  19996. });
  19997. return result;
  19998. }
  19999. /**
  20000. * Converts `set` to its value-value pairs.
  20001. *
  20002. * @private
  20003. * @param {Object} set The set to convert.
  20004. * @returns {Array} Returns the value-value pairs.
  20005. */
  20006. function setToPairs(set) {
  20007. var index = -1,
  20008. result = Array(set.size);
  20009. set.forEach(function(value) {
  20010. result[++index] = [value, value];
  20011. });
  20012. return result;
  20013. }
  20014. /**
  20015. * A specialized version of `_.indexOf` which performs strict equality
  20016. * comparisons of values, i.e. `===`.
  20017. *
  20018. * @private
  20019. * @param {Array} array The array to inspect.
  20020. * @param {*} value The value to search for.
  20021. * @param {number} fromIndex The index to search from.
  20022. * @returns {number} Returns the index of the matched value, else `-1`.
  20023. */
  20024. function strictIndexOf(array, value, fromIndex) {
  20025. var index = fromIndex - 1,
  20026. length = array.length;
  20027. while (++index < length) {
  20028. if (array[index] === value) {
  20029. return index;
  20030. }
  20031. }
  20032. return -1;
  20033. }
  20034. /**
  20035. * A specialized version of `_.lastIndexOf` which performs strict equality
  20036. * comparisons of values, i.e. `===`.
  20037. *
  20038. * @private
  20039. * @param {Array} array The array to inspect.
  20040. * @param {*} value The value to search for.
  20041. * @param {number} fromIndex The index to search from.
  20042. * @returns {number} Returns the index of the matched value, else `-1`.
  20043. */
  20044. function strictLastIndexOf(array, value, fromIndex) {
  20045. var index = fromIndex + 1;
  20046. while (index--) {
  20047. if (array[index] === value) {
  20048. return index;
  20049. }
  20050. }
  20051. return index;
  20052. }
  20053. /**
  20054. * Gets the number of symbols in `string`.
  20055. *
  20056. * @private
  20057. * @param {string} string The string to inspect.
  20058. * @returns {number} Returns the string size.
  20059. */
  20060. function stringSize(string) {
  20061. return hasUnicode(string)
  20062. ? unicodeSize(string)
  20063. : asciiSize(string);
  20064. }
  20065. /**
  20066. * Converts `string` to an array.
  20067. *
  20068. * @private
  20069. * @param {string} string The string to convert.
  20070. * @returns {Array} Returns the converted array.
  20071. */
  20072. function stringToArray(string) {
  20073. return hasUnicode(string)
  20074. ? unicodeToArray(string)
  20075. : asciiToArray(string);
  20076. }
  20077. /**
  20078. * Used by `_.unescape` to convert HTML entities to characters.
  20079. *
  20080. * @private
  20081. * @param {string} chr The matched character to unescape.
  20082. * @returns {string} Returns the unescaped character.
  20083. */
  20084. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20085. /**
  20086. * Gets the size of a Unicode `string`.
  20087. *
  20088. * @private
  20089. * @param {string} string The string inspect.
  20090. * @returns {number} Returns the string size.
  20091. */
  20092. function unicodeSize(string) {
  20093. var result = reUnicode.lastIndex = 0;
  20094. while (reUnicode.test(string)) {
  20095. ++result;
  20096. }
  20097. return result;
  20098. }
  20099. /**
  20100. * Converts a Unicode `string` to an array.
  20101. *
  20102. * @private
  20103. * @param {string} string The string to convert.
  20104. * @returns {Array} Returns the converted array.
  20105. */
  20106. function unicodeToArray(string) {
  20107. return string.match(reUnicode) || [];
  20108. }
  20109. /**
  20110. * Splits a Unicode `string` into an array of its words.
  20111. *
  20112. * @private
  20113. * @param {string} The string to inspect.
  20114. * @returns {Array} Returns the words of `string`.
  20115. */
  20116. function unicodeWords(string) {
  20117. return string.match(reUnicodeWord) || [];
  20118. }
  20119. /*--------------------------------------------------------------------------*/
  20120. /**
  20121. * Create a new pristine `lodash` function using the `context` object.
  20122. *
  20123. * @static
  20124. * @memberOf _
  20125. * @since 1.1.0
  20126. * @category Util
  20127. * @param {Object} [context=root] The context object.
  20128. * @returns {Function} Returns a new `lodash` function.
  20129. * @example
  20130. *
  20131. * _.mixin({ 'foo': _.constant('foo') });
  20132. *
  20133. * var lodash = _.runInContext();
  20134. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20135. *
  20136. * _.isFunction(_.foo);
  20137. * // => true
  20138. * _.isFunction(_.bar);
  20139. * // => false
  20140. *
  20141. * lodash.isFunction(lodash.foo);
  20142. * // => false
  20143. * lodash.isFunction(lodash.bar);
  20144. * // => true
  20145. *
  20146. * // Create a suped-up `defer` in Node.js.
  20147. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20148. */
  20149. var runInContext = (function runInContext(context) {
  20150. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20151. /** Built-in constructor references. */
  20152. var Array = context.Array,
  20153. Date = context.Date,
  20154. Error = context.Error,
  20155. Function = context.Function,
  20156. Math = context.Math,
  20157. Object = context.Object,
  20158. RegExp = context.RegExp,
  20159. String = context.String,
  20160. TypeError = context.TypeError;
  20161. /** Used for built-in method references. */
  20162. var arrayProto = Array.prototype,
  20163. funcProto = Function.prototype,
  20164. objectProto = Object.prototype;
  20165. /** Used to detect overreaching core-js shims. */
  20166. var coreJsData = context['__core-js_shared__'];
  20167. /** Used to resolve the decompiled source of functions. */
  20168. var funcToString = funcProto.toString;
  20169. /** Used to check objects for own properties. */
  20170. var hasOwnProperty = objectProto.hasOwnProperty;
  20171. /** Used to generate unique IDs. */
  20172. var idCounter = 0;
  20173. /** Used to detect methods masquerading as native. */
  20174. var maskSrcKey = (function() {
  20175. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20176. return uid ? ('Symbol(src)_1.' + uid) : '';
  20177. }());
  20178. /**
  20179. * Used to resolve the
  20180. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20181. * of values.
  20182. */
  20183. var nativeObjectToString = objectProto.toString;
  20184. /** Used to infer the `Object` constructor. */
  20185. var objectCtorString = funcToString.call(Object);
  20186. /** Used to restore the original `_` reference in `_.noConflict`. */
  20187. var oldDash = root._;
  20188. /** Used to detect if a method is native. */
  20189. var reIsNative = RegExp('^' +
  20190. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20191. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20192. );
  20193. /** Built-in value references. */
  20194. var Buffer = moduleExports ? context.Buffer : undefined,
  20195. Symbol = context.Symbol,
  20196. Uint8Array = context.Uint8Array,
  20197. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20198. getPrototype = overArg(Object.getPrototypeOf, Object),
  20199. objectCreate = Object.create,
  20200. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20201. splice = arrayProto.splice,
  20202. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20203. symIterator = Symbol ? Symbol.iterator : undefined,
  20204. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20205. var defineProperty = (function() {
  20206. try {
  20207. var func = getNative(Object, 'defineProperty');
  20208. func({}, '', {});
  20209. return func;
  20210. } catch (e) {}
  20211. }());
  20212. /** Mocked built-ins. */
  20213. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20214. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20215. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20216. /* Built-in method references for those with the same name as other `lodash` methods. */
  20217. var nativeCeil = Math.ceil,
  20218. nativeFloor = Math.floor,
  20219. nativeGetSymbols = Object.getOwnPropertySymbols,
  20220. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20221. nativeIsFinite = context.isFinite,
  20222. nativeJoin = arrayProto.join,
  20223. nativeKeys = overArg(Object.keys, Object),
  20224. nativeMax = Math.max,
  20225. nativeMin = Math.min,
  20226. nativeNow = Date.now,
  20227. nativeParseInt = context.parseInt,
  20228. nativeRandom = Math.random,
  20229. nativeReverse = arrayProto.reverse;
  20230. /* Built-in method references that are verified to be native. */
  20231. var DataView = getNative(context, 'DataView'),
  20232. Map = getNative(context, 'Map'),
  20233. Promise = getNative(context, 'Promise'),
  20234. Set = getNative(context, 'Set'),
  20235. WeakMap = getNative(context, 'WeakMap'),
  20236. nativeCreate = getNative(Object, 'create');
  20237. /** Used to store function metadata. */
  20238. var metaMap = WeakMap && new WeakMap;
  20239. /** Used to lookup unminified function names. */
  20240. var realNames = {};
  20241. /** Used to detect maps, sets, and weakmaps. */
  20242. var dataViewCtorString = toSource(DataView),
  20243. mapCtorString = toSource(Map),
  20244. promiseCtorString = toSource(Promise),
  20245. setCtorString = toSource(Set),
  20246. weakMapCtorString = toSource(WeakMap);
  20247. /** Used to convert symbols to primitives and strings. */
  20248. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20249. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20250. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20251. /*------------------------------------------------------------------------*/
  20252. /**
  20253. * Creates a `lodash` object which wraps `value` to enable implicit method
  20254. * chain sequences. Methods that operate on and return arrays, collections,
  20255. * and functions can be chained together. Methods that retrieve a single value
  20256. * or may return a primitive value will automatically end the chain sequence
  20257. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20258. * with `_#value`.
  20259. *
  20260. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20261. * enabled using `_.chain`.
  20262. *
  20263. * The execution of chained methods is lazy, that is, it's deferred until
  20264. * `_#value` is implicitly or explicitly called.
  20265. *
  20266. * Lazy evaluation allows several methods to support shortcut fusion.
  20267. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20268. * the creation of intermediate arrays and can greatly reduce the number of
  20269. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20270. * fusion if the section is applied to an array and iteratees accept only
  20271. * one argument. The heuristic for whether a section qualifies for shortcut
  20272. * fusion is subject to change.
  20273. *
  20274. * Chaining is supported in custom builds as long as the `_#value` method is
  20275. * directly or indirectly included in the build.
  20276. *
  20277. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20278. *
  20279. * The wrapper `Array` methods are:
  20280. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20281. *
  20282. * The wrapper `String` methods are:
  20283. * `replace` and `split`
  20284. *
  20285. * The wrapper methods that support shortcut fusion are:
  20286. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20287. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20288. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20289. *
  20290. * The chainable wrapper methods are:
  20291. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20292. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20293. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20294. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20295. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20296. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20297. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20298. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20299. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20300. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20301. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20302. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20303. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20304. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20305. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20306. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20307. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20308. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20309. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20310. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20311. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20312. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20313. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20314. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20315. *
  20316. * The wrapper methods that are **not** chainable by default are:
  20317. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20318. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20319. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20320. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20321. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20322. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20323. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20324. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20325. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20326. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20327. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20328. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20329. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20330. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20331. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20332. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20333. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20334. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20335. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20336. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20337. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20338. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20339. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20340. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20341. * `upperFirst`, `value`, and `words`
  20342. *
  20343. * @name _
  20344. * @constructor
  20345. * @category Seq
  20346. * @param {*} value The value to wrap in a `lodash` instance.
  20347. * @returns {Object} Returns the new `lodash` wrapper instance.
  20348. * @example
  20349. *
  20350. * function square(n) {
  20351. * return n * n;
  20352. * }
  20353. *
  20354. * var wrapped = _([1, 2, 3]);
  20355. *
  20356. * // Returns an unwrapped value.
  20357. * wrapped.reduce(_.add);
  20358. * // => 6
  20359. *
  20360. * // Returns a wrapped value.
  20361. * var squares = wrapped.map(square);
  20362. *
  20363. * _.isArray(squares);
  20364. * // => false
  20365. *
  20366. * _.isArray(squares.value());
  20367. * // => true
  20368. */
  20369. function lodash(value) {
  20370. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20371. if (value instanceof LodashWrapper) {
  20372. return value;
  20373. }
  20374. if (hasOwnProperty.call(value, '__wrapped__')) {
  20375. return wrapperClone(value);
  20376. }
  20377. }
  20378. return new LodashWrapper(value);
  20379. }
  20380. /**
  20381. * The base implementation of `_.create` without support for assigning
  20382. * properties to the created object.
  20383. *
  20384. * @private
  20385. * @param {Object} proto The object to inherit from.
  20386. * @returns {Object} Returns the new object.
  20387. */
  20388. var baseCreate = (function() {
  20389. function object() {}
  20390. return function(proto) {
  20391. if (!isObject(proto)) {
  20392. return {};
  20393. }
  20394. if (objectCreate) {
  20395. return objectCreate(proto);
  20396. }
  20397. object.prototype = proto;
  20398. var result = new object;
  20399. object.prototype = undefined;
  20400. return result;
  20401. };
  20402. }());
  20403. /**
  20404. * The function whose prototype chain sequence wrappers inherit from.
  20405. *
  20406. * @private
  20407. */
  20408. function baseLodash() {
  20409. // No operation performed.
  20410. }
  20411. /**
  20412. * The base constructor for creating `lodash` wrapper objects.
  20413. *
  20414. * @private
  20415. * @param {*} value The value to wrap.
  20416. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20417. */
  20418. function LodashWrapper(value, chainAll) {
  20419. this.__wrapped__ = value;
  20420. this.__actions__ = [];
  20421. this.__chain__ = !!chainAll;
  20422. this.__index__ = 0;
  20423. this.__values__ = undefined;
  20424. }
  20425. /**
  20426. * By default, the template delimiters used by lodash are like those in
  20427. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20428. * following template settings to use alternative delimiters.
  20429. *
  20430. * @static
  20431. * @memberOf _
  20432. * @type {Object}
  20433. */
  20434. lodash.templateSettings = {
  20435. /**
  20436. * Used to detect `data` property values to be HTML-escaped.
  20437. *
  20438. * @memberOf _.templateSettings
  20439. * @type {RegExp}
  20440. */
  20441. 'escape': reEscape,
  20442. /**
  20443. * Used to detect code to be evaluated.
  20444. *
  20445. * @memberOf _.templateSettings
  20446. * @type {RegExp}
  20447. */
  20448. 'evaluate': reEvaluate,
  20449. /**
  20450. * Used to detect `data` property values to inject.
  20451. *
  20452. * @memberOf _.templateSettings
  20453. * @type {RegExp}
  20454. */
  20455. 'interpolate': reInterpolate,
  20456. /**
  20457. * Used to reference the data object in the template text.
  20458. *
  20459. * @memberOf _.templateSettings
  20460. * @type {string}
  20461. */
  20462. 'variable': '',
  20463. /**
  20464. * Used to import variables into the compiled template.
  20465. *
  20466. * @memberOf _.templateSettings
  20467. * @type {Object}
  20468. */
  20469. 'imports': {
  20470. /**
  20471. * A reference to the `lodash` function.
  20472. *
  20473. * @memberOf _.templateSettings.imports
  20474. * @type {Function}
  20475. */
  20476. '_': lodash
  20477. }
  20478. };
  20479. // Ensure wrappers are instances of `baseLodash`.
  20480. lodash.prototype = baseLodash.prototype;
  20481. lodash.prototype.constructor = lodash;
  20482. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20483. LodashWrapper.prototype.constructor = LodashWrapper;
  20484. /*------------------------------------------------------------------------*/
  20485. /**
  20486. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20487. *
  20488. * @private
  20489. * @constructor
  20490. * @param {*} value The value to wrap.
  20491. */
  20492. function LazyWrapper(value) {
  20493. this.__wrapped__ = value;
  20494. this.__actions__ = [];
  20495. this.__dir__ = 1;
  20496. this.__filtered__ = false;
  20497. this.__iteratees__ = [];
  20498. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20499. this.__views__ = [];
  20500. }
  20501. /**
  20502. * Creates a clone of the lazy wrapper object.
  20503. *
  20504. * @private
  20505. * @name clone
  20506. * @memberOf LazyWrapper
  20507. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20508. */
  20509. function lazyClone() {
  20510. var result = new LazyWrapper(this.__wrapped__);
  20511. result.__actions__ = copyArray(this.__actions__);
  20512. result.__dir__ = this.__dir__;
  20513. result.__filtered__ = this.__filtered__;
  20514. result.__iteratees__ = copyArray(this.__iteratees__);
  20515. result.__takeCount__ = this.__takeCount__;
  20516. result.__views__ = copyArray(this.__views__);
  20517. return result;
  20518. }
  20519. /**
  20520. * Reverses the direction of lazy iteration.
  20521. *
  20522. * @private
  20523. * @name reverse
  20524. * @memberOf LazyWrapper
  20525. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20526. */
  20527. function lazyReverse() {
  20528. if (this.__filtered__) {
  20529. var result = new LazyWrapper(this);
  20530. result.__dir__ = -1;
  20531. result.__filtered__ = true;
  20532. } else {
  20533. result = this.clone();
  20534. result.__dir__ *= -1;
  20535. }
  20536. return result;
  20537. }
  20538. /**
  20539. * Extracts the unwrapped value from its lazy wrapper.
  20540. *
  20541. * @private
  20542. * @name value
  20543. * @memberOf LazyWrapper
  20544. * @returns {*} Returns the unwrapped value.
  20545. */
  20546. function lazyValue() {
  20547. var array = this.__wrapped__.value(),
  20548. dir = this.__dir__,
  20549. isArr = isArray(array),
  20550. isRight = dir < 0,
  20551. arrLength = isArr ? array.length : 0,
  20552. view = getView(0, arrLength, this.__views__),
  20553. start = view.start,
  20554. end = view.end,
  20555. length = end - start,
  20556. index = isRight ? end : (start - 1),
  20557. iteratees = this.__iteratees__,
  20558. iterLength = iteratees.length,
  20559. resIndex = 0,
  20560. takeCount = nativeMin(length, this.__takeCount__);
  20561. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20562. return baseWrapperValue(array, this.__actions__);
  20563. }
  20564. var result = [];
  20565. outer:
  20566. while (length-- && resIndex < takeCount) {
  20567. index += dir;
  20568. var iterIndex = -1,
  20569. value = array[index];
  20570. while (++iterIndex < iterLength) {
  20571. var data = iteratees[iterIndex],
  20572. iteratee = data.iteratee,
  20573. type = data.type,
  20574. computed = iteratee(value);
  20575. if (type == LAZY_MAP_FLAG) {
  20576. value = computed;
  20577. } else if (!computed) {
  20578. if (type == LAZY_FILTER_FLAG) {
  20579. continue outer;
  20580. } else {
  20581. break outer;
  20582. }
  20583. }
  20584. }
  20585. result[resIndex++] = value;
  20586. }
  20587. return result;
  20588. }
  20589. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20590. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20591. LazyWrapper.prototype.constructor = LazyWrapper;
  20592. /*------------------------------------------------------------------------*/
  20593. /**
  20594. * Creates a hash object.
  20595. *
  20596. * @private
  20597. * @constructor
  20598. * @param {Array} [entries] The key-value pairs to cache.
  20599. */
  20600. function Hash(entries) {
  20601. var index = -1,
  20602. length = entries == null ? 0 : entries.length;
  20603. this.clear();
  20604. while (++index < length) {
  20605. var entry = entries[index];
  20606. this.set(entry[0], entry[1]);
  20607. }
  20608. }
  20609. /**
  20610. * Removes all key-value entries from the hash.
  20611. *
  20612. * @private
  20613. * @name clear
  20614. * @memberOf Hash
  20615. */
  20616. function hashClear() {
  20617. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20618. this.size = 0;
  20619. }
  20620. /**
  20621. * Removes `key` and its value from the hash.
  20622. *
  20623. * @private
  20624. * @name delete
  20625. * @memberOf Hash
  20626. * @param {Object} hash The hash to modify.
  20627. * @param {string} key The key of the value to remove.
  20628. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20629. */
  20630. function hashDelete(key) {
  20631. var result = this.has(key) && delete this.__data__[key];
  20632. this.size -= result ? 1 : 0;
  20633. return result;
  20634. }
  20635. /**
  20636. * Gets the hash value for `key`.
  20637. *
  20638. * @private
  20639. * @name get
  20640. * @memberOf Hash
  20641. * @param {string} key The key of the value to get.
  20642. * @returns {*} Returns the entry value.
  20643. */
  20644. function hashGet(key) {
  20645. var data = this.__data__;
  20646. if (nativeCreate) {
  20647. var result = data[key];
  20648. return result === HASH_UNDEFINED ? undefined : result;
  20649. }
  20650. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20651. }
  20652. /**
  20653. * Checks if a hash value for `key` exists.
  20654. *
  20655. * @private
  20656. * @name has
  20657. * @memberOf Hash
  20658. * @param {string} key The key of the entry to check.
  20659. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20660. */
  20661. function hashHas(key) {
  20662. var data = this.__data__;
  20663. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20664. }
  20665. /**
  20666. * Sets the hash `key` to `value`.
  20667. *
  20668. * @private
  20669. * @name set
  20670. * @memberOf Hash
  20671. * @param {string} key The key of the value to set.
  20672. * @param {*} value The value to set.
  20673. * @returns {Object} Returns the hash instance.
  20674. */
  20675. function hashSet(key, value) {
  20676. var data = this.__data__;
  20677. this.size += this.has(key) ? 0 : 1;
  20678. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20679. return this;
  20680. }
  20681. // Add methods to `Hash`.
  20682. Hash.prototype.clear = hashClear;
  20683. Hash.prototype['delete'] = hashDelete;
  20684. Hash.prototype.get = hashGet;
  20685. Hash.prototype.has = hashHas;
  20686. Hash.prototype.set = hashSet;
  20687. /*------------------------------------------------------------------------*/
  20688. /**
  20689. * Creates an list cache object.
  20690. *
  20691. * @private
  20692. * @constructor
  20693. * @param {Array} [entries] The key-value pairs to cache.
  20694. */
  20695. function ListCache(entries) {
  20696. var index = -1,
  20697. length = entries == null ? 0 : entries.length;
  20698. this.clear();
  20699. while (++index < length) {
  20700. var entry = entries[index];
  20701. this.set(entry[0], entry[1]);
  20702. }
  20703. }
  20704. /**
  20705. * Removes all key-value entries from the list cache.
  20706. *
  20707. * @private
  20708. * @name clear
  20709. * @memberOf ListCache
  20710. */
  20711. function listCacheClear() {
  20712. this.__data__ = [];
  20713. this.size = 0;
  20714. }
  20715. /**
  20716. * Removes `key` and its value from the list cache.
  20717. *
  20718. * @private
  20719. * @name delete
  20720. * @memberOf ListCache
  20721. * @param {string} key The key of the value to remove.
  20722. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20723. */
  20724. function listCacheDelete(key) {
  20725. var data = this.__data__,
  20726. index = assocIndexOf(data, key);
  20727. if (index < 0) {
  20728. return false;
  20729. }
  20730. var lastIndex = data.length - 1;
  20731. if (index == lastIndex) {
  20732. data.pop();
  20733. } else {
  20734. splice.call(data, index, 1);
  20735. }
  20736. --this.size;
  20737. return true;
  20738. }
  20739. /**
  20740. * Gets the list cache value for `key`.
  20741. *
  20742. * @private
  20743. * @name get
  20744. * @memberOf ListCache
  20745. * @param {string} key The key of the value to get.
  20746. * @returns {*} Returns the entry value.
  20747. */
  20748. function listCacheGet(key) {
  20749. var data = this.__data__,
  20750. index = assocIndexOf(data, key);
  20751. return index < 0 ? undefined : data[index][1];
  20752. }
  20753. /**
  20754. * Checks if a list cache value for `key` exists.
  20755. *
  20756. * @private
  20757. * @name has
  20758. * @memberOf ListCache
  20759. * @param {string} key The key of the entry to check.
  20760. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20761. */
  20762. function listCacheHas(key) {
  20763. return assocIndexOf(this.__data__, key) > -1;
  20764. }
  20765. /**
  20766. * Sets the list cache `key` to `value`.
  20767. *
  20768. * @private
  20769. * @name set
  20770. * @memberOf ListCache
  20771. * @param {string} key The key of the value to set.
  20772. * @param {*} value The value to set.
  20773. * @returns {Object} Returns the list cache instance.
  20774. */
  20775. function listCacheSet(key, value) {
  20776. var data = this.__data__,
  20777. index = assocIndexOf(data, key);
  20778. if (index < 0) {
  20779. ++this.size;
  20780. data.push([key, value]);
  20781. } else {
  20782. data[index][1] = value;
  20783. }
  20784. return this;
  20785. }
  20786. // Add methods to `ListCache`.
  20787. ListCache.prototype.clear = listCacheClear;
  20788. ListCache.prototype['delete'] = listCacheDelete;
  20789. ListCache.prototype.get = listCacheGet;
  20790. ListCache.prototype.has = listCacheHas;
  20791. ListCache.prototype.set = listCacheSet;
  20792. /*------------------------------------------------------------------------*/
  20793. /**
  20794. * Creates a map cache object to store key-value pairs.
  20795. *
  20796. * @private
  20797. * @constructor
  20798. * @param {Array} [entries] The key-value pairs to cache.
  20799. */
  20800. function MapCache(entries) {
  20801. var index = -1,
  20802. length = entries == null ? 0 : entries.length;
  20803. this.clear();
  20804. while (++index < length) {
  20805. var entry = entries[index];
  20806. this.set(entry[0], entry[1]);
  20807. }
  20808. }
  20809. /**
  20810. * Removes all key-value entries from the map.
  20811. *
  20812. * @private
  20813. * @name clear
  20814. * @memberOf MapCache
  20815. */
  20816. function mapCacheClear() {
  20817. this.size = 0;
  20818. this.__data__ = {
  20819. 'hash': new Hash,
  20820. 'map': new (Map || ListCache),
  20821. 'string': new Hash
  20822. };
  20823. }
  20824. /**
  20825. * Removes `key` and its value from the map.
  20826. *
  20827. * @private
  20828. * @name delete
  20829. * @memberOf MapCache
  20830. * @param {string} key The key of the value to remove.
  20831. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20832. */
  20833. function mapCacheDelete(key) {
  20834. var result = getMapData(this, key)['delete'](key);
  20835. this.size -= result ? 1 : 0;
  20836. return result;
  20837. }
  20838. /**
  20839. * Gets the map value for `key`.
  20840. *
  20841. * @private
  20842. * @name get
  20843. * @memberOf MapCache
  20844. * @param {string} key The key of the value to get.
  20845. * @returns {*} Returns the entry value.
  20846. */
  20847. function mapCacheGet(key) {
  20848. return getMapData(this, key).get(key);
  20849. }
  20850. /**
  20851. * Checks if a map value for `key` exists.
  20852. *
  20853. * @private
  20854. * @name has
  20855. * @memberOf MapCache
  20856. * @param {string} key The key of the entry to check.
  20857. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20858. */
  20859. function mapCacheHas(key) {
  20860. return getMapData(this, key).has(key);
  20861. }
  20862. /**
  20863. * Sets the map `key` to `value`.
  20864. *
  20865. * @private
  20866. * @name set
  20867. * @memberOf MapCache
  20868. * @param {string} key The key of the value to set.
  20869. * @param {*} value The value to set.
  20870. * @returns {Object} Returns the map cache instance.
  20871. */
  20872. function mapCacheSet(key, value) {
  20873. var data = getMapData(this, key),
  20874. size = data.size;
  20875. data.set(key, value);
  20876. this.size += data.size == size ? 0 : 1;
  20877. return this;
  20878. }
  20879. // Add methods to `MapCache`.
  20880. MapCache.prototype.clear = mapCacheClear;
  20881. MapCache.prototype['delete'] = mapCacheDelete;
  20882. MapCache.prototype.get = mapCacheGet;
  20883. MapCache.prototype.has = mapCacheHas;
  20884. MapCache.prototype.set = mapCacheSet;
  20885. /*------------------------------------------------------------------------*/
  20886. /**
  20887. *
  20888. * Creates an array cache object to store unique values.
  20889. *
  20890. * @private
  20891. * @constructor
  20892. * @param {Array} [values] The values to cache.
  20893. */
  20894. function SetCache(values) {
  20895. var index = -1,
  20896. length = values == null ? 0 : values.length;
  20897. this.__data__ = new MapCache;
  20898. while (++index < length) {
  20899. this.add(values[index]);
  20900. }
  20901. }
  20902. /**
  20903. * Adds `value` to the array cache.
  20904. *
  20905. * @private
  20906. * @name add
  20907. * @memberOf SetCache
  20908. * @alias push
  20909. * @param {*} value The value to cache.
  20910. * @returns {Object} Returns the cache instance.
  20911. */
  20912. function setCacheAdd(value) {
  20913. this.__data__.set(value, HASH_UNDEFINED);
  20914. return this;
  20915. }
  20916. /**
  20917. * Checks if `value` is in the array cache.
  20918. *
  20919. * @private
  20920. * @name has
  20921. * @memberOf SetCache
  20922. * @param {*} value The value to search for.
  20923. * @returns {number} Returns `true` if `value` is found, else `false`.
  20924. */
  20925. function setCacheHas(value) {
  20926. return this.__data__.has(value);
  20927. }
  20928. // Add methods to `SetCache`.
  20929. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20930. SetCache.prototype.has = setCacheHas;
  20931. /*------------------------------------------------------------------------*/
  20932. /**
  20933. * Creates a stack cache object to store key-value pairs.
  20934. *
  20935. * @private
  20936. * @constructor
  20937. * @param {Array} [entries] The key-value pairs to cache.
  20938. */
  20939. function Stack(entries) {
  20940. var data = this.__data__ = new ListCache(entries);
  20941. this.size = data.size;
  20942. }
  20943. /**
  20944. * Removes all key-value entries from the stack.
  20945. *
  20946. * @private
  20947. * @name clear
  20948. * @memberOf Stack
  20949. */
  20950. function stackClear() {
  20951. this.__data__ = new ListCache;
  20952. this.size = 0;
  20953. }
  20954. /**
  20955. * Removes `key` and its value from the stack.
  20956. *
  20957. * @private
  20958. * @name delete
  20959. * @memberOf Stack
  20960. * @param {string} key The key of the value to remove.
  20961. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20962. */
  20963. function stackDelete(key) {
  20964. var data = this.__data__,
  20965. result = data['delete'](key);
  20966. this.size = data.size;
  20967. return result;
  20968. }
  20969. /**
  20970. * Gets the stack value for `key`.
  20971. *
  20972. * @private
  20973. * @name get
  20974. * @memberOf Stack
  20975. * @param {string} key The key of the value to get.
  20976. * @returns {*} Returns the entry value.
  20977. */
  20978. function stackGet(key) {
  20979. return this.__data__.get(key);
  20980. }
  20981. /**
  20982. * Checks if a stack value for `key` exists.
  20983. *
  20984. * @private
  20985. * @name has
  20986. * @memberOf Stack
  20987. * @param {string} key The key of the entry to check.
  20988. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20989. */
  20990. function stackHas(key) {
  20991. return this.__data__.has(key);
  20992. }
  20993. /**
  20994. * Sets the stack `key` to `value`.
  20995. *
  20996. * @private
  20997. * @name set
  20998. * @memberOf Stack
  20999. * @param {string} key The key of the value to set.
  21000. * @param {*} value The value to set.
  21001. * @returns {Object} Returns the stack cache instance.
  21002. */
  21003. function stackSet(key, value) {
  21004. var data = this.__data__;
  21005. if (data instanceof ListCache) {
  21006. var pairs = data.__data__;
  21007. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21008. pairs.push([key, value]);
  21009. this.size = ++data.size;
  21010. return this;
  21011. }
  21012. data = this.__data__ = new MapCache(pairs);
  21013. }
  21014. data.set(key, value);
  21015. this.size = data.size;
  21016. return this;
  21017. }
  21018. // Add methods to `Stack`.
  21019. Stack.prototype.clear = stackClear;
  21020. Stack.prototype['delete'] = stackDelete;
  21021. Stack.prototype.get = stackGet;
  21022. Stack.prototype.has = stackHas;
  21023. Stack.prototype.set = stackSet;
  21024. /*------------------------------------------------------------------------*/
  21025. /**
  21026. * Creates an array of the enumerable property names of the array-like `value`.
  21027. *
  21028. * @private
  21029. * @param {*} value The value to query.
  21030. * @param {boolean} inherited Specify returning inherited property names.
  21031. * @returns {Array} Returns the array of property names.
  21032. */
  21033. function arrayLikeKeys(value, inherited) {
  21034. var isArr = isArray(value),
  21035. isArg = !isArr && isArguments(value),
  21036. isBuff = !isArr && !isArg && isBuffer(value),
  21037. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21038. skipIndexes = isArr || isArg || isBuff || isType,
  21039. result = skipIndexes ? baseTimes(value.length, String) : [],
  21040. length = result.length;
  21041. for (var key in value) {
  21042. if ((inherited || hasOwnProperty.call(value, key)) &&
  21043. !(skipIndexes && (
  21044. // Safari 9 has enumerable `arguments.length` in strict mode.
  21045. key == 'length' ||
  21046. // Node.js 0.10 has enumerable non-index properties on buffers.
  21047. (isBuff && (key == 'offset' || key == 'parent')) ||
  21048. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21049. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21050. // Skip index properties.
  21051. isIndex(key, length)
  21052. ))) {
  21053. result.push(key);
  21054. }
  21055. }
  21056. return result;
  21057. }
  21058. /**
  21059. * A specialized version of `_.sample` for arrays.
  21060. *
  21061. * @private
  21062. * @param {Array} array The array to sample.
  21063. * @returns {*} Returns the random element.
  21064. */
  21065. function arraySample(array) {
  21066. var length = array.length;
  21067. return length ? array[baseRandom(0, length - 1)] : undefined;
  21068. }
  21069. /**
  21070. * A specialized version of `_.sampleSize` for arrays.
  21071. *
  21072. * @private
  21073. * @param {Array} array The array to sample.
  21074. * @param {number} n The number of elements to sample.
  21075. * @returns {Array} Returns the random elements.
  21076. */
  21077. function arraySampleSize(array, n) {
  21078. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21079. }
  21080. /**
  21081. * A specialized version of `_.shuffle` for arrays.
  21082. *
  21083. * @private
  21084. * @param {Array} array The array to shuffle.
  21085. * @returns {Array} Returns the new shuffled array.
  21086. */
  21087. function arrayShuffle(array) {
  21088. return shuffleSelf(copyArray(array));
  21089. }
  21090. /**
  21091. * This function is like `assignValue` except that it doesn't assign
  21092. * `undefined` values.
  21093. *
  21094. * @private
  21095. * @param {Object} object The object to modify.
  21096. * @param {string} key The key of the property to assign.
  21097. * @param {*} value The value to assign.
  21098. */
  21099. function assignMergeValue(object, key, value) {
  21100. if ((value !== undefined && !eq(object[key], value)) ||
  21101. (value === undefined && !(key in object))) {
  21102. baseAssignValue(object, key, value);
  21103. }
  21104. }
  21105. /**
  21106. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21107. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21108. * for equality comparisons.
  21109. *
  21110. * @private
  21111. * @param {Object} object The object to modify.
  21112. * @param {string} key The key of the property to assign.
  21113. * @param {*} value The value to assign.
  21114. */
  21115. function assignValue(object, key, value) {
  21116. var objValue = object[key];
  21117. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21118. (value === undefined && !(key in object))) {
  21119. baseAssignValue(object, key, value);
  21120. }
  21121. }
  21122. /**
  21123. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21124. *
  21125. * @private
  21126. * @param {Array} array The array to inspect.
  21127. * @param {*} key The key to search for.
  21128. * @returns {number} Returns the index of the matched value, else `-1`.
  21129. */
  21130. function assocIndexOf(array, key) {
  21131. var length = array.length;
  21132. while (length--) {
  21133. if (eq(array[length][0], key)) {
  21134. return length;
  21135. }
  21136. }
  21137. return -1;
  21138. }
  21139. /**
  21140. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21141. * by `iteratee` and values set by `setter`.
  21142. *
  21143. * @private
  21144. * @param {Array|Object} collection The collection to iterate over.
  21145. * @param {Function} setter The function to set `accumulator` values.
  21146. * @param {Function} iteratee The iteratee to transform keys.
  21147. * @param {Object} accumulator The initial aggregated object.
  21148. * @returns {Function} Returns `accumulator`.
  21149. */
  21150. function baseAggregator(collection, setter, iteratee, accumulator) {
  21151. baseEach(collection, function(value, key, collection) {
  21152. setter(accumulator, value, iteratee(value), collection);
  21153. });
  21154. return accumulator;
  21155. }
  21156. /**
  21157. * The base implementation of `_.assign` without support for multiple sources
  21158. * or `customizer` functions.
  21159. *
  21160. * @private
  21161. * @param {Object} object The destination object.
  21162. * @param {Object} source The source object.
  21163. * @returns {Object} Returns `object`.
  21164. */
  21165. function baseAssign(object, source) {
  21166. return object && copyObject(source, keys(source), object);
  21167. }
  21168. /**
  21169. * The base implementation of `_.assignIn` without support for multiple sources
  21170. * or `customizer` functions.
  21171. *
  21172. * @private
  21173. * @param {Object} object The destination object.
  21174. * @param {Object} source The source object.
  21175. * @returns {Object} Returns `object`.
  21176. */
  21177. function baseAssignIn(object, source) {
  21178. return object && copyObject(source, keysIn(source), object);
  21179. }
  21180. /**
  21181. * The base implementation of `assignValue` and `assignMergeValue` without
  21182. * value checks.
  21183. *
  21184. * @private
  21185. * @param {Object} object The object to modify.
  21186. * @param {string} key The key of the property to assign.
  21187. * @param {*} value The value to assign.
  21188. */
  21189. function baseAssignValue(object, key, value) {
  21190. if (key == '__proto__' && defineProperty) {
  21191. defineProperty(object, key, {
  21192. 'configurable': true,
  21193. 'enumerable': true,
  21194. 'value': value,
  21195. 'writable': true
  21196. });
  21197. } else {
  21198. object[key] = value;
  21199. }
  21200. }
  21201. /**
  21202. * The base implementation of `_.at` without support for individual paths.
  21203. *
  21204. * @private
  21205. * @param {Object} object The object to iterate over.
  21206. * @param {string[]} paths The property paths to pick.
  21207. * @returns {Array} Returns the picked elements.
  21208. */
  21209. function baseAt(object, paths) {
  21210. var index = -1,
  21211. length = paths.length,
  21212. result = Array(length),
  21213. skip = object == null;
  21214. while (++index < length) {
  21215. result[index] = skip ? undefined : get(object, paths[index]);
  21216. }
  21217. return result;
  21218. }
  21219. /**
  21220. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21221. *
  21222. * @private
  21223. * @param {number} number The number to clamp.
  21224. * @param {number} [lower] The lower bound.
  21225. * @param {number} upper The upper bound.
  21226. * @returns {number} Returns the clamped number.
  21227. */
  21228. function baseClamp(number, lower, upper) {
  21229. if (number === number) {
  21230. if (upper !== undefined) {
  21231. number = number <= upper ? number : upper;
  21232. }
  21233. if (lower !== undefined) {
  21234. number = number >= lower ? number : lower;
  21235. }
  21236. }
  21237. return number;
  21238. }
  21239. /**
  21240. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21241. * traversed objects.
  21242. *
  21243. * @private
  21244. * @param {*} value The value to clone.
  21245. * @param {boolean} bitmask The bitmask flags.
  21246. * 1 - Deep clone
  21247. * 2 - Flatten inherited properties
  21248. * 4 - Clone symbols
  21249. * @param {Function} [customizer] The function to customize cloning.
  21250. * @param {string} [key] The key of `value`.
  21251. * @param {Object} [object] The parent object of `value`.
  21252. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21253. * @returns {*} Returns the cloned value.
  21254. */
  21255. function baseClone(value, bitmask, customizer, key, object, stack) {
  21256. var result,
  21257. isDeep = bitmask & CLONE_DEEP_FLAG,
  21258. isFlat = bitmask & CLONE_FLAT_FLAG,
  21259. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21260. if (customizer) {
  21261. result = object ? customizer(value, key, object, stack) : customizer(value);
  21262. }
  21263. if (result !== undefined) {
  21264. return result;
  21265. }
  21266. if (!isObject(value)) {
  21267. return value;
  21268. }
  21269. var isArr = isArray(value);
  21270. if (isArr) {
  21271. result = initCloneArray(value);
  21272. if (!isDeep) {
  21273. return copyArray(value, result);
  21274. }
  21275. } else {
  21276. var tag = getTag(value),
  21277. isFunc = tag == funcTag || tag == genTag;
  21278. if (isBuffer(value)) {
  21279. return cloneBuffer(value, isDeep);
  21280. }
  21281. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21282. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21283. if (!isDeep) {
  21284. return isFlat
  21285. ? copySymbolsIn(value, baseAssignIn(result, value))
  21286. : copySymbols(value, baseAssign(result, value));
  21287. }
  21288. } else {
  21289. if (!cloneableTags[tag]) {
  21290. return object ? value : {};
  21291. }
  21292. result = initCloneByTag(value, tag, isDeep);
  21293. }
  21294. }
  21295. // Check for circular references and return its corresponding clone.
  21296. stack || (stack = new Stack);
  21297. var stacked = stack.get(value);
  21298. if (stacked) {
  21299. return stacked;
  21300. }
  21301. stack.set(value, result);
  21302. if (isSet(value)) {
  21303. value.forEach(function(subValue) {
  21304. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21305. });
  21306. } else if (isMap(value)) {
  21307. value.forEach(function(subValue, key) {
  21308. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21309. });
  21310. }
  21311. var keysFunc = isFull
  21312. ? (isFlat ? getAllKeysIn : getAllKeys)
  21313. : (isFlat ? keysIn : keys);
  21314. var props = isArr ? undefined : keysFunc(value);
  21315. arrayEach(props || value, function(subValue, key) {
  21316. if (props) {
  21317. key = subValue;
  21318. subValue = value[key];
  21319. }
  21320. // Recursively populate clone (susceptible to call stack limits).
  21321. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21322. });
  21323. return result;
  21324. }
  21325. /**
  21326. * The base implementation of `_.conforms` which doesn't clone `source`.
  21327. *
  21328. * @private
  21329. * @param {Object} source The object of property predicates to conform to.
  21330. * @returns {Function} Returns the new spec function.
  21331. */
  21332. function baseConforms(source) {
  21333. var props = keys(source);
  21334. return function(object) {
  21335. return baseConformsTo(object, source, props);
  21336. };
  21337. }
  21338. /**
  21339. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21340. *
  21341. * @private
  21342. * @param {Object} object The object to inspect.
  21343. * @param {Object} source The object of property predicates to conform to.
  21344. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21345. */
  21346. function baseConformsTo(object, source, props) {
  21347. var length = props.length;
  21348. if (object == null) {
  21349. return !length;
  21350. }
  21351. object = Object(object);
  21352. while (length--) {
  21353. var key = props[length],
  21354. predicate = source[key],
  21355. value = object[key];
  21356. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21357. return false;
  21358. }
  21359. }
  21360. return true;
  21361. }
  21362. /**
  21363. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21364. * to provide to `func`.
  21365. *
  21366. * @private
  21367. * @param {Function} func The function to delay.
  21368. * @param {number} wait The number of milliseconds to delay invocation.
  21369. * @param {Array} args The arguments to provide to `func`.
  21370. * @returns {number|Object} Returns the timer id or timeout object.
  21371. */
  21372. function baseDelay(func, wait, args) {
  21373. if (typeof func != 'function') {
  21374. throw new TypeError(FUNC_ERROR_TEXT);
  21375. }
  21376. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21377. }
  21378. /**
  21379. * The base implementation of methods like `_.difference` without support
  21380. * for excluding multiple arrays or iteratee shorthands.
  21381. *
  21382. * @private
  21383. * @param {Array} array The array to inspect.
  21384. * @param {Array} values The values to exclude.
  21385. * @param {Function} [iteratee] The iteratee invoked per element.
  21386. * @param {Function} [comparator] The comparator invoked per element.
  21387. * @returns {Array} Returns the new array of filtered values.
  21388. */
  21389. function baseDifference(array, values, iteratee, comparator) {
  21390. var index = -1,
  21391. includes = arrayIncludes,
  21392. isCommon = true,
  21393. length = array.length,
  21394. result = [],
  21395. valuesLength = values.length;
  21396. if (!length) {
  21397. return result;
  21398. }
  21399. if (iteratee) {
  21400. values = arrayMap(values, baseUnary(iteratee));
  21401. }
  21402. if (comparator) {
  21403. includes = arrayIncludesWith;
  21404. isCommon = false;
  21405. }
  21406. else if (values.length >= LARGE_ARRAY_SIZE) {
  21407. includes = cacheHas;
  21408. isCommon = false;
  21409. values = new SetCache(values);
  21410. }
  21411. outer:
  21412. while (++index < length) {
  21413. var value = array[index],
  21414. computed = iteratee == null ? value : iteratee(value);
  21415. value = (comparator || value !== 0) ? value : 0;
  21416. if (isCommon && computed === computed) {
  21417. var valuesIndex = valuesLength;
  21418. while (valuesIndex--) {
  21419. if (values[valuesIndex] === computed) {
  21420. continue outer;
  21421. }
  21422. }
  21423. result.push(value);
  21424. }
  21425. else if (!includes(values, computed, comparator)) {
  21426. result.push(value);
  21427. }
  21428. }
  21429. return result;
  21430. }
  21431. /**
  21432. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21433. *
  21434. * @private
  21435. * @param {Array|Object} collection The collection to iterate over.
  21436. * @param {Function} iteratee The function invoked per iteration.
  21437. * @returns {Array|Object} Returns `collection`.
  21438. */
  21439. var baseEach = createBaseEach(baseForOwn);
  21440. /**
  21441. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21442. *
  21443. * @private
  21444. * @param {Array|Object} collection The collection to iterate over.
  21445. * @param {Function} iteratee The function invoked per iteration.
  21446. * @returns {Array|Object} Returns `collection`.
  21447. */
  21448. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21449. /**
  21450. * The base implementation of `_.every` without support for iteratee shorthands.
  21451. *
  21452. * @private
  21453. * @param {Array|Object} collection The collection to iterate over.
  21454. * @param {Function} predicate The function invoked per iteration.
  21455. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21456. * else `false`
  21457. */
  21458. function baseEvery(collection, predicate) {
  21459. var result = true;
  21460. baseEach(collection, function(value, index, collection) {
  21461. result = !!predicate(value, index, collection);
  21462. return result;
  21463. });
  21464. return result;
  21465. }
  21466. /**
  21467. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21468. * `comparator` to determine the extremum value.
  21469. *
  21470. * @private
  21471. * @param {Array} array The array to iterate over.
  21472. * @param {Function} iteratee The iteratee invoked per iteration.
  21473. * @param {Function} comparator The comparator used to compare values.
  21474. * @returns {*} Returns the extremum value.
  21475. */
  21476. function baseExtremum(array, iteratee, comparator) {
  21477. var index = -1,
  21478. length = array.length;
  21479. while (++index < length) {
  21480. var value = array[index],
  21481. current = iteratee(value);
  21482. if (current != null && (computed === undefined
  21483. ? (current === current && !isSymbol(current))
  21484. : comparator(current, computed)
  21485. )) {
  21486. var computed = current,
  21487. result = value;
  21488. }
  21489. }
  21490. return result;
  21491. }
  21492. /**
  21493. * The base implementation of `_.fill` without an iteratee call guard.
  21494. *
  21495. * @private
  21496. * @param {Array} array The array to fill.
  21497. * @param {*} value The value to fill `array` with.
  21498. * @param {number} [start=0] The start position.
  21499. * @param {number} [end=array.length] The end position.
  21500. * @returns {Array} Returns `array`.
  21501. */
  21502. function baseFill(array, value, start, end) {
  21503. var length = array.length;
  21504. start = toInteger(start);
  21505. if (start < 0) {
  21506. start = -start > length ? 0 : (length + start);
  21507. }
  21508. end = (end === undefined || end > length) ? length : toInteger(end);
  21509. if (end < 0) {
  21510. end += length;
  21511. }
  21512. end = start > end ? 0 : toLength(end);
  21513. while (start < end) {
  21514. array[start++] = value;
  21515. }
  21516. return array;
  21517. }
  21518. /**
  21519. * The base implementation of `_.filter` without support for iteratee shorthands.
  21520. *
  21521. * @private
  21522. * @param {Array|Object} collection The collection to iterate over.
  21523. * @param {Function} predicate The function invoked per iteration.
  21524. * @returns {Array} Returns the new filtered array.
  21525. */
  21526. function baseFilter(collection, predicate) {
  21527. var result = [];
  21528. baseEach(collection, function(value, index, collection) {
  21529. if (predicate(value, index, collection)) {
  21530. result.push(value);
  21531. }
  21532. });
  21533. return result;
  21534. }
  21535. /**
  21536. * The base implementation of `_.flatten` with support for restricting flattening.
  21537. *
  21538. * @private
  21539. * @param {Array} array The array to flatten.
  21540. * @param {number} depth The maximum recursion depth.
  21541. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21542. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21543. * @param {Array} [result=[]] The initial result value.
  21544. * @returns {Array} Returns the new flattened array.
  21545. */
  21546. function baseFlatten(array, depth, predicate, isStrict, result) {
  21547. var index = -1,
  21548. length = array.length;
  21549. predicate || (predicate = isFlattenable);
  21550. result || (result = []);
  21551. while (++index < length) {
  21552. var value = array[index];
  21553. if (depth > 0 && predicate(value)) {
  21554. if (depth > 1) {
  21555. // Recursively flatten arrays (susceptible to call stack limits).
  21556. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21557. } else {
  21558. arrayPush(result, value);
  21559. }
  21560. } else if (!isStrict) {
  21561. result[result.length] = value;
  21562. }
  21563. }
  21564. return result;
  21565. }
  21566. /**
  21567. * The base implementation of `baseForOwn` which iterates over `object`
  21568. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21569. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21570. *
  21571. * @private
  21572. * @param {Object} object The object to iterate over.
  21573. * @param {Function} iteratee The function invoked per iteration.
  21574. * @param {Function} keysFunc The function to get the keys of `object`.
  21575. * @returns {Object} Returns `object`.
  21576. */
  21577. var baseFor = createBaseFor();
  21578. /**
  21579. * This function is like `baseFor` except that it iterates over properties
  21580. * in the opposite order.
  21581. *
  21582. * @private
  21583. * @param {Object} object The object to iterate over.
  21584. * @param {Function} iteratee The function invoked per iteration.
  21585. * @param {Function} keysFunc The function to get the keys of `object`.
  21586. * @returns {Object} Returns `object`.
  21587. */
  21588. var baseForRight = createBaseFor(true);
  21589. /**
  21590. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21591. *
  21592. * @private
  21593. * @param {Object} object The object to iterate over.
  21594. * @param {Function} iteratee The function invoked per iteration.
  21595. * @returns {Object} Returns `object`.
  21596. */
  21597. function baseForOwn(object, iteratee) {
  21598. return object && baseFor(object, iteratee, keys);
  21599. }
  21600. /**
  21601. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21602. *
  21603. * @private
  21604. * @param {Object} object The object to iterate over.
  21605. * @param {Function} iteratee The function invoked per iteration.
  21606. * @returns {Object} Returns `object`.
  21607. */
  21608. function baseForOwnRight(object, iteratee) {
  21609. return object && baseForRight(object, iteratee, keys);
  21610. }
  21611. /**
  21612. * The base implementation of `_.functions` which creates an array of
  21613. * `object` function property names filtered from `props`.
  21614. *
  21615. * @private
  21616. * @param {Object} object The object to inspect.
  21617. * @param {Array} props The property names to filter.
  21618. * @returns {Array} Returns the function names.
  21619. */
  21620. function baseFunctions(object, props) {
  21621. return arrayFilter(props, function(key) {
  21622. return isFunction(object[key]);
  21623. });
  21624. }
  21625. /**
  21626. * The base implementation of `_.get` without support for default values.
  21627. *
  21628. * @private
  21629. * @param {Object} object The object to query.
  21630. * @param {Array|string} path The path of the property to get.
  21631. * @returns {*} Returns the resolved value.
  21632. */
  21633. function baseGet(object, path) {
  21634. path = castPath(path, object);
  21635. var index = 0,
  21636. length = path.length;
  21637. while (object != null && index < length) {
  21638. object = object[toKey(path[index++])];
  21639. }
  21640. return (index && index == length) ? object : undefined;
  21641. }
  21642. /**
  21643. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21644. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21645. * symbols of `object`.
  21646. *
  21647. * @private
  21648. * @param {Object} object The object to query.
  21649. * @param {Function} keysFunc The function to get the keys of `object`.
  21650. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21651. * @returns {Array} Returns the array of property names and symbols.
  21652. */
  21653. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21654. var result = keysFunc(object);
  21655. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21656. }
  21657. /**
  21658. * The base implementation of `getTag` without fallbacks for buggy environments.
  21659. *
  21660. * @private
  21661. * @param {*} value The value to query.
  21662. * @returns {string} Returns the `toStringTag`.
  21663. */
  21664. function baseGetTag(value) {
  21665. if (value == null) {
  21666. return value === undefined ? undefinedTag : nullTag;
  21667. }
  21668. return (symToStringTag && symToStringTag in Object(value))
  21669. ? getRawTag(value)
  21670. : objectToString(value);
  21671. }
  21672. /**
  21673. * The base implementation of `_.gt` which doesn't coerce arguments.
  21674. *
  21675. * @private
  21676. * @param {*} value The value to compare.
  21677. * @param {*} other The other value to compare.
  21678. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21679. * else `false`.
  21680. */
  21681. function baseGt(value, other) {
  21682. return value > other;
  21683. }
  21684. /**
  21685. * The base implementation of `_.has` without support for deep paths.
  21686. *
  21687. * @private
  21688. * @param {Object} [object] The object to query.
  21689. * @param {Array|string} key The key to check.
  21690. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21691. */
  21692. function baseHas(object, key) {
  21693. return object != null && hasOwnProperty.call(object, key);
  21694. }
  21695. /**
  21696. * The base implementation of `_.hasIn` without support for deep paths.
  21697. *
  21698. * @private
  21699. * @param {Object} [object] The object to query.
  21700. * @param {Array|string} key The key to check.
  21701. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21702. */
  21703. function baseHasIn(object, key) {
  21704. return object != null && key in Object(object);
  21705. }
  21706. /**
  21707. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21708. *
  21709. * @private
  21710. * @param {number} number The number to check.
  21711. * @param {number} start The start of the range.
  21712. * @param {number} end The end of the range.
  21713. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21714. */
  21715. function baseInRange(number, start, end) {
  21716. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21717. }
  21718. /**
  21719. * The base implementation of methods like `_.intersection`, without support
  21720. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21721. *
  21722. * @private
  21723. * @param {Array} arrays The arrays to inspect.
  21724. * @param {Function} [iteratee] The iteratee invoked per element.
  21725. * @param {Function} [comparator] The comparator invoked per element.
  21726. * @returns {Array} Returns the new array of shared values.
  21727. */
  21728. function baseIntersection(arrays, iteratee, comparator) {
  21729. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21730. length = arrays[0].length,
  21731. othLength = arrays.length,
  21732. othIndex = othLength,
  21733. caches = Array(othLength),
  21734. maxLength = Infinity,
  21735. result = [];
  21736. while (othIndex--) {
  21737. var array = arrays[othIndex];
  21738. if (othIndex && iteratee) {
  21739. array = arrayMap(array, baseUnary(iteratee));
  21740. }
  21741. maxLength = nativeMin(array.length, maxLength);
  21742. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21743. ? new SetCache(othIndex && array)
  21744. : undefined;
  21745. }
  21746. array = arrays[0];
  21747. var index = -1,
  21748. seen = caches[0];
  21749. outer:
  21750. while (++index < length && result.length < maxLength) {
  21751. var value = array[index],
  21752. computed = iteratee ? iteratee(value) : value;
  21753. value = (comparator || value !== 0) ? value : 0;
  21754. if (!(seen
  21755. ? cacheHas(seen, computed)
  21756. : includes(result, computed, comparator)
  21757. )) {
  21758. othIndex = othLength;
  21759. while (--othIndex) {
  21760. var cache = caches[othIndex];
  21761. if (!(cache
  21762. ? cacheHas(cache, computed)
  21763. : includes(arrays[othIndex], computed, comparator))
  21764. ) {
  21765. continue outer;
  21766. }
  21767. }
  21768. if (seen) {
  21769. seen.push(computed);
  21770. }
  21771. result.push(value);
  21772. }
  21773. }
  21774. return result;
  21775. }
  21776. /**
  21777. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21778. * `object` with values transformed by `iteratee` and set by `setter`.
  21779. *
  21780. * @private
  21781. * @param {Object} object The object to iterate over.
  21782. * @param {Function} setter The function to set `accumulator` values.
  21783. * @param {Function} iteratee The iteratee to transform values.
  21784. * @param {Object} accumulator The initial inverted object.
  21785. * @returns {Function} Returns `accumulator`.
  21786. */
  21787. function baseInverter(object, setter, iteratee, accumulator) {
  21788. baseForOwn(object, function(value, key, object) {
  21789. setter(accumulator, iteratee(value), key, object);
  21790. });
  21791. return accumulator;
  21792. }
  21793. /**
  21794. * The base implementation of `_.invoke` without support for individual
  21795. * method arguments.
  21796. *
  21797. * @private
  21798. * @param {Object} object The object to query.
  21799. * @param {Array|string} path The path of the method to invoke.
  21800. * @param {Array} args The arguments to invoke the method with.
  21801. * @returns {*} Returns the result of the invoked method.
  21802. */
  21803. function baseInvoke(object, path, args) {
  21804. path = castPath(path, object);
  21805. object = parent(object, path);
  21806. var func = object == null ? object : object[toKey(last(path))];
  21807. return func == null ? undefined : apply(func, object, args);
  21808. }
  21809. /**
  21810. * The base implementation of `_.isArguments`.
  21811. *
  21812. * @private
  21813. * @param {*} value The value to check.
  21814. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21815. */
  21816. function baseIsArguments(value) {
  21817. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21818. }
  21819. /**
  21820. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21821. *
  21822. * @private
  21823. * @param {*} value The value to check.
  21824. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21825. */
  21826. function baseIsArrayBuffer(value) {
  21827. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21828. }
  21829. /**
  21830. * The base implementation of `_.isDate` without Node.js optimizations.
  21831. *
  21832. * @private
  21833. * @param {*} value The value to check.
  21834. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21835. */
  21836. function baseIsDate(value) {
  21837. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21838. }
  21839. /**
  21840. * The base implementation of `_.isEqual` which supports partial comparisons
  21841. * and tracks traversed objects.
  21842. *
  21843. * @private
  21844. * @param {*} value The value to compare.
  21845. * @param {*} other The other value to compare.
  21846. * @param {boolean} bitmask The bitmask flags.
  21847. * 1 - Unordered comparison
  21848. * 2 - Partial comparison
  21849. * @param {Function} [customizer] The function to customize comparisons.
  21850. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21851. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21852. */
  21853. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21854. if (value === other) {
  21855. return true;
  21856. }
  21857. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21858. return value !== value && other !== other;
  21859. }
  21860. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21861. }
  21862. /**
  21863. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21864. * deep comparisons and tracks traversed objects enabling objects with circular
  21865. * references to be compared.
  21866. *
  21867. * @private
  21868. * @param {Object} object The object to compare.
  21869. * @param {Object} other The other object to compare.
  21870. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21871. * @param {Function} customizer The function to customize comparisons.
  21872. * @param {Function} equalFunc The function to determine equivalents of values.
  21873. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21874. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21875. */
  21876. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21877. var objIsArr = isArray(object),
  21878. othIsArr = isArray(other),
  21879. objTag = objIsArr ? arrayTag : getTag(object),
  21880. othTag = othIsArr ? arrayTag : getTag(other);
  21881. objTag = objTag == argsTag ? objectTag : objTag;
  21882. othTag = othTag == argsTag ? objectTag : othTag;
  21883. var objIsObj = objTag == objectTag,
  21884. othIsObj = othTag == objectTag,
  21885. isSameTag = objTag == othTag;
  21886. if (isSameTag && isBuffer(object)) {
  21887. if (!isBuffer(other)) {
  21888. return false;
  21889. }
  21890. objIsArr = true;
  21891. objIsObj = false;
  21892. }
  21893. if (isSameTag && !objIsObj) {
  21894. stack || (stack = new Stack);
  21895. return (objIsArr || isTypedArray(object))
  21896. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21897. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21898. }
  21899. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21900. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21901. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21902. if (objIsWrapped || othIsWrapped) {
  21903. var objUnwrapped = objIsWrapped ? object.value() : object,
  21904. othUnwrapped = othIsWrapped ? other.value() : other;
  21905. stack || (stack = new Stack);
  21906. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21907. }
  21908. }
  21909. if (!isSameTag) {
  21910. return false;
  21911. }
  21912. stack || (stack = new Stack);
  21913. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21914. }
  21915. /**
  21916. * The base implementation of `_.isMap` without Node.js optimizations.
  21917. *
  21918. * @private
  21919. * @param {*} value The value to check.
  21920. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21921. */
  21922. function baseIsMap(value) {
  21923. return isObjectLike(value) && getTag(value) == mapTag;
  21924. }
  21925. /**
  21926. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21927. *
  21928. * @private
  21929. * @param {Object} object The object to inspect.
  21930. * @param {Object} source The object of property values to match.
  21931. * @param {Array} matchData The property names, values, and compare flags to match.
  21932. * @param {Function} [customizer] The function to customize comparisons.
  21933. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21934. */
  21935. function baseIsMatch(object, source, matchData, customizer) {
  21936. var index = matchData.length,
  21937. length = index,
  21938. noCustomizer = !customizer;
  21939. if (object == null) {
  21940. return !length;
  21941. }
  21942. object = Object(object);
  21943. while (index--) {
  21944. var data = matchData[index];
  21945. if ((noCustomizer && data[2])
  21946. ? data[1] !== object[data[0]]
  21947. : !(data[0] in object)
  21948. ) {
  21949. return false;
  21950. }
  21951. }
  21952. while (++index < length) {
  21953. data = matchData[index];
  21954. var key = data[0],
  21955. objValue = object[key],
  21956. srcValue = data[1];
  21957. if (noCustomizer && data[2]) {
  21958. if (objValue === undefined && !(key in object)) {
  21959. return false;
  21960. }
  21961. } else {
  21962. var stack = new Stack;
  21963. if (customizer) {
  21964. var result = customizer(objValue, srcValue, key, object, source, stack);
  21965. }
  21966. if (!(result === undefined
  21967. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21968. : result
  21969. )) {
  21970. return false;
  21971. }
  21972. }
  21973. }
  21974. return true;
  21975. }
  21976. /**
  21977. * The base implementation of `_.isNative` without bad shim checks.
  21978. *
  21979. * @private
  21980. * @param {*} value The value to check.
  21981. * @returns {boolean} Returns `true` if `value` is a native function,
  21982. * else `false`.
  21983. */
  21984. function baseIsNative(value) {
  21985. if (!isObject(value) || isMasked(value)) {
  21986. return false;
  21987. }
  21988. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21989. return pattern.test(toSource(value));
  21990. }
  21991. /**
  21992. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21993. *
  21994. * @private
  21995. * @param {*} value The value to check.
  21996. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21997. */
  21998. function baseIsRegExp(value) {
  21999. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22000. }
  22001. /**
  22002. * The base implementation of `_.isSet` without Node.js optimizations.
  22003. *
  22004. * @private
  22005. * @param {*} value The value to check.
  22006. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22007. */
  22008. function baseIsSet(value) {
  22009. return isObjectLike(value) && getTag(value) == setTag;
  22010. }
  22011. /**
  22012. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22013. *
  22014. * @private
  22015. * @param {*} value The value to check.
  22016. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22017. */
  22018. function baseIsTypedArray(value) {
  22019. return isObjectLike(value) &&
  22020. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22021. }
  22022. /**
  22023. * The base implementation of `_.iteratee`.
  22024. *
  22025. * @private
  22026. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22027. * @returns {Function} Returns the iteratee.
  22028. */
  22029. function baseIteratee(value) {
  22030. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22031. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22032. if (typeof value == 'function') {
  22033. return value;
  22034. }
  22035. if (value == null) {
  22036. return identity;
  22037. }
  22038. if (typeof value == 'object') {
  22039. return isArray(value)
  22040. ? baseMatchesProperty(value[0], value[1])
  22041. : baseMatches(value);
  22042. }
  22043. return property(value);
  22044. }
  22045. /**
  22046. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22047. *
  22048. * @private
  22049. * @param {Object} object The object to query.
  22050. * @returns {Array} Returns the array of property names.
  22051. */
  22052. function baseKeys(object) {
  22053. if (!isPrototype(object)) {
  22054. return nativeKeys(object);
  22055. }
  22056. var result = [];
  22057. for (var key in Object(object)) {
  22058. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22059. result.push(key);
  22060. }
  22061. }
  22062. return result;
  22063. }
  22064. /**
  22065. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22066. *
  22067. * @private
  22068. * @param {Object} object The object to query.
  22069. * @returns {Array} Returns the array of property names.
  22070. */
  22071. function baseKeysIn(object) {
  22072. if (!isObject(object)) {
  22073. return nativeKeysIn(object);
  22074. }
  22075. var isProto = isPrototype(object),
  22076. result = [];
  22077. for (var key in object) {
  22078. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22079. result.push(key);
  22080. }
  22081. }
  22082. return result;
  22083. }
  22084. /**
  22085. * The base implementation of `_.lt` which doesn't coerce arguments.
  22086. *
  22087. * @private
  22088. * @param {*} value The value to compare.
  22089. * @param {*} other The other value to compare.
  22090. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22091. * else `false`.
  22092. */
  22093. function baseLt(value, other) {
  22094. return value < other;
  22095. }
  22096. /**
  22097. * The base implementation of `_.map` without support for iteratee shorthands.
  22098. *
  22099. * @private
  22100. * @param {Array|Object} collection The collection to iterate over.
  22101. * @param {Function} iteratee The function invoked per iteration.
  22102. * @returns {Array} Returns the new mapped array.
  22103. */
  22104. function baseMap(collection, iteratee) {
  22105. var index = -1,
  22106. result = isArrayLike(collection) ? Array(collection.length) : [];
  22107. baseEach(collection, function(value, key, collection) {
  22108. result[++index] = iteratee(value, key, collection);
  22109. });
  22110. return result;
  22111. }
  22112. /**
  22113. * The base implementation of `_.matches` which doesn't clone `source`.
  22114. *
  22115. * @private
  22116. * @param {Object} source The object of property values to match.
  22117. * @returns {Function} Returns the new spec function.
  22118. */
  22119. function baseMatches(source) {
  22120. var matchData = getMatchData(source);
  22121. if (matchData.length == 1 && matchData[0][2]) {
  22122. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22123. }
  22124. return function(object) {
  22125. return object === source || baseIsMatch(object, source, matchData);
  22126. };
  22127. }
  22128. /**
  22129. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22130. *
  22131. * @private
  22132. * @param {string} path The path of the property to get.
  22133. * @param {*} srcValue The value to match.
  22134. * @returns {Function} Returns the new spec function.
  22135. */
  22136. function baseMatchesProperty(path, srcValue) {
  22137. if (isKey(path) && isStrictComparable(srcValue)) {
  22138. return matchesStrictComparable(toKey(path), srcValue);
  22139. }
  22140. return function(object) {
  22141. var objValue = get(object, path);
  22142. return (objValue === undefined && objValue === srcValue)
  22143. ? hasIn(object, path)
  22144. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22145. };
  22146. }
  22147. /**
  22148. * The base implementation of `_.merge` without support for multiple sources.
  22149. *
  22150. * @private
  22151. * @param {Object} object The destination object.
  22152. * @param {Object} source The source object.
  22153. * @param {number} srcIndex The index of `source`.
  22154. * @param {Function} [customizer] The function to customize merged values.
  22155. * @param {Object} [stack] Tracks traversed source values and their merged
  22156. * counterparts.
  22157. */
  22158. function baseMerge(object, source, srcIndex, customizer, stack) {
  22159. if (object === source) {
  22160. return;
  22161. }
  22162. baseFor(source, function(srcValue, key) {
  22163. stack || (stack = new Stack);
  22164. if (isObject(srcValue)) {
  22165. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22166. }
  22167. else {
  22168. var newValue = customizer
  22169. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22170. : undefined;
  22171. if (newValue === undefined) {
  22172. newValue = srcValue;
  22173. }
  22174. assignMergeValue(object, key, newValue);
  22175. }
  22176. }, keysIn);
  22177. }
  22178. /**
  22179. * A specialized version of `baseMerge` for arrays and objects which performs
  22180. * deep merges and tracks traversed objects enabling objects with circular
  22181. * references to be merged.
  22182. *
  22183. * @private
  22184. * @param {Object} object The destination object.
  22185. * @param {Object} source The source object.
  22186. * @param {string} key The key of the value to merge.
  22187. * @param {number} srcIndex The index of `source`.
  22188. * @param {Function} mergeFunc The function to merge values.
  22189. * @param {Function} [customizer] The function to customize assigned values.
  22190. * @param {Object} [stack] Tracks traversed source values and their merged
  22191. * counterparts.
  22192. */
  22193. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22194. var objValue = safeGet(object, key),
  22195. srcValue = safeGet(source, key),
  22196. stacked = stack.get(srcValue);
  22197. if (stacked) {
  22198. assignMergeValue(object, key, stacked);
  22199. return;
  22200. }
  22201. var newValue = customizer
  22202. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22203. : undefined;
  22204. var isCommon = newValue === undefined;
  22205. if (isCommon) {
  22206. var isArr = isArray(srcValue),
  22207. isBuff = !isArr && isBuffer(srcValue),
  22208. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22209. newValue = srcValue;
  22210. if (isArr || isBuff || isTyped) {
  22211. if (isArray(objValue)) {
  22212. newValue = objValue;
  22213. }
  22214. else if (isArrayLikeObject(objValue)) {
  22215. newValue = copyArray(objValue);
  22216. }
  22217. else if (isBuff) {
  22218. isCommon = false;
  22219. newValue = cloneBuffer(srcValue, true);
  22220. }
  22221. else if (isTyped) {
  22222. isCommon = false;
  22223. newValue = cloneTypedArray(srcValue, true);
  22224. }
  22225. else {
  22226. newValue = [];
  22227. }
  22228. }
  22229. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22230. newValue = objValue;
  22231. if (isArguments(objValue)) {
  22232. newValue = toPlainObject(objValue);
  22233. }
  22234. else if (!isObject(objValue) || isFunction(objValue)) {
  22235. newValue = initCloneObject(srcValue);
  22236. }
  22237. }
  22238. else {
  22239. isCommon = false;
  22240. }
  22241. }
  22242. if (isCommon) {
  22243. // Recursively merge objects and arrays (susceptible to call stack limits).
  22244. stack.set(srcValue, newValue);
  22245. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22246. stack['delete'](srcValue);
  22247. }
  22248. assignMergeValue(object, key, newValue);
  22249. }
  22250. /**
  22251. * The base implementation of `_.nth` which doesn't coerce arguments.
  22252. *
  22253. * @private
  22254. * @param {Array} array The array to query.
  22255. * @param {number} n The index of the element to return.
  22256. * @returns {*} Returns the nth element of `array`.
  22257. */
  22258. function baseNth(array, n) {
  22259. var length = array.length;
  22260. if (!length) {
  22261. return;
  22262. }
  22263. n += n < 0 ? length : 0;
  22264. return isIndex(n, length) ? array[n] : undefined;
  22265. }
  22266. /**
  22267. * The base implementation of `_.orderBy` without param guards.
  22268. *
  22269. * @private
  22270. * @param {Array|Object} collection The collection to iterate over.
  22271. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22272. * @param {string[]} orders The sort orders of `iteratees`.
  22273. * @returns {Array} Returns the new sorted array.
  22274. */
  22275. function baseOrderBy(collection, iteratees, orders) {
  22276. var index = -1;
  22277. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22278. var result = baseMap(collection, function(value, key, collection) {
  22279. var criteria = arrayMap(iteratees, function(iteratee) {
  22280. return iteratee(value);
  22281. });
  22282. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22283. });
  22284. return baseSortBy(result, function(object, other) {
  22285. return compareMultiple(object, other, orders);
  22286. });
  22287. }
  22288. /**
  22289. * The base implementation of `_.pick` without support for individual
  22290. * property identifiers.
  22291. *
  22292. * @private
  22293. * @param {Object} object The source object.
  22294. * @param {string[]} paths The property paths to pick.
  22295. * @returns {Object} Returns the new object.
  22296. */
  22297. function basePick(object, paths) {
  22298. return basePickBy(object, paths, function(value, path) {
  22299. return hasIn(object, path);
  22300. });
  22301. }
  22302. /**
  22303. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22304. *
  22305. * @private
  22306. * @param {Object} object The source object.
  22307. * @param {string[]} paths The property paths to pick.
  22308. * @param {Function} predicate The function invoked per property.
  22309. * @returns {Object} Returns the new object.
  22310. */
  22311. function basePickBy(object, paths, predicate) {
  22312. var index = -1,
  22313. length = paths.length,
  22314. result = {};
  22315. while (++index < length) {
  22316. var path = paths[index],
  22317. value = baseGet(object, path);
  22318. if (predicate(value, path)) {
  22319. baseSet(result, castPath(path, object), value);
  22320. }
  22321. }
  22322. return result;
  22323. }
  22324. /**
  22325. * A specialized version of `baseProperty` which supports deep paths.
  22326. *
  22327. * @private
  22328. * @param {Array|string} path The path of the property to get.
  22329. * @returns {Function} Returns the new accessor function.
  22330. */
  22331. function basePropertyDeep(path) {
  22332. return function(object) {
  22333. return baseGet(object, path);
  22334. };
  22335. }
  22336. /**
  22337. * The base implementation of `_.pullAllBy` without support for iteratee
  22338. * shorthands.
  22339. *
  22340. * @private
  22341. * @param {Array} array The array to modify.
  22342. * @param {Array} values The values to remove.
  22343. * @param {Function} [iteratee] The iteratee invoked per element.
  22344. * @param {Function} [comparator] The comparator invoked per element.
  22345. * @returns {Array} Returns `array`.
  22346. */
  22347. function basePullAll(array, values, iteratee, comparator) {
  22348. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22349. index = -1,
  22350. length = values.length,
  22351. seen = array;
  22352. if (array === values) {
  22353. values = copyArray(values);
  22354. }
  22355. if (iteratee) {
  22356. seen = arrayMap(array, baseUnary(iteratee));
  22357. }
  22358. while (++index < length) {
  22359. var fromIndex = 0,
  22360. value = values[index],
  22361. computed = iteratee ? iteratee(value) : value;
  22362. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22363. if (seen !== array) {
  22364. splice.call(seen, fromIndex, 1);
  22365. }
  22366. splice.call(array, fromIndex, 1);
  22367. }
  22368. }
  22369. return array;
  22370. }
  22371. /**
  22372. * The base implementation of `_.pullAt` without support for individual
  22373. * indexes or capturing the removed elements.
  22374. *
  22375. * @private
  22376. * @param {Array} array The array to modify.
  22377. * @param {number[]} indexes The indexes of elements to remove.
  22378. * @returns {Array} Returns `array`.
  22379. */
  22380. function basePullAt(array, indexes) {
  22381. var length = array ? indexes.length : 0,
  22382. lastIndex = length - 1;
  22383. while (length--) {
  22384. var index = indexes[length];
  22385. if (length == lastIndex || index !== previous) {
  22386. var previous = index;
  22387. if (isIndex(index)) {
  22388. splice.call(array, index, 1);
  22389. } else {
  22390. baseUnset(array, index);
  22391. }
  22392. }
  22393. }
  22394. return array;
  22395. }
  22396. /**
  22397. * The base implementation of `_.random` without support for returning
  22398. * floating-point numbers.
  22399. *
  22400. * @private
  22401. * @param {number} lower The lower bound.
  22402. * @param {number} upper The upper bound.
  22403. * @returns {number} Returns the random number.
  22404. */
  22405. function baseRandom(lower, upper) {
  22406. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22407. }
  22408. /**
  22409. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22410. * coerce arguments.
  22411. *
  22412. * @private
  22413. * @param {number} start The start of the range.
  22414. * @param {number} end The end of the range.
  22415. * @param {number} step The value to increment or decrement by.
  22416. * @param {boolean} [fromRight] Specify iterating from right to left.
  22417. * @returns {Array} Returns the range of numbers.
  22418. */
  22419. function baseRange(start, end, step, fromRight) {
  22420. var index = -1,
  22421. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22422. result = Array(length);
  22423. while (length--) {
  22424. result[fromRight ? length : ++index] = start;
  22425. start += step;
  22426. }
  22427. return result;
  22428. }
  22429. /**
  22430. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22431. *
  22432. * @private
  22433. * @param {string} string The string to repeat.
  22434. * @param {number} n The number of times to repeat the string.
  22435. * @returns {string} Returns the repeated string.
  22436. */
  22437. function baseRepeat(string, n) {
  22438. var result = '';
  22439. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22440. return result;
  22441. }
  22442. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22443. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22444. do {
  22445. if (n % 2) {
  22446. result += string;
  22447. }
  22448. n = nativeFloor(n / 2);
  22449. if (n) {
  22450. string += string;
  22451. }
  22452. } while (n);
  22453. return result;
  22454. }
  22455. /**
  22456. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22457. *
  22458. * @private
  22459. * @param {Function} func The function to apply a rest parameter to.
  22460. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22461. * @returns {Function} Returns the new function.
  22462. */
  22463. function baseRest(func, start) {
  22464. return setToString(overRest(func, start, identity), func + '');
  22465. }
  22466. /**
  22467. * The base implementation of `_.sample`.
  22468. *
  22469. * @private
  22470. * @param {Array|Object} collection The collection to sample.
  22471. * @returns {*} Returns the random element.
  22472. */
  22473. function baseSample(collection) {
  22474. return arraySample(values(collection));
  22475. }
  22476. /**
  22477. * The base implementation of `_.sampleSize` without param guards.
  22478. *
  22479. * @private
  22480. * @param {Array|Object} collection The collection to sample.
  22481. * @param {number} n The number of elements to sample.
  22482. * @returns {Array} Returns the random elements.
  22483. */
  22484. function baseSampleSize(collection, n) {
  22485. var array = values(collection);
  22486. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22487. }
  22488. /**
  22489. * The base implementation of `_.set`.
  22490. *
  22491. * @private
  22492. * @param {Object} object The object to modify.
  22493. * @param {Array|string} path The path of the property to set.
  22494. * @param {*} value The value to set.
  22495. * @param {Function} [customizer] The function to customize path creation.
  22496. * @returns {Object} Returns `object`.
  22497. */
  22498. function baseSet(object, path, value, customizer) {
  22499. if (!isObject(object)) {
  22500. return object;
  22501. }
  22502. path = castPath(path, object);
  22503. var index = -1,
  22504. length = path.length,
  22505. lastIndex = length - 1,
  22506. nested = object;
  22507. while (nested != null && ++index < length) {
  22508. var key = toKey(path[index]),
  22509. newValue = value;
  22510. if (index != lastIndex) {
  22511. var objValue = nested[key];
  22512. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22513. if (newValue === undefined) {
  22514. newValue = isObject(objValue)
  22515. ? objValue
  22516. : (isIndex(path[index + 1]) ? [] : {});
  22517. }
  22518. }
  22519. assignValue(nested, key, newValue);
  22520. nested = nested[key];
  22521. }
  22522. return object;
  22523. }
  22524. /**
  22525. * The base implementation of `setData` without support for hot loop shorting.
  22526. *
  22527. * @private
  22528. * @param {Function} func The function to associate metadata with.
  22529. * @param {*} data The metadata.
  22530. * @returns {Function} Returns `func`.
  22531. */
  22532. var baseSetData = !metaMap ? identity : function(func, data) {
  22533. metaMap.set(func, data);
  22534. return func;
  22535. };
  22536. /**
  22537. * The base implementation of `setToString` without support for hot loop shorting.
  22538. *
  22539. * @private
  22540. * @param {Function} func The function to modify.
  22541. * @param {Function} string The `toString` result.
  22542. * @returns {Function} Returns `func`.
  22543. */
  22544. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22545. return defineProperty(func, 'toString', {
  22546. 'configurable': true,
  22547. 'enumerable': false,
  22548. 'value': constant(string),
  22549. 'writable': true
  22550. });
  22551. };
  22552. /**
  22553. * The base implementation of `_.shuffle`.
  22554. *
  22555. * @private
  22556. * @param {Array|Object} collection The collection to shuffle.
  22557. * @returns {Array} Returns the new shuffled array.
  22558. */
  22559. function baseShuffle(collection) {
  22560. return shuffleSelf(values(collection));
  22561. }
  22562. /**
  22563. * The base implementation of `_.slice` without an iteratee call guard.
  22564. *
  22565. * @private
  22566. * @param {Array} array The array to slice.
  22567. * @param {number} [start=0] The start position.
  22568. * @param {number} [end=array.length] The end position.
  22569. * @returns {Array} Returns the slice of `array`.
  22570. */
  22571. function baseSlice(array, start, end) {
  22572. var index = -1,
  22573. length = array.length;
  22574. if (start < 0) {
  22575. start = -start > length ? 0 : (length + start);
  22576. }
  22577. end = end > length ? length : end;
  22578. if (end < 0) {
  22579. end += length;
  22580. }
  22581. length = start > end ? 0 : ((end - start) >>> 0);
  22582. start >>>= 0;
  22583. var result = Array(length);
  22584. while (++index < length) {
  22585. result[index] = array[index + start];
  22586. }
  22587. return result;
  22588. }
  22589. /**
  22590. * The base implementation of `_.some` without support for iteratee shorthands.
  22591. *
  22592. * @private
  22593. * @param {Array|Object} collection The collection to iterate over.
  22594. * @param {Function} predicate The function invoked per iteration.
  22595. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22596. * else `false`.
  22597. */
  22598. function baseSome(collection, predicate) {
  22599. var result;
  22600. baseEach(collection, function(value, index, collection) {
  22601. result = predicate(value, index, collection);
  22602. return !result;
  22603. });
  22604. return !!result;
  22605. }
  22606. /**
  22607. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22608. * performs a binary search of `array` to determine the index at which `value`
  22609. * should be inserted into `array` in order to maintain its sort order.
  22610. *
  22611. * @private
  22612. * @param {Array} array The sorted array to inspect.
  22613. * @param {*} value The value to evaluate.
  22614. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22615. * @returns {number} Returns the index at which `value` should be inserted
  22616. * into `array`.
  22617. */
  22618. function baseSortedIndex(array, value, retHighest) {
  22619. var low = 0,
  22620. high = array == null ? low : array.length;
  22621. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22622. while (low < high) {
  22623. var mid = (low + high) >>> 1,
  22624. computed = array[mid];
  22625. if (computed !== null && !isSymbol(computed) &&
  22626. (retHighest ? (computed <= value) : (computed < value))) {
  22627. low = mid + 1;
  22628. } else {
  22629. high = mid;
  22630. }
  22631. }
  22632. return high;
  22633. }
  22634. return baseSortedIndexBy(array, value, identity, retHighest);
  22635. }
  22636. /**
  22637. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22638. * which invokes `iteratee` for `value` and each element of `array` to compute
  22639. * their sort ranking. The iteratee is invoked with one argument; (value).
  22640. *
  22641. * @private
  22642. * @param {Array} array The sorted array to inspect.
  22643. * @param {*} value The value to evaluate.
  22644. * @param {Function} iteratee The iteratee invoked per element.
  22645. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22646. * @returns {number} Returns the index at which `value` should be inserted
  22647. * into `array`.
  22648. */
  22649. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22650. value = iteratee(value);
  22651. var low = 0,
  22652. high = array == null ? 0 : array.length,
  22653. valIsNaN = value !== value,
  22654. valIsNull = value === null,
  22655. valIsSymbol = isSymbol(value),
  22656. valIsUndefined = value === undefined;
  22657. while (low < high) {
  22658. var mid = nativeFloor((low + high) / 2),
  22659. computed = iteratee(array[mid]),
  22660. othIsDefined = computed !== undefined,
  22661. othIsNull = computed === null,
  22662. othIsReflexive = computed === computed,
  22663. othIsSymbol = isSymbol(computed);
  22664. if (valIsNaN) {
  22665. var setLow = retHighest || othIsReflexive;
  22666. } else if (valIsUndefined) {
  22667. setLow = othIsReflexive && (retHighest || othIsDefined);
  22668. } else if (valIsNull) {
  22669. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22670. } else if (valIsSymbol) {
  22671. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22672. } else if (othIsNull || othIsSymbol) {
  22673. setLow = false;
  22674. } else {
  22675. setLow = retHighest ? (computed <= value) : (computed < value);
  22676. }
  22677. if (setLow) {
  22678. low = mid + 1;
  22679. } else {
  22680. high = mid;
  22681. }
  22682. }
  22683. return nativeMin(high, MAX_ARRAY_INDEX);
  22684. }
  22685. /**
  22686. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22687. * support for iteratee shorthands.
  22688. *
  22689. * @private
  22690. * @param {Array} array The array to inspect.
  22691. * @param {Function} [iteratee] The iteratee invoked per element.
  22692. * @returns {Array} Returns the new duplicate free array.
  22693. */
  22694. function baseSortedUniq(array, iteratee) {
  22695. var index = -1,
  22696. length = array.length,
  22697. resIndex = 0,
  22698. result = [];
  22699. while (++index < length) {
  22700. var value = array[index],
  22701. computed = iteratee ? iteratee(value) : value;
  22702. if (!index || !eq(computed, seen)) {
  22703. var seen = computed;
  22704. result[resIndex++] = value === 0 ? 0 : value;
  22705. }
  22706. }
  22707. return result;
  22708. }
  22709. /**
  22710. * The base implementation of `_.toNumber` which doesn't ensure correct
  22711. * conversions of binary, hexadecimal, or octal string values.
  22712. *
  22713. * @private
  22714. * @param {*} value The value to process.
  22715. * @returns {number} Returns the number.
  22716. */
  22717. function baseToNumber(value) {
  22718. if (typeof value == 'number') {
  22719. return value;
  22720. }
  22721. if (isSymbol(value)) {
  22722. return NAN;
  22723. }
  22724. return +value;
  22725. }
  22726. /**
  22727. * The base implementation of `_.toString` which doesn't convert nullish
  22728. * values to empty strings.
  22729. *
  22730. * @private
  22731. * @param {*} value The value to process.
  22732. * @returns {string} Returns the string.
  22733. */
  22734. function baseToString(value) {
  22735. // Exit early for strings to avoid a performance hit in some environments.
  22736. if (typeof value == 'string') {
  22737. return value;
  22738. }
  22739. if (isArray(value)) {
  22740. // Recursively convert values (susceptible to call stack limits).
  22741. return arrayMap(value, baseToString) + '';
  22742. }
  22743. if (isSymbol(value)) {
  22744. return symbolToString ? symbolToString.call(value) : '';
  22745. }
  22746. var result = (value + '');
  22747. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22748. }
  22749. /**
  22750. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22751. *
  22752. * @private
  22753. * @param {Array} array The array to inspect.
  22754. * @param {Function} [iteratee] The iteratee invoked per element.
  22755. * @param {Function} [comparator] The comparator invoked per element.
  22756. * @returns {Array} Returns the new duplicate free array.
  22757. */
  22758. function baseUniq(array, iteratee, comparator) {
  22759. var index = -1,
  22760. includes = arrayIncludes,
  22761. length = array.length,
  22762. isCommon = true,
  22763. result = [],
  22764. seen = result;
  22765. if (comparator) {
  22766. isCommon = false;
  22767. includes = arrayIncludesWith;
  22768. }
  22769. else if (length >= LARGE_ARRAY_SIZE) {
  22770. var set = iteratee ? null : createSet(array);
  22771. if (set) {
  22772. return setToArray(set);
  22773. }
  22774. isCommon = false;
  22775. includes = cacheHas;
  22776. seen = new SetCache;
  22777. }
  22778. else {
  22779. seen = iteratee ? [] : result;
  22780. }
  22781. outer:
  22782. while (++index < length) {
  22783. var value = array[index],
  22784. computed = iteratee ? iteratee(value) : value;
  22785. value = (comparator || value !== 0) ? value : 0;
  22786. if (isCommon && computed === computed) {
  22787. var seenIndex = seen.length;
  22788. while (seenIndex--) {
  22789. if (seen[seenIndex] === computed) {
  22790. continue outer;
  22791. }
  22792. }
  22793. if (iteratee) {
  22794. seen.push(computed);
  22795. }
  22796. result.push(value);
  22797. }
  22798. else if (!includes(seen, computed, comparator)) {
  22799. if (seen !== result) {
  22800. seen.push(computed);
  22801. }
  22802. result.push(value);
  22803. }
  22804. }
  22805. return result;
  22806. }
  22807. /**
  22808. * The base implementation of `_.unset`.
  22809. *
  22810. * @private
  22811. * @param {Object} object The object to modify.
  22812. * @param {Array|string} path The property path to unset.
  22813. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22814. */
  22815. function baseUnset(object, path) {
  22816. path = castPath(path, object);
  22817. object = parent(object, path);
  22818. return object == null || delete object[toKey(last(path))];
  22819. }
  22820. /**
  22821. * The base implementation of `_.update`.
  22822. *
  22823. * @private
  22824. * @param {Object} object The object to modify.
  22825. * @param {Array|string} path The path of the property to update.
  22826. * @param {Function} updater The function to produce the updated value.
  22827. * @param {Function} [customizer] The function to customize path creation.
  22828. * @returns {Object} Returns `object`.
  22829. */
  22830. function baseUpdate(object, path, updater, customizer) {
  22831. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22832. }
  22833. /**
  22834. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22835. * without support for iteratee shorthands.
  22836. *
  22837. * @private
  22838. * @param {Array} array The array to query.
  22839. * @param {Function} predicate The function invoked per iteration.
  22840. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22841. * @param {boolean} [fromRight] Specify iterating from right to left.
  22842. * @returns {Array} Returns the slice of `array`.
  22843. */
  22844. function baseWhile(array, predicate, isDrop, fromRight) {
  22845. var length = array.length,
  22846. index = fromRight ? length : -1;
  22847. while ((fromRight ? index-- : ++index < length) &&
  22848. predicate(array[index], index, array)) {}
  22849. return isDrop
  22850. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22851. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22852. }
  22853. /**
  22854. * The base implementation of `wrapperValue` which returns the result of
  22855. * performing a sequence of actions on the unwrapped `value`, where each
  22856. * successive action is supplied the return value of the previous.
  22857. *
  22858. * @private
  22859. * @param {*} value The unwrapped value.
  22860. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22861. * @returns {*} Returns the resolved value.
  22862. */
  22863. function baseWrapperValue(value, actions) {
  22864. var result = value;
  22865. if (result instanceof LazyWrapper) {
  22866. result = result.value();
  22867. }
  22868. return arrayReduce(actions, function(result, action) {
  22869. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22870. }, result);
  22871. }
  22872. /**
  22873. * The base implementation of methods like `_.xor`, without support for
  22874. * iteratee shorthands, that accepts an array of arrays to inspect.
  22875. *
  22876. * @private
  22877. * @param {Array} arrays The arrays to inspect.
  22878. * @param {Function} [iteratee] The iteratee invoked per element.
  22879. * @param {Function} [comparator] The comparator invoked per element.
  22880. * @returns {Array} Returns the new array of values.
  22881. */
  22882. function baseXor(arrays, iteratee, comparator) {
  22883. var length = arrays.length;
  22884. if (length < 2) {
  22885. return length ? baseUniq(arrays[0]) : [];
  22886. }
  22887. var index = -1,
  22888. result = Array(length);
  22889. while (++index < length) {
  22890. var array = arrays[index],
  22891. othIndex = -1;
  22892. while (++othIndex < length) {
  22893. if (othIndex != index) {
  22894. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22895. }
  22896. }
  22897. }
  22898. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22899. }
  22900. /**
  22901. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22902. *
  22903. * @private
  22904. * @param {Array} props The property identifiers.
  22905. * @param {Array} values The property values.
  22906. * @param {Function} assignFunc The function to assign values.
  22907. * @returns {Object} Returns the new object.
  22908. */
  22909. function baseZipObject(props, values, assignFunc) {
  22910. var index = -1,
  22911. length = props.length,
  22912. valsLength = values.length,
  22913. result = {};
  22914. while (++index < length) {
  22915. var value = index < valsLength ? values[index] : undefined;
  22916. assignFunc(result, props[index], value);
  22917. }
  22918. return result;
  22919. }
  22920. /**
  22921. * Casts `value` to an empty array if it's not an array like object.
  22922. *
  22923. * @private
  22924. * @param {*} value The value to inspect.
  22925. * @returns {Array|Object} Returns the cast array-like object.
  22926. */
  22927. function castArrayLikeObject(value) {
  22928. return isArrayLikeObject(value) ? value : [];
  22929. }
  22930. /**
  22931. * Casts `value` to `identity` if it's not a function.
  22932. *
  22933. * @private
  22934. * @param {*} value The value to inspect.
  22935. * @returns {Function} Returns cast function.
  22936. */
  22937. function castFunction(value) {
  22938. return typeof value == 'function' ? value : identity;
  22939. }
  22940. /**
  22941. * Casts `value` to a path array if it's not one.
  22942. *
  22943. * @private
  22944. * @param {*} value The value to inspect.
  22945. * @param {Object} [object] The object to query keys on.
  22946. * @returns {Array} Returns the cast property path array.
  22947. */
  22948. function castPath(value, object) {
  22949. if (isArray(value)) {
  22950. return value;
  22951. }
  22952. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22953. }
  22954. /**
  22955. * A `baseRest` alias which can be replaced with `identity` by module
  22956. * replacement plugins.
  22957. *
  22958. * @private
  22959. * @type {Function}
  22960. * @param {Function} func The function to apply a rest parameter to.
  22961. * @returns {Function} Returns the new function.
  22962. */
  22963. var castRest = baseRest;
  22964. /**
  22965. * Casts `array` to a slice if it's needed.
  22966. *
  22967. * @private
  22968. * @param {Array} array The array to inspect.
  22969. * @param {number} start The start position.
  22970. * @param {number} [end=array.length] The end position.
  22971. * @returns {Array} Returns the cast slice.
  22972. */
  22973. function castSlice(array, start, end) {
  22974. var length = array.length;
  22975. end = end === undefined ? length : end;
  22976. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22977. }
  22978. /**
  22979. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22980. *
  22981. * @private
  22982. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22983. */
  22984. var clearTimeout = ctxClearTimeout || function(id) {
  22985. return root.clearTimeout(id);
  22986. };
  22987. /**
  22988. * Creates a clone of `buffer`.
  22989. *
  22990. * @private
  22991. * @param {Buffer} buffer The buffer to clone.
  22992. * @param {boolean} [isDeep] Specify a deep clone.
  22993. * @returns {Buffer} Returns the cloned buffer.
  22994. */
  22995. function cloneBuffer(buffer, isDeep) {
  22996. if (isDeep) {
  22997. return buffer.slice();
  22998. }
  22999. var length = buffer.length,
  23000. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23001. buffer.copy(result);
  23002. return result;
  23003. }
  23004. /**
  23005. * Creates a clone of `arrayBuffer`.
  23006. *
  23007. * @private
  23008. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23009. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23010. */
  23011. function cloneArrayBuffer(arrayBuffer) {
  23012. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23013. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23014. return result;
  23015. }
  23016. /**
  23017. * Creates a clone of `dataView`.
  23018. *
  23019. * @private
  23020. * @param {Object} dataView The data view to clone.
  23021. * @param {boolean} [isDeep] Specify a deep clone.
  23022. * @returns {Object} Returns the cloned data view.
  23023. */
  23024. function cloneDataView(dataView, isDeep) {
  23025. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23026. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23027. }
  23028. /**
  23029. * Creates a clone of `regexp`.
  23030. *
  23031. * @private
  23032. * @param {Object} regexp The regexp to clone.
  23033. * @returns {Object} Returns the cloned regexp.
  23034. */
  23035. function cloneRegExp(regexp) {
  23036. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23037. result.lastIndex = regexp.lastIndex;
  23038. return result;
  23039. }
  23040. /**
  23041. * Creates a clone of the `symbol` object.
  23042. *
  23043. * @private
  23044. * @param {Object} symbol The symbol object to clone.
  23045. * @returns {Object} Returns the cloned symbol object.
  23046. */
  23047. function cloneSymbol(symbol) {
  23048. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23049. }
  23050. /**
  23051. * Creates a clone of `typedArray`.
  23052. *
  23053. * @private
  23054. * @param {Object} typedArray The typed array to clone.
  23055. * @param {boolean} [isDeep] Specify a deep clone.
  23056. * @returns {Object} Returns the cloned typed array.
  23057. */
  23058. function cloneTypedArray(typedArray, isDeep) {
  23059. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23060. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23061. }
  23062. /**
  23063. * Compares values to sort them in ascending order.
  23064. *
  23065. * @private
  23066. * @param {*} value The value to compare.
  23067. * @param {*} other The other value to compare.
  23068. * @returns {number} Returns the sort order indicator for `value`.
  23069. */
  23070. function compareAscending(value, other) {
  23071. if (value !== other) {
  23072. var valIsDefined = value !== undefined,
  23073. valIsNull = value === null,
  23074. valIsReflexive = value === value,
  23075. valIsSymbol = isSymbol(value);
  23076. var othIsDefined = other !== undefined,
  23077. othIsNull = other === null,
  23078. othIsReflexive = other === other,
  23079. othIsSymbol = isSymbol(other);
  23080. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23081. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23082. (valIsNull && othIsDefined && othIsReflexive) ||
  23083. (!valIsDefined && othIsReflexive) ||
  23084. !valIsReflexive) {
  23085. return 1;
  23086. }
  23087. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23088. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23089. (othIsNull && valIsDefined && valIsReflexive) ||
  23090. (!othIsDefined && valIsReflexive) ||
  23091. !othIsReflexive) {
  23092. return -1;
  23093. }
  23094. }
  23095. return 0;
  23096. }
  23097. /**
  23098. * Used by `_.orderBy` to compare multiple properties of a value to another
  23099. * and stable sort them.
  23100. *
  23101. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23102. * specify an order of "desc" for descending or "asc" for ascending sort order
  23103. * of corresponding values.
  23104. *
  23105. * @private
  23106. * @param {Object} object The object to compare.
  23107. * @param {Object} other The other object to compare.
  23108. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23109. * @returns {number} Returns the sort order indicator for `object`.
  23110. */
  23111. function compareMultiple(object, other, orders) {
  23112. var index = -1,
  23113. objCriteria = object.criteria,
  23114. othCriteria = other.criteria,
  23115. length = objCriteria.length,
  23116. ordersLength = orders.length;
  23117. while (++index < length) {
  23118. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23119. if (result) {
  23120. if (index >= ordersLength) {
  23121. return result;
  23122. }
  23123. var order = orders[index];
  23124. return result * (order == 'desc' ? -1 : 1);
  23125. }
  23126. }
  23127. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23128. // that causes it, under certain circumstances, to provide the same value for
  23129. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23130. // for more details.
  23131. //
  23132. // This also ensures a stable sort in V8 and other engines.
  23133. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23134. return object.index - other.index;
  23135. }
  23136. /**
  23137. * Creates an array that is the composition of partially applied arguments,
  23138. * placeholders, and provided arguments into a single array of arguments.
  23139. *
  23140. * @private
  23141. * @param {Array} args The provided arguments.
  23142. * @param {Array} partials The arguments to prepend to those provided.
  23143. * @param {Array} holders The `partials` placeholder indexes.
  23144. * @params {boolean} [isCurried] Specify composing for a curried function.
  23145. * @returns {Array} Returns the new array of composed arguments.
  23146. */
  23147. function composeArgs(args, partials, holders, isCurried) {
  23148. var argsIndex = -1,
  23149. argsLength = args.length,
  23150. holdersLength = holders.length,
  23151. leftIndex = -1,
  23152. leftLength = partials.length,
  23153. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23154. result = Array(leftLength + rangeLength),
  23155. isUncurried = !isCurried;
  23156. while (++leftIndex < leftLength) {
  23157. result[leftIndex] = partials[leftIndex];
  23158. }
  23159. while (++argsIndex < holdersLength) {
  23160. if (isUncurried || argsIndex < argsLength) {
  23161. result[holders[argsIndex]] = args[argsIndex];
  23162. }
  23163. }
  23164. while (rangeLength--) {
  23165. result[leftIndex++] = args[argsIndex++];
  23166. }
  23167. return result;
  23168. }
  23169. /**
  23170. * This function is like `composeArgs` except that the arguments composition
  23171. * is tailored for `_.partialRight`.
  23172. *
  23173. * @private
  23174. * @param {Array} args The provided arguments.
  23175. * @param {Array} partials The arguments to append to those provided.
  23176. * @param {Array} holders The `partials` placeholder indexes.
  23177. * @params {boolean} [isCurried] Specify composing for a curried function.
  23178. * @returns {Array} Returns the new array of composed arguments.
  23179. */
  23180. function composeArgsRight(args, partials, holders, isCurried) {
  23181. var argsIndex = -1,
  23182. argsLength = args.length,
  23183. holdersIndex = -1,
  23184. holdersLength = holders.length,
  23185. rightIndex = -1,
  23186. rightLength = partials.length,
  23187. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23188. result = Array(rangeLength + rightLength),
  23189. isUncurried = !isCurried;
  23190. while (++argsIndex < rangeLength) {
  23191. result[argsIndex] = args[argsIndex];
  23192. }
  23193. var offset = argsIndex;
  23194. while (++rightIndex < rightLength) {
  23195. result[offset + rightIndex] = partials[rightIndex];
  23196. }
  23197. while (++holdersIndex < holdersLength) {
  23198. if (isUncurried || argsIndex < argsLength) {
  23199. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23200. }
  23201. }
  23202. return result;
  23203. }
  23204. /**
  23205. * Copies the values of `source` to `array`.
  23206. *
  23207. * @private
  23208. * @param {Array} source The array to copy values from.
  23209. * @param {Array} [array=[]] The array to copy values to.
  23210. * @returns {Array} Returns `array`.
  23211. */
  23212. function copyArray(source, array) {
  23213. var index = -1,
  23214. length = source.length;
  23215. array || (array = Array(length));
  23216. while (++index < length) {
  23217. array[index] = source[index];
  23218. }
  23219. return array;
  23220. }
  23221. /**
  23222. * Copies properties of `source` to `object`.
  23223. *
  23224. * @private
  23225. * @param {Object} source The object to copy properties from.
  23226. * @param {Array} props The property identifiers to copy.
  23227. * @param {Object} [object={}] The object to copy properties to.
  23228. * @param {Function} [customizer] The function to customize copied values.
  23229. * @returns {Object} Returns `object`.
  23230. */
  23231. function copyObject(source, props, object, customizer) {
  23232. var isNew = !object;
  23233. object || (object = {});
  23234. var index = -1,
  23235. length = props.length;
  23236. while (++index < length) {
  23237. var key = props[index];
  23238. var newValue = customizer
  23239. ? customizer(object[key], source[key], key, object, source)
  23240. : undefined;
  23241. if (newValue === undefined) {
  23242. newValue = source[key];
  23243. }
  23244. if (isNew) {
  23245. baseAssignValue(object, key, newValue);
  23246. } else {
  23247. assignValue(object, key, newValue);
  23248. }
  23249. }
  23250. return object;
  23251. }
  23252. /**
  23253. * Copies own symbols of `source` to `object`.
  23254. *
  23255. * @private
  23256. * @param {Object} source The object to copy symbols from.
  23257. * @param {Object} [object={}] The object to copy symbols to.
  23258. * @returns {Object} Returns `object`.
  23259. */
  23260. function copySymbols(source, object) {
  23261. return copyObject(source, getSymbols(source), object);
  23262. }
  23263. /**
  23264. * Copies own and inherited symbols of `source` to `object`.
  23265. *
  23266. * @private
  23267. * @param {Object} source The object to copy symbols from.
  23268. * @param {Object} [object={}] The object to copy symbols to.
  23269. * @returns {Object} Returns `object`.
  23270. */
  23271. function copySymbolsIn(source, object) {
  23272. return copyObject(source, getSymbolsIn(source), object);
  23273. }
  23274. /**
  23275. * Creates a function like `_.groupBy`.
  23276. *
  23277. * @private
  23278. * @param {Function} setter The function to set accumulator values.
  23279. * @param {Function} [initializer] The accumulator object initializer.
  23280. * @returns {Function} Returns the new aggregator function.
  23281. */
  23282. function createAggregator(setter, initializer) {
  23283. return function(collection, iteratee) {
  23284. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23285. accumulator = initializer ? initializer() : {};
  23286. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23287. };
  23288. }
  23289. /**
  23290. * Creates a function like `_.assign`.
  23291. *
  23292. * @private
  23293. * @param {Function} assigner The function to assign values.
  23294. * @returns {Function} Returns the new assigner function.
  23295. */
  23296. function createAssigner(assigner) {
  23297. return baseRest(function(object, sources) {
  23298. var index = -1,
  23299. length = sources.length,
  23300. customizer = length > 1 ? sources[length - 1] : undefined,
  23301. guard = length > 2 ? sources[2] : undefined;
  23302. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23303. ? (length--, customizer)
  23304. : undefined;
  23305. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23306. customizer = length < 3 ? undefined : customizer;
  23307. length = 1;
  23308. }
  23309. object = Object(object);
  23310. while (++index < length) {
  23311. var source = sources[index];
  23312. if (source) {
  23313. assigner(object, source, index, customizer);
  23314. }
  23315. }
  23316. return object;
  23317. });
  23318. }
  23319. /**
  23320. * Creates a `baseEach` or `baseEachRight` function.
  23321. *
  23322. * @private
  23323. * @param {Function} eachFunc The function to iterate over a collection.
  23324. * @param {boolean} [fromRight] Specify iterating from right to left.
  23325. * @returns {Function} Returns the new base function.
  23326. */
  23327. function createBaseEach(eachFunc, fromRight) {
  23328. return function(collection, iteratee) {
  23329. if (collection == null) {
  23330. return collection;
  23331. }
  23332. if (!isArrayLike(collection)) {
  23333. return eachFunc(collection, iteratee);
  23334. }
  23335. var length = collection.length,
  23336. index = fromRight ? length : -1,
  23337. iterable = Object(collection);
  23338. while ((fromRight ? index-- : ++index < length)) {
  23339. if (iteratee(iterable[index], index, iterable) === false) {
  23340. break;
  23341. }
  23342. }
  23343. return collection;
  23344. };
  23345. }
  23346. /**
  23347. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23348. *
  23349. * @private
  23350. * @param {boolean} [fromRight] Specify iterating from right to left.
  23351. * @returns {Function} Returns the new base function.
  23352. */
  23353. function createBaseFor(fromRight) {
  23354. return function(object, iteratee, keysFunc) {
  23355. var index = -1,
  23356. iterable = Object(object),
  23357. props = keysFunc(object),
  23358. length = props.length;
  23359. while (length--) {
  23360. var key = props[fromRight ? length : ++index];
  23361. if (iteratee(iterable[key], key, iterable) === false) {
  23362. break;
  23363. }
  23364. }
  23365. return object;
  23366. };
  23367. }
  23368. /**
  23369. * Creates a function that wraps `func` to invoke it with the optional `this`
  23370. * binding of `thisArg`.
  23371. *
  23372. * @private
  23373. * @param {Function} func The function to wrap.
  23374. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23375. * @param {*} [thisArg] The `this` binding of `func`.
  23376. * @returns {Function} Returns the new wrapped function.
  23377. */
  23378. function createBind(func, bitmask, thisArg) {
  23379. var isBind = bitmask & WRAP_BIND_FLAG,
  23380. Ctor = createCtor(func);
  23381. function wrapper() {
  23382. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23383. return fn.apply(isBind ? thisArg : this, arguments);
  23384. }
  23385. return wrapper;
  23386. }
  23387. /**
  23388. * Creates a function like `_.lowerFirst`.
  23389. *
  23390. * @private
  23391. * @param {string} methodName The name of the `String` case method to use.
  23392. * @returns {Function} Returns the new case function.
  23393. */
  23394. function createCaseFirst(methodName) {
  23395. return function(string) {
  23396. string = toString(string);
  23397. var strSymbols = hasUnicode(string)
  23398. ? stringToArray(string)
  23399. : undefined;
  23400. var chr = strSymbols
  23401. ? strSymbols[0]
  23402. : string.charAt(0);
  23403. var trailing = strSymbols
  23404. ? castSlice(strSymbols, 1).join('')
  23405. : string.slice(1);
  23406. return chr[methodName]() + trailing;
  23407. };
  23408. }
  23409. /**
  23410. * Creates a function like `_.camelCase`.
  23411. *
  23412. * @private
  23413. * @param {Function} callback The function to combine each word.
  23414. * @returns {Function} Returns the new compounder function.
  23415. */
  23416. function createCompounder(callback) {
  23417. return function(string) {
  23418. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23419. };
  23420. }
  23421. /**
  23422. * Creates a function that produces an instance of `Ctor` regardless of
  23423. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23424. *
  23425. * @private
  23426. * @param {Function} Ctor The constructor to wrap.
  23427. * @returns {Function} Returns the new wrapped function.
  23428. */
  23429. function createCtor(Ctor) {
  23430. return function() {
  23431. // Use a `switch` statement to work with class constructors. See
  23432. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23433. // for more details.
  23434. var args = arguments;
  23435. switch (args.length) {
  23436. case 0: return new Ctor;
  23437. case 1: return new Ctor(args[0]);
  23438. case 2: return new Ctor(args[0], args[1]);
  23439. case 3: return new Ctor(args[0], args[1], args[2]);
  23440. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23441. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23442. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23443. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23444. }
  23445. var thisBinding = baseCreate(Ctor.prototype),
  23446. result = Ctor.apply(thisBinding, args);
  23447. // Mimic the constructor's `return` behavior.
  23448. // See https://es5.github.io/#x13.2.2 for more details.
  23449. return isObject(result) ? result : thisBinding;
  23450. };
  23451. }
  23452. /**
  23453. * Creates a function that wraps `func` to enable currying.
  23454. *
  23455. * @private
  23456. * @param {Function} func The function to wrap.
  23457. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23458. * @param {number} arity The arity of `func`.
  23459. * @returns {Function} Returns the new wrapped function.
  23460. */
  23461. function createCurry(func, bitmask, arity) {
  23462. var Ctor = createCtor(func);
  23463. function wrapper() {
  23464. var length = arguments.length,
  23465. args = Array(length),
  23466. index = length,
  23467. placeholder = getHolder(wrapper);
  23468. while (index--) {
  23469. args[index] = arguments[index];
  23470. }
  23471. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23472. ? []
  23473. : replaceHolders(args, placeholder);
  23474. length -= holders.length;
  23475. if (length < arity) {
  23476. return createRecurry(
  23477. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23478. args, holders, undefined, undefined, arity - length);
  23479. }
  23480. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23481. return apply(fn, this, args);
  23482. }
  23483. return wrapper;
  23484. }
  23485. /**
  23486. * Creates a `_.find` or `_.findLast` function.
  23487. *
  23488. * @private
  23489. * @param {Function} findIndexFunc The function to find the collection index.
  23490. * @returns {Function} Returns the new find function.
  23491. */
  23492. function createFind(findIndexFunc) {
  23493. return function(collection, predicate, fromIndex) {
  23494. var iterable = Object(collection);
  23495. if (!isArrayLike(collection)) {
  23496. var iteratee = getIteratee(predicate, 3);
  23497. collection = keys(collection);
  23498. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23499. }
  23500. var index = findIndexFunc(collection, predicate, fromIndex);
  23501. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23502. };
  23503. }
  23504. /**
  23505. * Creates a `_.flow` or `_.flowRight` function.
  23506. *
  23507. * @private
  23508. * @param {boolean} [fromRight] Specify iterating from right to left.
  23509. * @returns {Function} Returns the new flow function.
  23510. */
  23511. function createFlow(fromRight) {
  23512. return flatRest(function(funcs) {
  23513. var length = funcs.length,
  23514. index = length,
  23515. prereq = LodashWrapper.prototype.thru;
  23516. if (fromRight) {
  23517. funcs.reverse();
  23518. }
  23519. while (index--) {
  23520. var func = funcs[index];
  23521. if (typeof func != 'function') {
  23522. throw new TypeError(FUNC_ERROR_TEXT);
  23523. }
  23524. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23525. var wrapper = new LodashWrapper([], true);
  23526. }
  23527. }
  23528. index = wrapper ? index : length;
  23529. while (++index < length) {
  23530. func = funcs[index];
  23531. var funcName = getFuncName(func),
  23532. data = funcName == 'wrapper' ? getData(func) : undefined;
  23533. if (data && isLaziable(data[0]) &&
  23534. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23535. !data[4].length && data[9] == 1
  23536. ) {
  23537. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23538. } else {
  23539. wrapper = (func.length == 1 && isLaziable(func))
  23540. ? wrapper[funcName]()
  23541. : wrapper.thru(func);
  23542. }
  23543. }
  23544. return function() {
  23545. var args = arguments,
  23546. value = args[0];
  23547. if (wrapper && args.length == 1 && isArray(value)) {
  23548. return wrapper.plant(value).value();
  23549. }
  23550. var index = 0,
  23551. result = length ? funcs[index].apply(this, args) : value;
  23552. while (++index < length) {
  23553. result = funcs[index].call(this, result);
  23554. }
  23555. return result;
  23556. };
  23557. });
  23558. }
  23559. /**
  23560. * Creates a function that wraps `func` to invoke it with optional `this`
  23561. * binding of `thisArg`, partial application, and currying.
  23562. *
  23563. * @private
  23564. * @param {Function|string} func The function or method name to wrap.
  23565. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23566. * @param {*} [thisArg] The `this` binding of `func`.
  23567. * @param {Array} [partials] The arguments to prepend to those provided to
  23568. * the new function.
  23569. * @param {Array} [holders] The `partials` placeholder indexes.
  23570. * @param {Array} [partialsRight] The arguments to append to those provided
  23571. * to the new function.
  23572. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23573. * @param {Array} [argPos] The argument positions of the new function.
  23574. * @param {number} [ary] The arity cap of `func`.
  23575. * @param {number} [arity] The arity of `func`.
  23576. * @returns {Function} Returns the new wrapped function.
  23577. */
  23578. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23579. var isAry = bitmask & WRAP_ARY_FLAG,
  23580. isBind = bitmask & WRAP_BIND_FLAG,
  23581. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23582. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23583. isFlip = bitmask & WRAP_FLIP_FLAG,
  23584. Ctor = isBindKey ? undefined : createCtor(func);
  23585. function wrapper() {
  23586. var length = arguments.length,
  23587. args = Array(length),
  23588. index = length;
  23589. while (index--) {
  23590. args[index] = arguments[index];
  23591. }
  23592. if (isCurried) {
  23593. var placeholder = getHolder(wrapper),
  23594. holdersCount = countHolders(args, placeholder);
  23595. }
  23596. if (partials) {
  23597. args = composeArgs(args, partials, holders, isCurried);
  23598. }
  23599. if (partialsRight) {
  23600. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23601. }
  23602. length -= holdersCount;
  23603. if (isCurried && length < arity) {
  23604. var newHolders = replaceHolders(args, placeholder);
  23605. return createRecurry(
  23606. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23607. args, newHolders, argPos, ary, arity - length
  23608. );
  23609. }
  23610. var thisBinding = isBind ? thisArg : this,
  23611. fn = isBindKey ? thisBinding[func] : func;
  23612. length = args.length;
  23613. if (argPos) {
  23614. args = reorder(args, argPos);
  23615. } else if (isFlip && length > 1) {
  23616. args.reverse();
  23617. }
  23618. if (isAry && ary < length) {
  23619. args.length = ary;
  23620. }
  23621. if (this && this !== root && this instanceof wrapper) {
  23622. fn = Ctor || createCtor(fn);
  23623. }
  23624. return fn.apply(thisBinding, args);
  23625. }
  23626. return wrapper;
  23627. }
  23628. /**
  23629. * Creates a function like `_.invertBy`.
  23630. *
  23631. * @private
  23632. * @param {Function} setter The function to set accumulator values.
  23633. * @param {Function} toIteratee The function to resolve iteratees.
  23634. * @returns {Function} Returns the new inverter function.
  23635. */
  23636. function createInverter(setter, toIteratee) {
  23637. return function(object, iteratee) {
  23638. return baseInverter(object, setter, toIteratee(iteratee), {});
  23639. };
  23640. }
  23641. /**
  23642. * Creates a function that performs a mathematical operation on two values.
  23643. *
  23644. * @private
  23645. * @param {Function} operator The function to perform the operation.
  23646. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23647. * @returns {Function} Returns the new mathematical operation function.
  23648. */
  23649. function createMathOperation(operator, defaultValue) {
  23650. return function(value, other) {
  23651. var result;
  23652. if (value === undefined && other === undefined) {
  23653. return defaultValue;
  23654. }
  23655. if (value !== undefined) {
  23656. result = value;
  23657. }
  23658. if (other !== undefined) {
  23659. if (result === undefined) {
  23660. return other;
  23661. }
  23662. if (typeof value == 'string' || typeof other == 'string') {
  23663. value = baseToString(value);
  23664. other = baseToString(other);
  23665. } else {
  23666. value = baseToNumber(value);
  23667. other = baseToNumber(other);
  23668. }
  23669. result = operator(value, other);
  23670. }
  23671. return result;
  23672. };
  23673. }
  23674. /**
  23675. * Creates a function like `_.over`.
  23676. *
  23677. * @private
  23678. * @param {Function} arrayFunc The function to iterate over iteratees.
  23679. * @returns {Function} Returns the new over function.
  23680. */
  23681. function createOver(arrayFunc) {
  23682. return flatRest(function(iteratees) {
  23683. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23684. return baseRest(function(args) {
  23685. var thisArg = this;
  23686. return arrayFunc(iteratees, function(iteratee) {
  23687. return apply(iteratee, thisArg, args);
  23688. });
  23689. });
  23690. });
  23691. }
  23692. /**
  23693. * Creates the padding for `string` based on `length`. The `chars` string
  23694. * is truncated if the number of characters exceeds `length`.
  23695. *
  23696. * @private
  23697. * @param {number} length The padding length.
  23698. * @param {string} [chars=' '] The string used as padding.
  23699. * @returns {string} Returns the padding for `string`.
  23700. */
  23701. function createPadding(length, chars) {
  23702. chars = chars === undefined ? ' ' : baseToString(chars);
  23703. var charsLength = chars.length;
  23704. if (charsLength < 2) {
  23705. return charsLength ? baseRepeat(chars, length) : chars;
  23706. }
  23707. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23708. return hasUnicode(chars)
  23709. ? castSlice(stringToArray(result), 0, length).join('')
  23710. : result.slice(0, length);
  23711. }
  23712. /**
  23713. * Creates a function that wraps `func` to invoke it with the `this` binding
  23714. * of `thisArg` and `partials` prepended to the arguments it receives.
  23715. *
  23716. * @private
  23717. * @param {Function} func The function to wrap.
  23718. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23719. * @param {*} thisArg The `this` binding of `func`.
  23720. * @param {Array} partials The arguments to prepend to those provided to
  23721. * the new function.
  23722. * @returns {Function} Returns the new wrapped function.
  23723. */
  23724. function createPartial(func, bitmask, thisArg, partials) {
  23725. var isBind = bitmask & WRAP_BIND_FLAG,
  23726. Ctor = createCtor(func);
  23727. function wrapper() {
  23728. var argsIndex = -1,
  23729. argsLength = arguments.length,
  23730. leftIndex = -1,
  23731. leftLength = partials.length,
  23732. args = Array(leftLength + argsLength),
  23733. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23734. while (++leftIndex < leftLength) {
  23735. args[leftIndex] = partials[leftIndex];
  23736. }
  23737. while (argsLength--) {
  23738. args[leftIndex++] = arguments[++argsIndex];
  23739. }
  23740. return apply(fn, isBind ? thisArg : this, args);
  23741. }
  23742. return wrapper;
  23743. }
  23744. /**
  23745. * Creates a `_.range` or `_.rangeRight` function.
  23746. *
  23747. * @private
  23748. * @param {boolean} [fromRight] Specify iterating from right to left.
  23749. * @returns {Function} Returns the new range function.
  23750. */
  23751. function createRange(fromRight) {
  23752. return function(start, end, step) {
  23753. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23754. end = step = undefined;
  23755. }
  23756. // Ensure the sign of `-0` is preserved.
  23757. start = toFinite(start);
  23758. if (end === undefined) {
  23759. end = start;
  23760. start = 0;
  23761. } else {
  23762. end = toFinite(end);
  23763. }
  23764. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23765. return baseRange(start, end, step, fromRight);
  23766. };
  23767. }
  23768. /**
  23769. * Creates a function that performs a relational operation on two values.
  23770. *
  23771. * @private
  23772. * @param {Function} operator The function to perform the operation.
  23773. * @returns {Function} Returns the new relational operation function.
  23774. */
  23775. function createRelationalOperation(operator) {
  23776. return function(value, other) {
  23777. if (!(typeof value == 'string' && typeof other == 'string')) {
  23778. value = toNumber(value);
  23779. other = toNumber(other);
  23780. }
  23781. return operator(value, other);
  23782. };
  23783. }
  23784. /**
  23785. * Creates a function that wraps `func` to continue currying.
  23786. *
  23787. * @private
  23788. * @param {Function} func The function to wrap.
  23789. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23790. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23791. * @param {*} placeholder The placeholder value.
  23792. * @param {*} [thisArg] The `this` binding of `func`.
  23793. * @param {Array} [partials] The arguments to prepend to those provided to
  23794. * the new function.
  23795. * @param {Array} [holders] The `partials` placeholder indexes.
  23796. * @param {Array} [argPos] The argument positions of the new function.
  23797. * @param {number} [ary] The arity cap of `func`.
  23798. * @param {number} [arity] The arity of `func`.
  23799. * @returns {Function} Returns the new wrapped function.
  23800. */
  23801. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23802. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23803. newHolders = isCurry ? holders : undefined,
  23804. newHoldersRight = isCurry ? undefined : holders,
  23805. newPartials = isCurry ? partials : undefined,
  23806. newPartialsRight = isCurry ? undefined : partials;
  23807. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23808. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23809. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23810. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23811. }
  23812. var newData = [
  23813. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23814. newHoldersRight, argPos, ary, arity
  23815. ];
  23816. var result = wrapFunc.apply(undefined, newData);
  23817. if (isLaziable(func)) {
  23818. setData(result, newData);
  23819. }
  23820. result.placeholder = placeholder;
  23821. return setWrapToString(result, func, bitmask);
  23822. }
  23823. /**
  23824. * Creates a function like `_.round`.
  23825. *
  23826. * @private
  23827. * @param {string} methodName The name of the `Math` method to use when rounding.
  23828. * @returns {Function} Returns the new round function.
  23829. */
  23830. function createRound(methodName) {
  23831. var func = Math[methodName];
  23832. return function(number, precision) {
  23833. number = toNumber(number);
  23834. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23835. if (precision && nativeIsFinite(number)) {
  23836. // Shift with exponential notation to avoid floating-point issues.
  23837. // See [MDN](https://mdn.io/round#Examples) for more details.
  23838. var pair = (toString(number) + 'e').split('e'),
  23839. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23840. pair = (toString(value) + 'e').split('e');
  23841. return +(pair[0] + 'e' + (+pair[1] - precision));
  23842. }
  23843. return func(number);
  23844. };
  23845. }
  23846. /**
  23847. * Creates a set object of `values`.
  23848. *
  23849. * @private
  23850. * @param {Array} values The values to add to the set.
  23851. * @returns {Object} Returns the new set.
  23852. */
  23853. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23854. return new Set(values);
  23855. };
  23856. /**
  23857. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23858. *
  23859. * @private
  23860. * @param {Function} keysFunc The function to get the keys of a given object.
  23861. * @returns {Function} Returns the new pairs function.
  23862. */
  23863. function createToPairs(keysFunc) {
  23864. return function(object) {
  23865. var tag = getTag(object);
  23866. if (tag == mapTag) {
  23867. return mapToArray(object);
  23868. }
  23869. if (tag == setTag) {
  23870. return setToPairs(object);
  23871. }
  23872. return baseToPairs(object, keysFunc(object));
  23873. };
  23874. }
  23875. /**
  23876. * Creates a function that either curries or invokes `func` with optional
  23877. * `this` binding and partially applied arguments.
  23878. *
  23879. * @private
  23880. * @param {Function|string} func The function or method name to wrap.
  23881. * @param {number} bitmask The bitmask flags.
  23882. * 1 - `_.bind`
  23883. * 2 - `_.bindKey`
  23884. * 4 - `_.curry` or `_.curryRight` of a bound function
  23885. * 8 - `_.curry`
  23886. * 16 - `_.curryRight`
  23887. * 32 - `_.partial`
  23888. * 64 - `_.partialRight`
  23889. * 128 - `_.rearg`
  23890. * 256 - `_.ary`
  23891. * 512 - `_.flip`
  23892. * @param {*} [thisArg] The `this` binding of `func`.
  23893. * @param {Array} [partials] The arguments to be partially applied.
  23894. * @param {Array} [holders] The `partials` placeholder indexes.
  23895. * @param {Array} [argPos] The argument positions of the new function.
  23896. * @param {number} [ary] The arity cap of `func`.
  23897. * @param {number} [arity] The arity of `func`.
  23898. * @returns {Function} Returns the new wrapped function.
  23899. */
  23900. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23901. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23902. if (!isBindKey && typeof func != 'function') {
  23903. throw new TypeError(FUNC_ERROR_TEXT);
  23904. }
  23905. var length = partials ? partials.length : 0;
  23906. if (!length) {
  23907. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23908. partials = holders = undefined;
  23909. }
  23910. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23911. arity = arity === undefined ? arity : toInteger(arity);
  23912. length -= holders ? holders.length : 0;
  23913. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23914. var partialsRight = partials,
  23915. holdersRight = holders;
  23916. partials = holders = undefined;
  23917. }
  23918. var data = isBindKey ? undefined : getData(func);
  23919. var newData = [
  23920. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23921. argPos, ary, arity
  23922. ];
  23923. if (data) {
  23924. mergeData(newData, data);
  23925. }
  23926. func = newData[0];
  23927. bitmask = newData[1];
  23928. thisArg = newData[2];
  23929. partials = newData[3];
  23930. holders = newData[4];
  23931. arity = newData[9] = newData[9] === undefined
  23932. ? (isBindKey ? 0 : func.length)
  23933. : nativeMax(newData[9] - length, 0);
  23934. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23935. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23936. }
  23937. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23938. var result = createBind(func, bitmask, thisArg);
  23939. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23940. result = createCurry(func, bitmask, arity);
  23941. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23942. result = createPartial(func, bitmask, thisArg, partials);
  23943. } else {
  23944. result = createHybrid.apply(undefined, newData);
  23945. }
  23946. var setter = data ? baseSetData : setData;
  23947. return setWrapToString(setter(result, newData), func, bitmask);
  23948. }
  23949. /**
  23950. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23951. * of source objects to the destination object for all destination properties
  23952. * that resolve to `undefined`.
  23953. *
  23954. * @private
  23955. * @param {*} objValue The destination value.
  23956. * @param {*} srcValue The source value.
  23957. * @param {string} key The key of the property to assign.
  23958. * @param {Object} object The parent object of `objValue`.
  23959. * @returns {*} Returns the value to assign.
  23960. */
  23961. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23962. if (objValue === undefined ||
  23963. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23964. return srcValue;
  23965. }
  23966. return objValue;
  23967. }
  23968. /**
  23969. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23970. * objects into destination objects that are passed thru.
  23971. *
  23972. * @private
  23973. * @param {*} objValue The destination value.
  23974. * @param {*} srcValue The source value.
  23975. * @param {string} key The key of the property to merge.
  23976. * @param {Object} object The parent object of `objValue`.
  23977. * @param {Object} source The parent object of `srcValue`.
  23978. * @param {Object} [stack] Tracks traversed source values and their merged
  23979. * counterparts.
  23980. * @returns {*} Returns the value to assign.
  23981. */
  23982. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23983. if (isObject(objValue) && isObject(srcValue)) {
  23984. // Recursively merge objects and arrays (susceptible to call stack limits).
  23985. stack.set(srcValue, objValue);
  23986. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23987. stack['delete'](srcValue);
  23988. }
  23989. return objValue;
  23990. }
  23991. /**
  23992. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23993. * objects.
  23994. *
  23995. * @private
  23996. * @param {*} value The value to inspect.
  23997. * @param {string} key The key of the property to inspect.
  23998. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23999. */
  24000. function customOmitClone(value) {
  24001. return isPlainObject(value) ? undefined : value;
  24002. }
  24003. /**
  24004. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24005. * partial deep comparisons.
  24006. *
  24007. * @private
  24008. * @param {Array} array The array to compare.
  24009. * @param {Array} other The other array to compare.
  24010. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24011. * @param {Function} customizer The function to customize comparisons.
  24012. * @param {Function} equalFunc The function to determine equivalents of values.
  24013. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24014. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24015. */
  24016. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24017. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24018. arrLength = array.length,
  24019. othLength = other.length;
  24020. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24021. return false;
  24022. }
  24023. // Assume cyclic values are equal.
  24024. var stacked = stack.get(array);
  24025. if (stacked && stack.get(other)) {
  24026. return stacked == other;
  24027. }
  24028. var index = -1,
  24029. result = true,
  24030. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24031. stack.set(array, other);
  24032. stack.set(other, array);
  24033. // Ignore non-index properties.
  24034. while (++index < arrLength) {
  24035. var arrValue = array[index],
  24036. othValue = other[index];
  24037. if (customizer) {
  24038. var compared = isPartial
  24039. ? customizer(othValue, arrValue, index, other, array, stack)
  24040. : customizer(arrValue, othValue, index, array, other, stack);
  24041. }
  24042. if (compared !== undefined) {
  24043. if (compared) {
  24044. continue;
  24045. }
  24046. result = false;
  24047. break;
  24048. }
  24049. // Recursively compare arrays (susceptible to call stack limits).
  24050. if (seen) {
  24051. if (!arraySome(other, function(othValue, othIndex) {
  24052. if (!cacheHas(seen, othIndex) &&
  24053. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24054. return seen.push(othIndex);
  24055. }
  24056. })) {
  24057. result = false;
  24058. break;
  24059. }
  24060. } else if (!(
  24061. arrValue === othValue ||
  24062. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24063. )) {
  24064. result = false;
  24065. break;
  24066. }
  24067. }
  24068. stack['delete'](array);
  24069. stack['delete'](other);
  24070. return result;
  24071. }
  24072. /**
  24073. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24074. * the same `toStringTag`.
  24075. *
  24076. * **Note:** This function only supports comparing values with tags of
  24077. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24078. *
  24079. * @private
  24080. * @param {Object} object The object to compare.
  24081. * @param {Object} other The other object to compare.
  24082. * @param {string} tag The `toStringTag` of the objects to compare.
  24083. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24084. * @param {Function} customizer The function to customize comparisons.
  24085. * @param {Function} equalFunc The function to determine equivalents of values.
  24086. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24087. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24088. */
  24089. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24090. switch (tag) {
  24091. case dataViewTag:
  24092. if ((object.byteLength != other.byteLength) ||
  24093. (object.byteOffset != other.byteOffset)) {
  24094. return false;
  24095. }
  24096. object = object.buffer;
  24097. other = other.buffer;
  24098. case arrayBufferTag:
  24099. if ((object.byteLength != other.byteLength) ||
  24100. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24101. return false;
  24102. }
  24103. return true;
  24104. case boolTag:
  24105. case dateTag:
  24106. case numberTag:
  24107. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24108. // Invalid dates are coerced to `NaN`.
  24109. return eq(+object, +other);
  24110. case errorTag:
  24111. return object.name == other.name && object.message == other.message;
  24112. case regexpTag:
  24113. case stringTag:
  24114. // Coerce regexes to strings and treat strings, primitives and objects,
  24115. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24116. // for more details.
  24117. return object == (other + '');
  24118. case mapTag:
  24119. var convert = mapToArray;
  24120. case setTag:
  24121. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24122. convert || (convert = setToArray);
  24123. if (object.size != other.size && !isPartial) {
  24124. return false;
  24125. }
  24126. // Assume cyclic values are equal.
  24127. var stacked = stack.get(object);
  24128. if (stacked) {
  24129. return stacked == other;
  24130. }
  24131. bitmask |= COMPARE_UNORDERED_FLAG;
  24132. // Recursively compare objects (susceptible to call stack limits).
  24133. stack.set(object, other);
  24134. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24135. stack['delete'](object);
  24136. return result;
  24137. case symbolTag:
  24138. if (symbolValueOf) {
  24139. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24140. }
  24141. }
  24142. return false;
  24143. }
  24144. /**
  24145. * A specialized version of `baseIsEqualDeep` for objects with support for
  24146. * partial deep comparisons.
  24147. *
  24148. * @private
  24149. * @param {Object} object The object to compare.
  24150. * @param {Object} other The other object to compare.
  24151. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24152. * @param {Function} customizer The function to customize comparisons.
  24153. * @param {Function} equalFunc The function to determine equivalents of values.
  24154. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24155. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24156. */
  24157. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24158. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24159. objProps = getAllKeys(object),
  24160. objLength = objProps.length,
  24161. othProps = getAllKeys(other),
  24162. othLength = othProps.length;
  24163. if (objLength != othLength && !isPartial) {
  24164. return false;
  24165. }
  24166. var index = objLength;
  24167. while (index--) {
  24168. var key = objProps[index];
  24169. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24170. return false;
  24171. }
  24172. }
  24173. // Assume cyclic values are equal.
  24174. var stacked = stack.get(object);
  24175. if (stacked && stack.get(other)) {
  24176. return stacked == other;
  24177. }
  24178. var result = true;
  24179. stack.set(object, other);
  24180. stack.set(other, object);
  24181. var skipCtor = isPartial;
  24182. while (++index < objLength) {
  24183. key = objProps[index];
  24184. var objValue = object[key],
  24185. othValue = other[key];
  24186. if (customizer) {
  24187. var compared = isPartial
  24188. ? customizer(othValue, objValue, key, other, object, stack)
  24189. : customizer(objValue, othValue, key, object, other, stack);
  24190. }
  24191. // Recursively compare objects (susceptible to call stack limits).
  24192. if (!(compared === undefined
  24193. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24194. : compared
  24195. )) {
  24196. result = false;
  24197. break;
  24198. }
  24199. skipCtor || (skipCtor = key == 'constructor');
  24200. }
  24201. if (result && !skipCtor) {
  24202. var objCtor = object.constructor,
  24203. othCtor = other.constructor;
  24204. // Non `Object` object instances with different constructors are not equal.
  24205. if (objCtor != othCtor &&
  24206. ('constructor' in object && 'constructor' in other) &&
  24207. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24208. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24209. result = false;
  24210. }
  24211. }
  24212. stack['delete'](object);
  24213. stack['delete'](other);
  24214. return result;
  24215. }
  24216. /**
  24217. * A specialized version of `baseRest` which flattens the rest array.
  24218. *
  24219. * @private
  24220. * @param {Function} func The function to apply a rest parameter to.
  24221. * @returns {Function} Returns the new function.
  24222. */
  24223. function flatRest(func) {
  24224. return setToString(overRest(func, undefined, flatten), func + '');
  24225. }
  24226. /**
  24227. * Creates an array of own enumerable property names and symbols of `object`.
  24228. *
  24229. * @private
  24230. * @param {Object} object The object to query.
  24231. * @returns {Array} Returns the array of property names and symbols.
  24232. */
  24233. function getAllKeys(object) {
  24234. return baseGetAllKeys(object, keys, getSymbols);
  24235. }
  24236. /**
  24237. * Creates an array of own and inherited enumerable property names and
  24238. * symbols of `object`.
  24239. *
  24240. * @private
  24241. * @param {Object} object The object to query.
  24242. * @returns {Array} Returns the array of property names and symbols.
  24243. */
  24244. function getAllKeysIn(object) {
  24245. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24246. }
  24247. /**
  24248. * Gets metadata for `func`.
  24249. *
  24250. * @private
  24251. * @param {Function} func The function to query.
  24252. * @returns {*} Returns the metadata for `func`.
  24253. */
  24254. var getData = !metaMap ? noop : function(func) {
  24255. return metaMap.get(func);
  24256. };
  24257. /**
  24258. * Gets the name of `func`.
  24259. *
  24260. * @private
  24261. * @param {Function} func The function to query.
  24262. * @returns {string} Returns the function name.
  24263. */
  24264. function getFuncName(func) {
  24265. var result = (func.name + ''),
  24266. array = realNames[result],
  24267. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24268. while (length--) {
  24269. var data = array[length],
  24270. otherFunc = data.func;
  24271. if (otherFunc == null || otherFunc == func) {
  24272. return data.name;
  24273. }
  24274. }
  24275. return result;
  24276. }
  24277. /**
  24278. * Gets the argument placeholder value for `func`.
  24279. *
  24280. * @private
  24281. * @param {Function} func The function to inspect.
  24282. * @returns {*} Returns the placeholder value.
  24283. */
  24284. function getHolder(func) {
  24285. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24286. return object.placeholder;
  24287. }
  24288. /**
  24289. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24290. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24291. * If arguments are provided, the chosen function is invoked with them and
  24292. * its result is returned.
  24293. *
  24294. * @private
  24295. * @param {*} [value] The value to convert to an iteratee.
  24296. * @param {number} [arity] The arity of the created iteratee.
  24297. * @returns {Function} Returns the chosen function or its result.
  24298. */
  24299. function getIteratee() {
  24300. var result = lodash.iteratee || iteratee;
  24301. result = result === iteratee ? baseIteratee : result;
  24302. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24303. }
  24304. /**
  24305. * Gets the data for `map`.
  24306. *
  24307. * @private
  24308. * @param {Object} map The map to query.
  24309. * @param {string} key The reference key.
  24310. * @returns {*} Returns the map data.
  24311. */
  24312. function getMapData(map, key) {
  24313. var data = map.__data__;
  24314. return isKeyable(key)
  24315. ? data[typeof key == 'string' ? 'string' : 'hash']
  24316. : data.map;
  24317. }
  24318. /**
  24319. * Gets the property names, values, and compare flags of `object`.
  24320. *
  24321. * @private
  24322. * @param {Object} object The object to query.
  24323. * @returns {Array} Returns the match data of `object`.
  24324. */
  24325. function getMatchData(object) {
  24326. var result = keys(object),
  24327. length = result.length;
  24328. while (length--) {
  24329. var key = result[length],
  24330. value = object[key];
  24331. result[length] = [key, value, isStrictComparable(value)];
  24332. }
  24333. return result;
  24334. }
  24335. /**
  24336. * Gets the native function at `key` of `object`.
  24337. *
  24338. * @private
  24339. * @param {Object} object The object to query.
  24340. * @param {string} key The key of the method to get.
  24341. * @returns {*} Returns the function if it's native, else `undefined`.
  24342. */
  24343. function getNative(object, key) {
  24344. var value = getValue(object, key);
  24345. return baseIsNative(value) ? value : undefined;
  24346. }
  24347. /**
  24348. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24349. *
  24350. * @private
  24351. * @param {*} value The value to query.
  24352. * @returns {string} Returns the raw `toStringTag`.
  24353. */
  24354. function getRawTag(value) {
  24355. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24356. tag = value[symToStringTag];
  24357. try {
  24358. value[symToStringTag] = undefined;
  24359. var unmasked = true;
  24360. } catch (e) {}
  24361. var result = nativeObjectToString.call(value);
  24362. if (unmasked) {
  24363. if (isOwn) {
  24364. value[symToStringTag] = tag;
  24365. } else {
  24366. delete value[symToStringTag];
  24367. }
  24368. }
  24369. return result;
  24370. }
  24371. /**
  24372. * Creates an array of the own enumerable symbols of `object`.
  24373. *
  24374. * @private
  24375. * @param {Object} object The object to query.
  24376. * @returns {Array} Returns the array of symbols.
  24377. */
  24378. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24379. if (object == null) {
  24380. return [];
  24381. }
  24382. object = Object(object);
  24383. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24384. return propertyIsEnumerable.call(object, symbol);
  24385. });
  24386. };
  24387. /**
  24388. * Creates an array of the own and inherited enumerable symbols of `object`.
  24389. *
  24390. * @private
  24391. * @param {Object} object The object to query.
  24392. * @returns {Array} Returns the array of symbols.
  24393. */
  24394. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24395. var result = [];
  24396. while (object) {
  24397. arrayPush(result, getSymbols(object));
  24398. object = getPrototype(object);
  24399. }
  24400. return result;
  24401. };
  24402. /**
  24403. * Gets the `toStringTag` of `value`.
  24404. *
  24405. * @private
  24406. * @param {*} value The value to query.
  24407. * @returns {string} Returns the `toStringTag`.
  24408. */
  24409. var getTag = baseGetTag;
  24410. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24411. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24412. (Map && getTag(new Map) != mapTag) ||
  24413. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24414. (Set && getTag(new Set) != setTag) ||
  24415. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24416. getTag = function(value) {
  24417. var result = baseGetTag(value),
  24418. Ctor = result == objectTag ? value.constructor : undefined,
  24419. ctorString = Ctor ? toSource(Ctor) : '';
  24420. if (ctorString) {
  24421. switch (ctorString) {
  24422. case dataViewCtorString: return dataViewTag;
  24423. case mapCtorString: return mapTag;
  24424. case promiseCtorString: return promiseTag;
  24425. case setCtorString: return setTag;
  24426. case weakMapCtorString: return weakMapTag;
  24427. }
  24428. }
  24429. return result;
  24430. };
  24431. }
  24432. /**
  24433. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24434. *
  24435. * @private
  24436. * @param {number} start The start of the view.
  24437. * @param {number} end The end of the view.
  24438. * @param {Array} transforms The transformations to apply to the view.
  24439. * @returns {Object} Returns an object containing the `start` and `end`
  24440. * positions of the view.
  24441. */
  24442. function getView(start, end, transforms) {
  24443. var index = -1,
  24444. length = transforms.length;
  24445. while (++index < length) {
  24446. var data = transforms[index],
  24447. size = data.size;
  24448. switch (data.type) {
  24449. case 'drop': start += size; break;
  24450. case 'dropRight': end -= size; break;
  24451. case 'take': end = nativeMin(end, start + size); break;
  24452. case 'takeRight': start = nativeMax(start, end - size); break;
  24453. }
  24454. }
  24455. return { 'start': start, 'end': end };
  24456. }
  24457. /**
  24458. * Extracts wrapper details from the `source` body comment.
  24459. *
  24460. * @private
  24461. * @param {string} source The source to inspect.
  24462. * @returns {Array} Returns the wrapper details.
  24463. */
  24464. function getWrapDetails(source) {
  24465. var match = source.match(reWrapDetails);
  24466. return match ? match[1].split(reSplitDetails) : [];
  24467. }
  24468. /**
  24469. * Checks if `path` exists on `object`.
  24470. *
  24471. * @private
  24472. * @param {Object} object The object to query.
  24473. * @param {Array|string} path The path to check.
  24474. * @param {Function} hasFunc The function to check properties.
  24475. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24476. */
  24477. function hasPath(object, path, hasFunc) {
  24478. path = castPath(path, object);
  24479. var index = -1,
  24480. length = path.length,
  24481. result = false;
  24482. while (++index < length) {
  24483. var key = toKey(path[index]);
  24484. if (!(result = object != null && hasFunc(object, key))) {
  24485. break;
  24486. }
  24487. object = object[key];
  24488. }
  24489. if (result || ++index != length) {
  24490. return result;
  24491. }
  24492. length = object == null ? 0 : object.length;
  24493. return !!length && isLength(length) && isIndex(key, length) &&
  24494. (isArray(object) || isArguments(object));
  24495. }
  24496. /**
  24497. * Initializes an array clone.
  24498. *
  24499. * @private
  24500. * @param {Array} array The array to clone.
  24501. * @returns {Array} Returns the initialized clone.
  24502. */
  24503. function initCloneArray(array) {
  24504. var length = array.length,
  24505. result = new array.constructor(length);
  24506. // Add properties assigned by `RegExp#exec`.
  24507. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24508. result.index = array.index;
  24509. result.input = array.input;
  24510. }
  24511. return result;
  24512. }
  24513. /**
  24514. * Initializes an object clone.
  24515. *
  24516. * @private
  24517. * @param {Object} object The object to clone.
  24518. * @returns {Object} Returns the initialized clone.
  24519. */
  24520. function initCloneObject(object) {
  24521. return (typeof object.constructor == 'function' && !isPrototype(object))
  24522. ? baseCreate(getPrototype(object))
  24523. : {};
  24524. }
  24525. /**
  24526. * Initializes an object clone based on its `toStringTag`.
  24527. *
  24528. * **Note:** This function only supports cloning values with tags of
  24529. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24530. *
  24531. * @private
  24532. * @param {Object} object The object to clone.
  24533. * @param {string} tag The `toStringTag` of the object to clone.
  24534. * @param {boolean} [isDeep] Specify a deep clone.
  24535. * @returns {Object} Returns the initialized clone.
  24536. */
  24537. function initCloneByTag(object, tag, isDeep) {
  24538. var Ctor = object.constructor;
  24539. switch (tag) {
  24540. case arrayBufferTag:
  24541. return cloneArrayBuffer(object);
  24542. case boolTag:
  24543. case dateTag:
  24544. return new Ctor(+object);
  24545. case dataViewTag:
  24546. return cloneDataView(object, isDeep);
  24547. case float32Tag: case float64Tag:
  24548. case int8Tag: case int16Tag: case int32Tag:
  24549. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24550. return cloneTypedArray(object, isDeep);
  24551. case mapTag:
  24552. return new Ctor;
  24553. case numberTag:
  24554. case stringTag:
  24555. return new Ctor(object);
  24556. case regexpTag:
  24557. return cloneRegExp(object);
  24558. case setTag:
  24559. return new Ctor;
  24560. case symbolTag:
  24561. return cloneSymbol(object);
  24562. }
  24563. }
  24564. /**
  24565. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24566. *
  24567. * @private
  24568. * @param {string} source The source to modify.
  24569. * @returns {Array} details The details to insert.
  24570. * @returns {string} Returns the modified source.
  24571. */
  24572. function insertWrapDetails(source, details) {
  24573. var length = details.length;
  24574. if (!length) {
  24575. return source;
  24576. }
  24577. var lastIndex = length - 1;
  24578. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24579. details = details.join(length > 2 ? ', ' : ' ');
  24580. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24581. }
  24582. /**
  24583. * Checks if `value` is a flattenable `arguments` object or array.
  24584. *
  24585. * @private
  24586. * @param {*} value The value to check.
  24587. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24588. */
  24589. function isFlattenable(value) {
  24590. return isArray(value) || isArguments(value) ||
  24591. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24592. }
  24593. /**
  24594. * Checks if `value` is a valid array-like index.
  24595. *
  24596. * @private
  24597. * @param {*} value The value to check.
  24598. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24599. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24600. */
  24601. function isIndex(value, length) {
  24602. var type = typeof value;
  24603. length = length == null ? MAX_SAFE_INTEGER : length;
  24604. return !!length &&
  24605. (type == 'number' ||
  24606. (type != 'symbol' && reIsUint.test(value))) &&
  24607. (value > -1 && value % 1 == 0 && value < length);
  24608. }
  24609. /**
  24610. * Checks if the given arguments are from an iteratee call.
  24611. *
  24612. * @private
  24613. * @param {*} value The potential iteratee value argument.
  24614. * @param {*} index The potential iteratee index or key argument.
  24615. * @param {*} object The potential iteratee object argument.
  24616. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24617. * else `false`.
  24618. */
  24619. function isIterateeCall(value, index, object) {
  24620. if (!isObject(object)) {
  24621. return false;
  24622. }
  24623. var type = typeof index;
  24624. if (type == 'number'
  24625. ? (isArrayLike(object) && isIndex(index, object.length))
  24626. : (type == 'string' && index in object)
  24627. ) {
  24628. return eq(object[index], value);
  24629. }
  24630. return false;
  24631. }
  24632. /**
  24633. * Checks if `value` is a property name and not a property path.
  24634. *
  24635. * @private
  24636. * @param {*} value The value to check.
  24637. * @param {Object} [object] The object to query keys on.
  24638. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24639. */
  24640. function isKey(value, object) {
  24641. if (isArray(value)) {
  24642. return false;
  24643. }
  24644. var type = typeof value;
  24645. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24646. value == null || isSymbol(value)) {
  24647. return true;
  24648. }
  24649. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24650. (object != null && value in Object(object));
  24651. }
  24652. /**
  24653. * Checks if `value` is suitable for use as unique object key.
  24654. *
  24655. * @private
  24656. * @param {*} value The value to check.
  24657. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24658. */
  24659. function isKeyable(value) {
  24660. var type = typeof value;
  24661. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24662. ? (value !== '__proto__')
  24663. : (value === null);
  24664. }
  24665. /**
  24666. * Checks if `func` has a lazy counterpart.
  24667. *
  24668. * @private
  24669. * @param {Function} func The function to check.
  24670. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24671. * else `false`.
  24672. */
  24673. function isLaziable(func) {
  24674. var funcName = getFuncName(func),
  24675. other = lodash[funcName];
  24676. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24677. return false;
  24678. }
  24679. if (func === other) {
  24680. return true;
  24681. }
  24682. var data = getData(other);
  24683. return !!data && func === data[0];
  24684. }
  24685. /**
  24686. * Checks if `func` has its source masked.
  24687. *
  24688. * @private
  24689. * @param {Function} func The function to check.
  24690. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24691. */
  24692. function isMasked(func) {
  24693. return !!maskSrcKey && (maskSrcKey in func);
  24694. }
  24695. /**
  24696. * Checks if `func` is capable of being masked.
  24697. *
  24698. * @private
  24699. * @param {*} value The value to check.
  24700. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24701. */
  24702. var isMaskable = coreJsData ? isFunction : stubFalse;
  24703. /**
  24704. * Checks if `value` is likely a prototype object.
  24705. *
  24706. * @private
  24707. * @param {*} value The value to check.
  24708. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24709. */
  24710. function isPrototype(value) {
  24711. var Ctor = value && value.constructor,
  24712. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24713. return value === proto;
  24714. }
  24715. /**
  24716. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24717. *
  24718. * @private
  24719. * @param {*} value The value to check.
  24720. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24721. * equality comparisons, else `false`.
  24722. */
  24723. function isStrictComparable(value) {
  24724. return value === value && !isObject(value);
  24725. }
  24726. /**
  24727. * A specialized version of `matchesProperty` for source values suitable
  24728. * for strict equality comparisons, i.e. `===`.
  24729. *
  24730. * @private
  24731. * @param {string} key The key of the property to get.
  24732. * @param {*} srcValue The value to match.
  24733. * @returns {Function} Returns the new spec function.
  24734. */
  24735. function matchesStrictComparable(key, srcValue) {
  24736. return function(object) {
  24737. if (object == null) {
  24738. return false;
  24739. }
  24740. return object[key] === srcValue &&
  24741. (srcValue !== undefined || (key in Object(object)));
  24742. };
  24743. }
  24744. /**
  24745. * A specialized version of `_.memoize` which clears the memoized function's
  24746. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24747. *
  24748. * @private
  24749. * @param {Function} func The function to have its output memoized.
  24750. * @returns {Function} Returns the new memoized function.
  24751. */
  24752. function memoizeCapped(func) {
  24753. var result = memoize(func, function(key) {
  24754. if (cache.size === MAX_MEMOIZE_SIZE) {
  24755. cache.clear();
  24756. }
  24757. return key;
  24758. });
  24759. var cache = result.cache;
  24760. return result;
  24761. }
  24762. /**
  24763. * Merges the function metadata of `source` into `data`.
  24764. *
  24765. * Merging metadata reduces the number of wrappers used to invoke a function.
  24766. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24767. * may be applied regardless of execution order. Methods like `_.ary` and
  24768. * `_.rearg` modify function arguments, making the order in which they are
  24769. * executed important, preventing the merging of metadata. However, we make
  24770. * an exception for a safe combined case where curried functions have `_.ary`
  24771. * and or `_.rearg` applied.
  24772. *
  24773. * @private
  24774. * @param {Array} data The destination metadata.
  24775. * @param {Array} source The source metadata.
  24776. * @returns {Array} Returns `data`.
  24777. */
  24778. function mergeData(data, source) {
  24779. var bitmask = data[1],
  24780. srcBitmask = source[1],
  24781. newBitmask = bitmask | srcBitmask,
  24782. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24783. var isCombo =
  24784. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24785. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24786. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24787. // Exit early if metadata can't be merged.
  24788. if (!(isCommon || isCombo)) {
  24789. return data;
  24790. }
  24791. // Use source `thisArg` if available.
  24792. if (srcBitmask & WRAP_BIND_FLAG) {
  24793. data[2] = source[2];
  24794. // Set when currying a bound function.
  24795. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24796. }
  24797. // Compose partial arguments.
  24798. var value = source[3];
  24799. if (value) {
  24800. var partials = data[3];
  24801. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24802. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24803. }
  24804. // Compose partial right arguments.
  24805. value = source[5];
  24806. if (value) {
  24807. partials = data[5];
  24808. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24809. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24810. }
  24811. // Use source `argPos` if available.
  24812. value = source[7];
  24813. if (value) {
  24814. data[7] = value;
  24815. }
  24816. // Use source `ary` if it's smaller.
  24817. if (srcBitmask & WRAP_ARY_FLAG) {
  24818. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24819. }
  24820. // Use source `arity` if one is not provided.
  24821. if (data[9] == null) {
  24822. data[9] = source[9];
  24823. }
  24824. // Use source `func` and merge bitmasks.
  24825. data[0] = source[0];
  24826. data[1] = newBitmask;
  24827. return data;
  24828. }
  24829. /**
  24830. * This function is like
  24831. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24832. * except that it includes inherited enumerable properties.
  24833. *
  24834. * @private
  24835. * @param {Object} object The object to query.
  24836. * @returns {Array} Returns the array of property names.
  24837. */
  24838. function nativeKeysIn(object) {
  24839. var result = [];
  24840. if (object != null) {
  24841. for (var key in Object(object)) {
  24842. result.push(key);
  24843. }
  24844. }
  24845. return result;
  24846. }
  24847. /**
  24848. * Converts `value` to a string using `Object.prototype.toString`.
  24849. *
  24850. * @private
  24851. * @param {*} value The value to convert.
  24852. * @returns {string} Returns the converted string.
  24853. */
  24854. function objectToString(value) {
  24855. return nativeObjectToString.call(value);
  24856. }
  24857. /**
  24858. * A specialized version of `baseRest` which transforms the rest array.
  24859. *
  24860. * @private
  24861. * @param {Function} func The function to apply a rest parameter to.
  24862. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24863. * @param {Function} transform The rest array transform.
  24864. * @returns {Function} Returns the new function.
  24865. */
  24866. function overRest(func, start, transform) {
  24867. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24868. return function() {
  24869. var args = arguments,
  24870. index = -1,
  24871. length = nativeMax(args.length - start, 0),
  24872. array = Array(length);
  24873. while (++index < length) {
  24874. array[index] = args[start + index];
  24875. }
  24876. index = -1;
  24877. var otherArgs = Array(start + 1);
  24878. while (++index < start) {
  24879. otherArgs[index] = args[index];
  24880. }
  24881. otherArgs[start] = transform(array);
  24882. return apply(func, this, otherArgs);
  24883. };
  24884. }
  24885. /**
  24886. * Gets the parent value at `path` of `object`.
  24887. *
  24888. * @private
  24889. * @param {Object} object The object to query.
  24890. * @param {Array} path The path to get the parent value of.
  24891. * @returns {*} Returns the parent value.
  24892. */
  24893. function parent(object, path) {
  24894. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24895. }
  24896. /**
  24897. * Reorder `array` according to the specified indexes where the element at
  24898. * the first index is assigned as the first element, the element at
  24899. * the second index is assigned as the second element, and so on.
  24900. *
  24901. * @private
  24902. * @param {Array} array The array to reorder.
  24903. * @param {Array} indexes The arranged array indexes.
  24904. * @returns {Array} Returns `array`.
  24905. */
  24906. function reorder(array, indexes) {
  24907. var arrLength = array.length,
  24908. length = nativeMin(indexes.length, arrLength),
  24909. oldArray = copyArray(array);
  24910. while (length--) {
  24911. var index = indexes[length];
  24912. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24913. }
  24914. return array;
  24915. }
  24916. /**
  24917. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24918. *
  24919. * @private
  24920. * @param {Object} object The object to query.
  24921. * @param {string} key The key of the property to get.
  24922. * @returns {*} Returns the property value.
  24923. */
  24924. function safeGet(object, key) {
  24925. if (key === 'constructor' && typeof object[key] === 'function') {
  24926. return;
  24927. }
  24928. if (key == '__proto__') {
  24929. return;
  24930. }
  24931. return object[key];
  24932. }
  24933. /**
  24934. * Sets metadata for `func`.
  24935. *
  24936. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24937. * period of time, it will trip its breaker and transition to an identity
  24938. * function to avoid garbage collection pauses in V8. See
  24939. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24940. * for more details.
  24941. *
  24942. * @private
  24943. * @param {Function} func The function to associate metadata with.
  24944. * @param {*} data The metadata.
  24945. * @returns {Function} Returns `func`.
  24946. */
  24947. var setData = shortOut(baseSetData);
  24948. /**
  24949. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24950. *
  24951. * @private
  24952. * @param {Function} func The function to delay.
  24953. * @param {number} wait The number of milliseconds to delay invocation.
  24954. * @returns {number|Object} Returns the timer id or timeout object.
  24955. */
  24956. var setTimeout = ctxSetTimeout || function(func, wait) {
  24957. return root.setTimeout(func, wait);
  24958. };
  24959. /**
  24960. * Sets the `toString` method of `func` to return `string`.
  24961. *
  24962. * @private
  24963. * @param {Function} func The function to modify.
  24964. * @param {Function} string The `toString` result.
  24965. * @returns {Function} Returns `func`.
  24966. */
  24967. var setToString = shortOut(baseSetToString);
  24968. /**
  24969. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24970. * with wrapper details in a comment at the top of the source body.
  24971. *
  24972. * @private
  24973. * @param {Function} wrapper The function to modify.
  24974. * @param {Function} reference The reference function.
  24975. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24976. * @returns {Function} Returns `wrapper`.
  24977. */
  24978. function setWrapToString(wrapper, reference, bitmask) {
  24979. var source = (reference + '');
  24980. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24981. }
  24982. /**
  24983. * Creates a function that'll short out and invoke `identity` instead
  24984. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24985. * milliseconds.
  24986. *
  24987. * @private
  24988. * @param {Function} func The function to restrict.
  24989. * @returns {Function} Returns the new shortable function.
  24990. */
  24991. function shortOut(func) {
  24992. var count = 0,
  24993. lastCalled = 0;
  24994. return function() {
  24995. var stamp = nativeNow(),
  24996. remaining = HOT_SPAN - (stamp - lastCalled);
  24997. lastCalled = stamp;
  24998. if (remaining > 0) {
  24999. if (++count >= HOT_COUNT) {
  25000. return arguments[0];
  25001. }
  25002. } else {
  25003. count = 0;
  25004. }
  25005. return func.apply(undefined, arguments);
  25006. };
  25007. }
  25008. /**
  25009. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25010. *
  25011. * @private
  25012. * @param {Array} array The array to shuffle.
  25013. * @param {number} [size=array.length] The size of `array`.
  25014. * @returns {Array} Returns `array`.
  25015. */
  25016. function shuffleSelf(array, size) {
  25017. var index = -1,
  25018. length = array.length,
  25019. lastIndex = length - 1;
  25020. size = size === undefined ? length : size;
  25021. while (++index < size) {
  25022. var rand = baseRandom(index, lastIndex),
  25023. value = array[rand];
  25024. array[rand] = array[index];
  25025. array[index] = value;
  25026. }
  25027. array.length = size;
  25028. return array;
  25029. }
  25030. /**
  25031. * Converts `string` to a property path array.
  25032. *
  25033. * @private
  25034. * @param {string} string The string to convert.
  25035. * @returns {Array} Returns the property path array.
  25036. */
  25037. var stringToPath = memoizeCapped(function(string) {
  25038. var result = [];
  25039. if (string.charCodeAt(0) === 46 /* . */) {
  25040. result.push('');
  25041. }
  25042. string.replace(rePropName, function(match, number, quote, subString) {
  25043. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25044. });
  25045. return result;
  25046. });
  25047. /**
  25048. * Converts `value` to a string key if it's not a string or symbol.
  25049. *
  25050. * @private
  25051. * @param {*} value The value to inspect.
  25052. * @returns {string|symbol} Returns the key.
  25053. */
  25054. function toKey(value) {
  25055. if (typeof value == 'string' || isSymbol(value)) {
  25056. return value;
  25057. }
  25058. var result = (value + '');
  25059. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25060. }
  25061. /**
  25062. * Converts `func` to its source code.
  25063. *
  25064. * @private
  25065. * @param {Function} func The function to convert.
  25066. * @returns {string} Returns the source code.
  25067. */
  25068. function toSource(func) {
  25069. if (func != null) {
  25070. try {
  25071. return funcToString.call(func);
  25072. } catch (e) {}
  25073. try {
  25074. return (func + '');
  25075. } catch (e) {}
  25076. }
  25077. return '';
  25078. }
  25079. /**
  25080. * Updates wrapper `details` based on `bitmask` flags.
  25081. *
  25082. * @private
  25083. * @returns {Array} details The details to modify.
  25084. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25085. * @returns {Array} Returns `details`.
  25086. */
  25087. function updateWrapDetails(details, bitmask) {
  25088. arrayEach(wrapFlags, function(pair) {
  25089. var value = '_.' + pair[0];
  25090. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25091. details.push(value);
  25092. }
  25093. });
  25094. return details.sort();
  25095. }
  25096. /**
  25097. * Creates a clone of `wrapper`.
  25098. *
  25099. * @private
  25100. * @param {Object} wrapper The wrapper to clone.
  25101. * @returns {Object} Returns the cloned wrapper.
  25102. */
  25103. function wrapperClone(wrapper) {
  25104. if (wrapper instanceof LazyWrapper) {
  25105. return wrapper.clone();
  25106. }
  25107. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25108. result.__actions__ = copyArray(wrapper.__actions__);
  25109. result.__index__ = wrapper.__index__;
  25110. result.__values__ = wrapper.__values__;
  25111. return result;
  25112. }
  25113. /*------------------------------------------------------------------------*/
  25114. /**
  25115. * Creates an array of elements split into groups the length of `size`.
  25116. * If `array` can't be split evenly, the final chunk will be the remaining
  25117. * elements.
  25118. *
  25119. * @static
  25120. * @memberOf _
  25121. * @since 3.0.0
  25122. * @category Array
  25123. * @param {Array} array The array to process.
  25124. * @param {number} [size=1] The length of each chunk
  25125. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25126. * @returns {Array} Returns the new array of chunks.
  25127. * @example
  25128. *
  25129. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25130. * // => [['a', 'b'], ['c', 'd']]
  25131. *
  25132. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25133. * // => [['a', 'b', 'c'], ['d']]
  25134. */
  25135. function chunk(array, size, guard) {
  25136. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25137. size = 1;
  25138. } else {
  25139. size = nativeMax(toInteger(size), 0);
  25140. }
  25141. var length = array == null ? 0 : array.length;
  25142. if (!length || size < 1) {
  25143. return [];
  25144. }
  25145. var index = 0,
  25146. resIndex = 0,
  25147. result = Array(nativeCeil(length / size));
  25148. while (index < length) {
  25149. result[resIndex++] = baseSlice(array, index, (index += size));
  25150. }
  25151. return result;
  25152. }
  25153. /**
  25154. * Creates an array with all falsey values removed. The values `false`, `null`,
  25155. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25156. *
  25157. * @static
  25158. * @memberOf _
  25159. * @since 0.1.0
  25160. * @category Array
  25161. * @param {Array} array The array to compact.
  25162. * @returns {Array} Returns the new array of filtered values.
  25163. * @example
  25164. *
  25165. * _.compact([0, 1, false, 2, '', 3]);
  25166. * // => [1, 2, 3]
  25167. */
  25168. function compact(array) {
  25169. var index = -1,
  25170. length = array == null ? 0 : array.length,
  25171. resIndex = 0,
  25172. result = [];
  25173. while (++index < length) {
  25174. var value = array[index];
  25175. if (value) {
  25176. result[resIndex++] = value;
  25177. }
  25178. }
  25179. return result;
  25180. }
  25181. /**
  25182. * Creates a new array concatenating `array` with any additional arrays
  25183. * and/or values.
  25184. *
  25185. * @static
  25186. * @memberOf _
  25187. * @since 4.0.0
  25188. * @category Array
  25189. * @param {Array} array The array to concatenate.
  25190. * @param {...*} [values] The values to concatenate.
  25191. * @returns {Array} Returns the new concatenated array.
  25192. * @example
  25193. *
  25194. * var array = [1];
  25195. * var other = _.concat(array, 2, [3], [[4]]);
  25196. *
  25197. * console.log(other);
  25198. * // => [1, 2, 3, [4]]
  25199. *
  25200. * console.log(array);
  25201. * // => [1]
  25202. */
  25203. function concat() {
  25204. var length = arguments.length;
  25205. if (!length) {
  25206. return [];
  25207. }
  25208. var args = Array(length - 1),
  25209. array = arguments[0],
  25210. index = length;
  25211. while (index--) {
  25212. args[index - 1] = arguments[index];
  25213. }
  25214. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25215. }
  25216. /**
  25217. * Creates an array of `array` values not included in the other given arrays
  25218. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25219. * for equality comparisons. The order and references of result values are
  25220. * determined by the first array.
  25221. *
  25222. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25223. *
  25224. * @static
  25225. * @memberOf _
  25226. * @since 0.1.0
  25227. * @category Array
  25228. * @param {Array} array The array to inspect.
  25229. * @param {...Array} [values] The values to exclude.
  25230. * @returns {Array} Returns the new array of filtered values.
  25231. * @see _.without, _.xor
  25232. * @example
  25233. *
  25234. * _.difference([2, 1], [2, 3]);
  25235. * // => [1]
  25236. */
  25237. var difference = baseRest(function(array, values) {
  25238. return isArrayLikeObject(array)
  25239. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25240. : [];
  25241. });
  25242. /**
  25243. * This method is like `_.difference` except that it accepts `iteratee` which
  25244. * is invoked for each element of `array` and `values` to generate the criterion
  25245. * by which they're compared. The order and references of result values are
  25246. * determined by the first array. The iteratee is invoked with one argument:
  25247. * (value).
  25248. *
  25249. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 4.0.0
  25254. * @category Array
  25255. * @param {Array} array The array to inspect.
  25256. * @param {...Array} [values] The values to exclude.
  25257. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25258. * @returns {Array} Returns the new array of filtered values.
  25259. * @example
  25260. *
  25261. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25262. * // => [1.2]
  25263. *
  25264. * // The `_.property` iteratee shorthand.
  25265. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25266. * // => [{ 'x': 2 }]
  25267. */
  25268. var differenceBy = baseRest(function(array, values) {
  25269. var iteratee = last(values);
  25270. if (isArrayLikeObject(iteratee)) {
  25271. iteratee = undefined;
  25272. }
  25273. return isArrayLikeObject(array)
  25274. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25275. : [];
  25276. });
  25277. /**
  25278. * This method is like `_.difference` except that it accepts `comparator`
  25279. * which is invoked to compare elements of `array` to `values`. The order and
  25280. * references of result values are determined by the first array. The comparator
  25281. * is invoked with two arguments: (arrVal, othVal).
  25282. *
  25283. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25284. *
  25285. * @static
  25286. * @memberOf _
  25287. * @since 4.0.0
  25288. * @category Array
  25289. * @param {Array} array The array to inspect.
  25290. * @param {...Array} [values] The values to exclude.
  25291. * @param {Function} [comparator] The comparator invoked per element.
  25292. * @returns {Array} Returns the new array of filtered values.
  25293. * @example
  25294. *
  25295. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25296. *
  25297. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25298. * // => [{ 'x': 2, 'y': 1 }]
  25299. */
  25300. var differenceWith = baseRest(function(array, values) {
  25301. var comparator = last(values);
  25302. if (isArrayLikeObject(comparator)) {
  25303. comparator = undefined;
  25304. }
  25305. return isArrayLikeObject(array)
  25306. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25307. : [];
  25308. });
  25309. /**
  25310. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25311. *
  25312. * @static
  25313. * @memberOf _
  25314. * @since 0.5.0
  25315. * @category Array
  25316. * @param {Array} array The array to query.
  25317. * @param {number} [n=1] The number of elements to drop.
  25318. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25319. * @returns {Array} Returns the slice of `array`.
  25320. * @example
  25321. *
  25322. * _.drop([1, 2, 3]);
  25323. * // => [2, 3]
  25324. *
  25325. * _.drop([1, 2, 3], 2);
  25326. * // => [3]
  25327. *
  25328. * _.drop([1, 2, 3], 5);
  25329. * // => []
  25330. *
  25331. * _.drop([1, 2, 3], 0);
  25332. * // => [1, 2, 3]
  25333. */
  25334. function drop(array, n, guard) {
  25335. var length = array == null ? 0 : array.length;
  25336. if (!length) {
  25337. return [];
  25338. }
  25339. n = (guard || n === undefined) ? 1 : toInteger(n);
  25340. return baseSlice(array, n < 0 ? 0 : n, length);
  25341. }
  25342. /**
  25343. * Creates a slice of `array` with `n` elements dropped from the end.
  25344. *
  25345. * @static
  25346. * @memberOf _
  25347. * @since 3.0.0
  25348. * @category Array
  25349. * @param {Array} array The array to query.
  25350. * @param {number} [n=1] The number of elements to drop.
  25351. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25352. * @returns {Array} Returns the slice of `array`.
  25353. * @example
  25354. *
  25355. * _.dropRight([1, 2, 3]);
  25356. * // => [1, 2]
  25357. *
  25358. * _.dropRight([1, 2, 3], 2);
  25359. * // => [1]
  25360. *
  25361. * _.dropRight([1, 2, 3], 5);
  25362. * // => []
  25363. *
  25364. * _.dropRight([1, 2, 3], 0);
  25365. * // => [1, 2, 3]
  25366. */
  25367. function dropRight(array, n, guard) {
  25368. var length = array == null ? 0 : array.length;
  25369. if (!length) {
  25370. return [];
  25371. }
  25372. n = (guard || n === undefined) ? 1 : toInteger(n);
  25373. n = length - n;
  25374. return baseSlice(array, 0, n < 0 ? 0 : n);
  25375. }
  25376. /**
  25377. * Creates a slice of `array` excluding elements dropped from the end.
  25378. * Elements are dropped until `predicate` returns falsey. The predicate is
  25379. * invoked with three arguments: (value, index, array).
  25380. *
  25381. * @static
  25382. * @memberOf _
  25383. * @since 3.0.0
  25384. * @category Array
  25385. * @param {Array} array The array to query.
  25386. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25387. * @returns {Array} Returns the slice of `array`.
  25388. * @example
  25389. *
  25390. * var users = [
  25391. * { 'user': 'barney', 'active': true },
  25392. * { 'user': 'fred', 'active': false },
  25393. * { 'user': 'pebbles', 'active': false }
  25394. * ];
  25395. *
  25396. * _.dropRightWhile(users, function(o) { return !o.active; });
  25397. * // => objects for ['barney']
  25398. *
  25399. * // The `_.matches` iteratee shorthand.
  25400. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25401. * // => objects for ['barney', 'fred']
  25402. *
  25403. * // The `_.matchesProperty` iteratee shorthand.
  25404. * _.dropRightWhile(users, ['active', false]);
  25405. * // => objects for ['barney']
  25406. *
  25407. * // The `_.property` iteratee shorthand.
  25408. * _.dropRightWhile(users, 'active');
  25409. * // => objects for ['barney', 'fred', 'pebbles']
  25410. */
  25411. function dropRightWhile(array, predicate) {
  25412. return (array && array.length)
  25413. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25414. : [];
  25415. }
  25416. /**
  25417. * Creates a slice of `array` excluding elements dropped from the beginning.
  25418. * Elements are dropped until `predicate` returns falsey. The predicate is
  25419. * invoked with three arguments: (value, index, array).
  25420. *
  25421. * @static
  25422. * @memberOf _
  25423. * @since 3.0.0
  25424. * @category Array
  25425. * @param {Array} array The array to query.
  25426. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25427. * @returns {Array} Returns the slice of `array`.
  25428. * @example
  25429. *
  25430. * var users = [
  25431. * { 'user': 'barney', 'active': false },
  25432. * { 'user': 'fred', 'active': false },
  25433. * { 'user': 'pebbles', 'active': true }
  25434. * ];
  25435. *
  25436. * _.dropWhile(users, function(o) { return !o.active; });
  25437. * // => objects for ['pebbles']
  25438. *
  25439. * // The `_.matches` iteratee shorthand.
  25440. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25441. * // => objects for ['fred', 'pebbles']
  25442. *
  25443. * // The `_.matchesProperty` iteratee shorthand.
  25444. * _.dropWhile(users, ['active', false]);
  25445. * // => objects for ['pebbles']
  25446. *
  25447. * // The `_.property` iteratee shorthand.
  25448. * _.dropWhile(users, 'active');
  25449. * // => objects for ['barney', 'fred', 'pebbles']
  25450. */
  25451. function dropWhile(array, predicate) {
  25452. return (array && array.length)
  25453. ? baseWhile(array, getIteratee(predicate, 3), true)
  25454. : [];
  25455. }
  25456. /**
  25457. * Fills elements of `array` with `value` from `start` up to, but not
  25458. * including, `end`.
  25459. *
  25460. * **Note:** This method mutates `array`.
  25461. *
  25462. * @static
  25463. * @memberOf _
  25464. * @since 3.2.0
  25465. * @category Array
  25466. * @param {Array} array The array to fill.
  25467. * @param {*} value The value to fill `array` with.
  25468. * @param {number} [start=0] The start position.
  25469. * @param {number} [end=array.length] The end position.
  25470. * @returns {Array} Returns `array`.
  25471. * @example
  25472. *
  25473. * var array = [1, 2, 3];
  25474. *
  25475. * _.fill(array, 'a');
  25476. * console.log(array);
  25477. * // => ['a', 'a', 'a']
  25478. *
  25479. * _.fill(Array(3), 2);
  25480. * // => [2, 2, 2]
  25481. *
  25482. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25483. * // => [4, '*', '*', 10]
  25484. */
  25485. function fill(array, value, start, end) {
  25486. var length = array == null ? 0 : array.length;
  25487. if (!length) {
  25488. return [];
  25489. }
  25490. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25491. start = 0;
  25492. end = length;
  25493. }
  25494. return baseFill(array, value, start, end);
  25495. }
  25496. /**
  25497. * This method is like `_.find` except that it returns the index of the first
  25498. * element `predicate` returns truthy for instead of the element itself.
  25499. *
  25500. * @static
  25501. * @memberOf _
  25502. * @since 1.1.0
  25503. * @category Array
  25504. * @param {Array} array The array to inspect.
  25505. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25506. * @param {number} [fromIndex=0] The index to search from.
  25507. * @returns {number} Returns the index of the found element, else `-1`.
  25508. * @example
  25509. *
  25510. * var users = [
  25511. * { 'user': 'barney', 'active': false },
  25512. * { 'user': 'fred', 'active': false },
  25513. * { 'user': 'pebbles', 'active': true }
  25514. * ];
  25515. *
  25516. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25517. * // => 0
  25518. *
  25519. * // The `_.matches` iteratee shorthand.
  25520. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25521. * // => 1
  25522. *
  25523. * // The `_.matchesProperty` iteratee shorthand.
  25524. * _.findIndex(users, ['active', false]);
  25525. * // => 0
  25526. *
  25527. * // The `_.property` iteratee shorthand.
  25528. * _.findIndex(users, 'active');
  25529. * // => 2
  25530. */
  25531. function findIndex(array, predicate, fromIndex) {
  25532. var length = array == null ? 0 : array.length;
  25533. if (!length) {
  25534. return -1;
  25535. }
  25536. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25537. if (index < 0) {
  25538. index = nativeMax(length + index, 0);
  25539. }
  25540. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25541. }
  25542. /**
  25543. * This method is like `_.findIndex` except that it iterates over elements
  25544. * of `collection` from right to left.
  25545. *
  25546. * @static
  25547. * @memberOf _
  25548. * @since 2.0.0
  25549. * @category Array
  25550. * @param {Array} array The array to inspect.
  25551. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25552. * @param {number} [fromIndex=array.length-1] The index to search from.
  25553. * @returns {number} Returns the index of the found element, else `-1`.
  25554. * @example
  25555. *
  25556. * var users = [
  25557. * { 'user': 'barney', 'active': true },
  25558. * { 'user': 'fred', 'active': false },
  25559. * { 'user': 'pebbles', 'active': false }
  25560. * ];
  25561. *
  25562. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25563. * // => 2
  25564. *
  25565. * // The `_.matches` iteratee shorthand.
  25566. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25567. * // => 0
  25568. *
  25569. * // The `_.matchesProperty` iteratee shorthand.
  25570. * _.findLastIndex(users, ['active', false]);
  25571. * // => 2
  25572. *
  25573. * // The `_.property` iteratee shorthand.
  25574. * _.findLastIndex(users, 'active');
  25575. * // => 0
  25576. */
  25577. function findLastIndex(array, predicate, fromIndex) {
  25578. var length = array == null ? 0 : array.length;
  25579. if (!length) {
  25580. return -1;
  25581. }
  25582. var index = length - 1;
  25583. if (fromIndex !== undefined) {
  25584. index = toInteger(fromIndex);
  25585. index = fromIndex < 0
  25586. ? nativeMax(length + index, 0)
  25587. : nativeMin(index, length - 1);
  25588. }
  25589. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25590. }
  25591. /**
  25592. * Flattens `array` a single level deep.
  25593. *
  25594. * @static
  25595. * @memberOf _
  25596. * @since 0.1.0
  25597. * @category Array
  25598. * @param {Array} array The array to flatten.
  25599. * @returns {Array} Returns the new flattened array.
  25600. * @example
  25601. *
  25602. * _.flatten([1, [2, [3, [4]], 5]]);
  25603. * // => [1, 2, [3, [4]], 5]
  25604. */
  25605. function flatten(array) {
  25606. var length = array == null ? 0 : array.length;
  25607. return length ? baseFlatten(array, 1) : [];
  25608. }
  25609. /**
  25610. * Recursively flattens `array`.
  25611. *
  25612. * @static
  25613. * @memberOf _
  25614. * @since 3.0.0
  25615. * @category Array
  25616. * @param {Array} array The array to flatten.
  25617. * @returns {Array} Returns the new flattened array.
  25618. * @example
  25619. *
  25620. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25621. * // => [1, 2, 3, 4, 5]
  25622. */
  25623. function flattenDeep(array) {
  25624. var length = array == null ? 0 : array.length;
  25625. return length ? baseFlatten(array, INFINITY) : [];
  25626. }
  25627. /**
  25628. * Recursively flatten `array` up to `depth` times.
  25629. *
  25630. * @static
  25631. * @memberOf _
  25632. * @since 4.4.0
  25633. * @category Array
  25634. * @param {Array} array The array to flatten.
  25635. * @param {number} [depth=1] The maximum recursion depth.
  25636. * @returns {Array} Returns the new flattened array.
  25637. * @example
  25638. *
  25639. * var array = [1, [2, [3, [4]], 5]];
  25640. *
  25641. * _.flattenDepth(array, 1);
  25642. * // => [1, 2, [3, [4]], 5]
  25643. *
  25644. * _.flattenDepth(array, 2);
  25645. * // => [1, 2, 3, [4], 5]
  25646. */
  25647. function flattenDepth(array, depth) {
  25648. var length = array == null ? 0 : array.length;
  25649. if (!length) {
  25650. return [];
  25651. }
  25652. depth = depth === undefined ? 1 : toInteger(depth);
  25653. return baseFlatten(array, depth);
  25654. }
  25655. /**
  25656. * The inverse of `_.toPairs`; this method returns an object composed
  25657. * from key-value `pairs`.
  25658. *
  25659. * @static
  25660. * @memberOf _
  25661. * @since 4.0.0
  25662. * @category Array
  25663. * @param {Array} pairs The key-value pairs.
  25664. * @returns {Object} Returns the new object.
  25665. * @example
  25666. *
  25667. * _.fromPairs([['a', 1], ['b', 2]]);
  25668. * // => { 'a': 1, 'b': 2 }
  25669. */
  25670. function fromPairs(pairs) {
  25671. var index = -1,
  25672. length = pairs == null ? 0 : pairs.length,
  25673. result = {};
  25674. while (++index < length) {
  25675. var pair = pairs[index];
  25676. result[pair[0]] = pair[1];
  25677. }
  25678. return result;
  25679. }
  25680. /**
  25681. * Gets the first element of `array`.
  25682. *
  25683. * @static
  25684. * @memberOf _
  25685. * @since 0.1.0
  25686. * @alias first
  25687. * @category Array
  25688. * @param {Array} array The array to query.
  25689. * @returns {*} Returns the first element of `array`.
  25690. * @example
  25691. *
  25692. * _.head([1, 2, 3]);
  25693. * // => 1
  25694. *
  25695. * _.head([]);
  25696. * // => undefined
  25697. */
  25698. function head(array) {
  25699. return (array && array.length) ? array[0] : undefined;
  25700. }
  25701. /**
  25702. * Gets the index at which the first occurrence of `value` is found in `array`
  25703. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25704. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25705. * offset from the end of `array`.
  25706. *
  25707. * @static
  25708. * @memberOf _
  25709. * @since 0.1.0
  25710. * @category Array
  25711. * @param {Array} array The array to inspect.
  25712. * @param {*} value The value to search for.
  25713. * @param {number} [fromIndex=0] The index to search from.
  25714. * @returns {number} Returns the index of the matched value, else `-1`.
  25715. * @example
  25716. *
  25717. * _.indexOf([1, 2, 1, 2], 2);
  25718. * // => 1
  25719. *
  25720. * // Search from the `fromIndex`.
  25721. * _.indexOf([1, 2, 1, 2], 2, 2);
  25722. * // => 3
  25723. */
  25724. function indexOf(array, value, fromIndex) {
  25725. var length = array == null ? 0 : array.length;
  25726. if (!length) {
  25727. return -1;
  25728. }
  25729. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25730. if (index < 0) {
  25731. index = nativeMax(length + index, 0);
  25732. }
  25733. return baseIndexOf(array, value, index);
  25734. }
  25735. /**
  25736. * Gets all but the last element of `array`.
  25737. *
  25738. * @static
  25739. * @memberOf _
  25740. * @since 0.1.0
  25741. * @category Array
  25742. * @param {Array} array The array to query.
  25743. * @returns {Array} Returns the slice of `array`.
  25744. * @example
  25745. *
  25746. * _.initial([1, 2, 3]);
  25747. * // => [1, 2]
  25748. */
  25749. function initial(array) {
  25750. var length = array == null ? 0 : array.length;
  25751. return length ? baseSlice(array, 0, -1) : [];
  25752. }
  25753. /**
  25754. * Creates an array of unique values that are included in all given arrays
  25755. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25756. * for equality comparisons. The order and references of result values are
  25757. * determined by the first array.
  25758. *
  25759. * @static
  25760. * @memberOf _
  25761. * @since 0.1.0
  25762. * @category Array
  25763. * @param {...Array} [arrays] The arrays to inspect.
  25764. * @returns {Array} Returns the new array of intersecting values.
  25765. * @example
  25766. *
  25767. * _.intersection([2, 1], [2, 3]);
  25768. * // => [2]
  25769. */
  25770. var intersection = baseRest(function(arrays) {
  25771. var mapped = arrayMap(arrays, castArrayLikeObject);
  25772. return (mapped.length && mapped[0] === arrays[0])
  25773. ? baseIntersection(mapped)
  25774. : [];
  25775. });
  25776. /**
  25777. * This method is like `_.intersection` except that it accepts `iteratee`
  25778. * which is invoked for each element of each `arrays` to generate the criterion
  25779. * by which they're compared. The order and references of result values are
  25780. * determined by the first array. The iteratee is invoked with one argument:
  25781. * (value).
  25782. *
  25783. * @static
  25784. * @memberOf _
  25785. * @since 4.0.0
  25786. * @category Array
  25787. * @param {...Array} [arrays] The arrays to inspect.
  25788. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25789. * @returns {Array} Returns the new array of intersecting values.
  25790. * @example
  25791. *
  25792. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25793. * // => [2.1]
  25794. *
  25795. * // The `_.property` iteratee shorthand.
  25796. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25797. * // => [{ 'x': 1 }]
  25798. */
  25799. var intersectionBy = baseRest(function(arrays) {
  25800. var iteratee = last(arrays),
  25801. mapped = arrayMap(arrays, castArrayLikeObject);
  25802. if (iteratee === last(mapped)) {
  25803. iteratee = undefined;
  25804. } else {
  25805. mapped.pop();
  25806. }
  25807. return (mapped.length && mapped[0] === arrays[0])
  25808. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25809. : [];
  25810. });
  25811. /**
  25812. * This method is like `_.intersection` except that it accepts `comparator`
  25813. * which is invoked to compare elements of `arrays`. The order and references
  25814. * of result values are determined by the first array. The comparator is
  25815. * invoked with two arguments: (arrVal, othVal).
  25816. *
  25817. * @static
  25818. * @memberOf _
  25819. * @since 4.0.0
  25820. * @category Array
  25821. * @param {...Array} [arrays] The arrays to inspect.
  25822. * @param {Function} [comparator] The comparator invoked per element.
  25823. * @returns {Array} Returns the new array of intersecting values.
  25824. * @example
  25825. *
  25826. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25827. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25828. *
  25829. * _.intersectionWith(objects, others, _.isEqual);
  25830. * // => [{ 'x': 1, 'y': 2 }]
  25831. */
  25832. var intersectionWith = baseRest(function(arrays) {
  25833. var comparator = last(arrays),
  25834. mapped = arrayMap(arrays, castArrayLikeObject);
  25835. comparator = typeof comparator == 'function' ? comparator : undefined;
  25836. if (comparator) {
  25837. mapped.pop();
  25838. }
  25839. return (mapped.length && mapped[0] === arrays[0])
  25840. ? baseIntersection(mapped, undefined, comparator)
  25841. : [];
  25842. });
  25843. /**
  25844. * Converts all elements in `array` into a string separated by `separator`.
  25845. *
  25846. * @static
  25847. * @memberOf _
  25848. * @since 4.0.0
  25849. * @category Array
  25850. * @param {Array} array The array to convert.
  25851. * @param {string} [separator=','] The element separator.
  25852. * @returns {string} Returns the joined string.
  25853. * @example
  25854. *
  25855. * _.join(['a', 'b', 'c'], '~');
  25856. * // => 'a~b~c'
  25857. */
  25858. function join(array, separator) {
  25859. return array == null ? '' : nativeJoin.call(array, separator);
  25860. }
  25861. /**
  25862. * Gets the last element of `array`.
  25863. *
  25864. * @static
  25865. * @memberOf _
  25866. * @since 0.1.0
  25867. * @category Array
  25868. * @param {Array} array The array to query.
  25869. * @returns {*} Returns the last element of `array`.
  25870. * @example
  25871. *
  25872. * _.last([1, 2, 3]);
  25873. * // => 3
  25874. */
  25875. function last(array) {
  25876. var length = array == null ? 0 : array.length;
  25877. return length ? array[length - 1] : undefined;
  25878. }
  25879. /**
  25880. * This method is like `_.indexOf` except that it iterates over elements of
  25881. * `array` from right to left.
  25882. *
  25883. * @static
  25884. * @memberOf _
  25885. * @since 0.1.0
  25886. * @category Array
  25887. * @param {Array} array The array to inspect.
  25888. * @param {*} value The value to search for.
  25889. * @param {number} [fromIndex=array.length-1] The index to search from.
  25890. * @returns {number} Returns the index of the matched value, else `-1`.
  25891. * @example
  25892. *
  25893. * _.lastIndexOf([1, 2, 1, 2], 2);
  25894. * // => 3
  25895. *
  25896. * // Search from the `fromIndex`.
  25897. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25898. * // => 1
  25899. */
  25900. function lastIndexOf(array, value, fromIndex) {
  25901. var length = array == null ? 0 : array.length;
  25902. if (!length) {
  25903. return -1;
  25904. }
  25905. var index = length;
  25906. if (fromIndex !== undefined) {
  25907. index = toInteger(fromIndex);
  25908. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25909. }
  25910. return value === value
  25911. ? strictLastIndexOf(array, value, index)
  25912. : baseFindIndex(array, baseIsNaN, index, true);
  25913. }
  25914. /**
  25915. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25916. * element from the end is returned.
  25917. *
  25918. * @static
  25919. * @memberOf _
  25920. * @since 4.11.0
  25921. * @category Array
  25922. * @param {Array} array The array to query.
  25923. * @param {number} [n=0] The index of the element to return.
  25924. * @returns {*} Returns the nth element of `array`.
  25925. * @example
  25926. *
  25927. * var array = ['a', 'b', 'c', 'd'];
  25928. *
  25929. * _.nth(array, 1);
  25930. * // => 'b'
  25931. *
  25932. * _.nth(array, -2);
  25933. * // => 'c';
  25934. */
  25935. function nth(array, n) {
  25936. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25937. }
  25938. /**
  25939. * Removes all given values from `array` using
  25940. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25941. * for equality comparisons.
  25942. *
  25943. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25944. * to remove elements from an array by predicate.
  25945. *
  25946. * @static
  25947. * @memberOf _
  25948. * @since 2.0.0
  25949. * @category Array
  25950. * @param {Array} array The array to modify.
  25951. * @param {...*} [values] The values to remove.
  25952. * @returns {Array} Returns `array`.
  25953. * @example
  25954. *
  25955. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25956. *
  25957. * _.pull(array, 'a', 'c');
  25958. * console.log(array);
  25959. * // => ['b', 'b']
  25960. */
  25961. var pull = baseRest(pullAll);
  25962. /**
  25963. * This method is like `_.pull` except that it accepts an array of values to remove.
  25964. *
  25965. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25966. *
  25967. * @static
  25968. * @memberOf _
  25969. * @since 4.0.0
  25970. * @category Array
  25971. * @param {Array} array The array to modify.
  25972. * @param {Array} values The values to remove.
  25973. * @returns {Array} Returns `array`.
  25974. * @example
  25975. *
  25976. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25977. *
  25978. * _.pullAll(array, ['a', 'c']);
  25979. * console.log(array);
  25980. * // => ['b', 'b']
  25981. */
  25982. function pullAll(array, values) {
  25983. return (array && array.length && values && values.length)
  25984. ? basePullAll(array, values)
  25985. : array;
  25986. }
  25987. /**
  25988. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25989. * invoked for each element of `array` and `values` to generate the criterion
  25990. * by which they're compared. The iteratee is invoked with one argument: (value).
  25991. *
  25992. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25993. *
  25994. * @static
  25995. * @memberOf _
  25996. * @since 4.0.0
  25997. * @category Array
  25998. * @param {Array} array The array to modify.
  25999. * @param {Array} values The values to remove.
  26000. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26001. * @returns {Array} Returns `array`.
  26002. * @example
  26003. *
  26004. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26005. *
  26006. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26007. * console.log(array);
  26008. * // => [{ 'x': 2 }]
  26009. */
  26010. function pullAllBy(array, values, iteratee) {
  26011. return (array && array.length && values && values.length)
  26012. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26013. : array;
  26014. }
  26015. /**
  26016. * This method is like `_.pullAll` except that it accepts `comparator` which
  26017. * is invoked to compare elements of `array` to `values`. The comparator is
  26018. * invoked with two arguments: (arrVal, othVal).
  26019. *
  26020. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26021. *
  26022. * @static
  26023. * @memberOf _
  26024. * @since 4.6.0
  26025. * @category Array
  26026. * @param {Array} array The array to modify.
  26027. * @param {Array} values The values to remove.
  26028. * @param {Function} [comparator] The comparator invoked per element.
  26029. * @returns {Array} Returns `array`.
  26030. * @example
  26031. *
  26032. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26033. *
  26034. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26035. * console.log(array);
  26036. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26037. */
  26038. function pullAllWith(array, values, comparator) {
  26039. return (array && array.length && values && values.length)
  26040. ? basePullAll(array, values, undefined, comparator)
  26041. : array;
  26042. }
  26043. /**
  26044. * Removes elements from `array` corresponding to `indexes` and returns an
  26045. * array of removed elements.
  26046. *
  26047. * **Note:** Unlike `_.at`, this method mutates `array`.
  26048. *
  26049. * @static
  26050. * @memberOf _
  26051. * @since 3.0.0
  26052. * @category Array
  26053. * @param {Array} array The array to modify.
  26054. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26055. * @returns {Array} Returns the new array of removed elements.
  26056. * @example
  26057. *
  26058. * var array = ['a', 'b', 'c', 'd'];
  26059. * var pulled = _.pullAt(array, [1, 3]);
  26060. *
  26061. * console.log(array);
  26062. * // => ['a', 'c']
  26063. *
  26064. * console.log(pulled);
  26065. * // => ['b', 'd']
  26066. */
  26067. var pullAt = flatRest(function(array, indexes) {
  26068. var length = array == null ? 0 : array.length,
  26069. result = baseAt(array, indexes);
  26070. basePullAt(array, arrayMap(indexes, function(index) {
  26071. return isIndex(index, length) ? +index : index;
  26072. }).sort(compareAscending));
  26073. return result;
  26074. });
  26075. /**
  26076. * Removes all elements from `array` that `predicate` returns truthy for
  26077. * and returns an array of the removed elements. The predicate is invoked
  26078. * with three arguments: (value, index, array).
  26079. *
  26080. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26081. * to pull elements from an array by value.
  26082. *
  26083. * @static
  26084. * @memberOf _
  26085. * @since 2.0.0
  26086. * @category Array
  26087. * @param {Array} array The array to modify.
  26088. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26089. * @returns {Array} Returns the new array of removed elements.
  26090. * @example
  26091. *
  26092. * var array = [1, 2, 3, 4];
  26093. * var evens = _.remove(array, function(n) {
  26094. * return n % 2 == 0;
  26095. * });
  26096. *
  26097. * console.log(array);
  26098. * // => [1, 3]
  26099. *
  26100. * console.log(evens);
  26101. * // => [2, 4]
  26102. */
  26103. function remove(array, predicate) {
  26104. var result = [];
  26105. if (!(array && array.length)) {
  26106. return result;
  26107. }
  26108. var index = -1,
  26109. indexes = [],
  26110. length = array.length;
  26111. predicate = getIteratee(predicate, 3);
  26112. while (++index < length) {
  26113. var value = array[index];
  26114. if (predicate(value, index, array)) {
  26115. result.push(value);
  26116. indexes.push(index);
  26117. }
  26118. }
  26119. basePullAt(array, indexes);
  26120. return result;
  26121. }
  26122. /**
  26123. * Reverses `array` so that the first element becomes the last, the second
  26124. * element becomes the second to last, and so on.
  26125. *
  26126. * **Note:** This method mutates `array` and is based on
  26127. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26128. *
  26129. * @static
  26130. * @memberOf _
  26131. * @since 4.0.0
  26132. * @category Array
  26133. * @param {Array} array The array to modify.
  26134. * @returns {Array} Returns `array`.
  26135. * @example
  26136. *
  26137. * var array = [1, 2, 3];
  26138. *
  26139. * _.reverse(array);
  26140. * // => [3, 2, 1]
  26141. *
  26142. * console.log(array);
  26143. * // => [3, 2, 1]
  26144. */
  26145. function reverse(array) {
  26146. return array == null ? array : nativeReverse.call(array);
  26147. }
  26148. /**
  26149. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26150. *
  26151. * **Note:** This method is used instead of
  26152. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26153. * returned.
  26154. *
  26155. * @static
  26156. * @memberOf _
  26157. * @since 3.0.0
  26158. * @category Array
  26159. * @param {Array} array The array to slice.
  26160. * @param {number} [start=0] The start position.
  26161. * @param {number} [end=array.length] The end position.
  26162. * @returns {Array} Returns the slice of `array`.
  26163. */
  26164. function slice(array, start, end) {
  26165. var length = array == null ? 0 : array.length;
  26166. if (!length) {
  26167. return [];
  26168. }
  26169. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26170. start = 0;
  26171. end = length;
  26172. }
  26173. else {
  26174. start = start == null ? 0 : toInteger(start);
  26175. end = end === undefined ? length : toInteger(end);
  26176. }
  26177. return baseSlice(array, start, end);
  26178. }
  26179. /**
  26180. * Uses a binary search to determine the lowest index at which `value`
  26181. * should be inserted into `array` in order to maintain its sort order.
  26182. *
  26183. * @static
  26184. * @memberOf _
  26185. * @since 0.1.0
  26186. * @category Array
  26187. * @param {Array} array The sorted array to inspect.
  26188. * @param {*} value The value to evaluate.
  26189. * @returns {number} Returns the index at which `value` should be inserted
  26190. * into `array`.
  26191. * @example
  26192. *
  26193. * _.sortedIndex([30, 50], 40);
  26194. * // => 1
  26195. */
  26196. function sortedIndex(array, value) {
  26197. return baseSortedIndex(array, value);
  26198. }
  26199. /**
  26200. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26201. * which is invoked for `value` and each element of `array` to compute their
  26202. * sort ranking. The iteratee is invoked with one argument: (value).
  26203. *
  26204. * @static
  26205. * @memberOf _
  26206. * @since 4.0.0
  26207. * @category Array
  26208. * @param {Array} array The sorted array to inspect.
  26209. * @param {*} value The value to evaluate.
  26210. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26211. * @returns {number} Returns the index at which `value` should be inserted
  26212. * into `array`.
  26213. * @example
  26214. *
  26215. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26216. *
  26217. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26218. * // => 0
  26219. *
  26220. * // The `_.property` iteratee shorthand.
  26221. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26222. * // => 0
  26223. */
  26224. function sortedIndexBy(array, value, iteratee) {
  26225. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26226. }
  26227. /**
  26228. * This method is like `_.indexOf` except that it performs a binary
  26229. * search on a sorted `array`.
  26230. *
  26231. * @static
  26232. * @memberOf _
  26233. * @since 4.0.0
  26234. * @category Array
  26235. * @param {Array} array The array to inspect.
  26236. * @param {*} value The value to search for.
  26237. * @returns {number} Returns the index of the matched value, else `-1`.
  26238. * @example
  26239. *
  26240. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26241. * // => 1
  26242. */
  26243. function sortedIndexOf(array, value) {
  26244. var length = array == null ? 0 : array.length;
  26245. if (length) {
  26246. var index = baseSortedIndex(array, value);
  26247. if (index < length && eq(array[index], value)) {
  26248. return index;
  26249. }
  26250. }
  26251. return -1;
  26252. }
  26253. /**
  26254. * This method is like `_.sortedIndex` except that it returns the highest
  26255. * index at which `value` should be inserted into `array` in order to
  26256. * maintain its sort order.
  26257. *
  26258. * @static
  26259. * @memberOf _
  26260. * @since 3.0.0
  26261. * @category Array
  26262. * @param {Array} array The sorted array to inspect.
  26263. * @param {*} value The value to evaluate.
  26264. * @returns {number} Returns the index at which `value` should be inserted
  26265. * into `array`.
  26266. * @example
  26267. *
  26268. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26269. * // => 4
  26270. */
  26271. function sortedLastIndex(array, value) {
  26272. return baseSortedIndex(array, value, true);
  26273. }
  26274. /**
  26275. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26276. * which is invoked for `value` and each element of `array` to compute their
  26277. * sort ranking. The iteratee is invoked with one argument: (value).
  26278. *
  26279. * @static
  26280. * @memberOf _
  26281. * @since 4.0.0
  26282. * @category Array
  26283. * @param {Array} array The sorted array to inspect.
  26284. * @param {*} value The value to evaluate.
  26285. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26286. * @returns {number} Returns the index at which `value` should be inserted
  26287. * into `array`.
  26288. * @example
  26289. *
  26290. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26291. *
  26292. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26293. * // => 1
  26294. *
  26295. * // The `_.property` iteratee shorthand.
  26296. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26297. * // => 1
  26298. */
  26299. function sortedLastIndexBy(array, value, iteratee) {
  26300. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26301. }
  26302. /**
  26303. * This method is like `_.lastIndexOf` except that it performs a binary
  26304. * search on a sorted `array`.
  26305. *
  26306. * @static
  26307. * @memberOf _
  26308. * @since 4.0.0
  26309. * @category Array
  26310. * @param {Array} array The array to inspect.
  26311. * @param {*} value The value to search for.
  26312. * @returns {number} Returns the index of the matched value, else `-1`.
  26313. * @example
  26314. *
  26315. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26316. * // => 3
  26317. */
  26318. function sortedLastIndexOf(array, value) {
  26319. var length = array == null ? 0 : array.length;
  26320. if (length) {
  26321. var index = baseSortedIndex(array, value, true) - 1;
  26322. if (eq(array[index], value)) {
  26323. return index;
  26324. }
  26325. }
  26326. return -1;
  26327. }
  26328. /**
  26329. * This method is like `_.uniq` except that it's designed and optimized
  26330. * for sorted arrays.
  26331. *
  26332. * @static
  26333. * @memberOf _
  26334. * @since 4.0.0
  26335. * @category Array
  26336. * @param {Array} array The array to inspect.
  26337. * @returns {Array} Returns the new duplicate free array.
  26338. * @example
  26339. *
  26340. * _.sortedUniq([1, 1, 2]);
  26341. * // => [1, 2]
  26342. */
  26343. function sortedUniq(array) {
  26344. return (array && array.length)
  26345. ? baseSortedUniq(array)
  26346. : [];
  26347. }
  26348. /**
  26349. * This method is like `_.uniqBy` except that it's designed and optimized
  26350. * for sorted arrays.
  26351. *
  26352. * @static
  26353. * @memberOf _
  26354. * @since 4.0.0
  26355. * @category Array
  26356. * @param {Array} array The array to inspect.
  26357. * @param {Function} [iteratee] The iteratee invoked per element.
  26358. * @returns {Array} Returns the new duplicate free array.
  26359. * @example
  26360. *
  26361. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26362. * // => [1.1, 2.3]
  26363. */
  26364. function sortedUniqBy(array, iteratee) {
  26365. return (array && array.length)
  26366. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26367. : [];
  26368. }
  26369. /**
  26370. * Gets all but the first element of `array`.
  26371. *
  26372. * @static
  26373. * @memberOf _
  26374. * @since 4.0.0
  26375. * @category Array
  26376. * @param {Array} array The array to query.
  26377. * @returns {Array} Returns the slice of `array`.
  26378. * @example
  26379. *
  26380. * _.tail([1, 2, 3]);
  26381. * // => [2, 3]
  26382. */
  26383. function tail(array) {
  26384. var length = array == null ? 0 : array.length;
  26385. return length ? baseSlice(array, 1, length) : [];
  26386. }
  26387. /**
  26388. * Creates a slice of `array` with `n` elements taken from the beginning.
  26389. *
  26390. * @static
  26391. * @memberOf _
  26392. * @since 0.1.0
  26393. * @category Array
  26394. * @param {Array} array The array to query.
  26395. * @param {number} [n=1] The number of elements to take.
  26396. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26397. * @returns {Array} Returns the slice of `array`.
  26398. * @example
  26399. *
  26400. * _.take([1, 2, 3]);
  26401. * // => [1]
  26402. *
  26403. * _.take([1, 2, 3], 2);
  26404. * // => [1, 2]
  26405. *
  26406. * _.take([1, 2, 3], 5);
  26407. * // => [1, 2, 3]
  26408. *
  26409. * _.take([1, 2, 3], 0);
  26410. * // => []
  26411. */
  26412. function take(array, n, guard) {
  26413. if (!(array && array.length)) {
  26414. return [];
  26415. }
  26416. n = (guard || n === undefined) ? 1 : toInteger(n);
  26417. return baseSlice(array, 0, n < 0 ? 0 : n);
  26418. }
  26419. /**
  26420. * Creates a slice of `array` with `n` elements taken from the end.
  26421. *
  26422. * @static
  26423. * @memberOf _
  26424. * @since 3.0.0
  26425. * @category Array
  26426. * @param {Array} array The array to query.
  26427. * @param {number} [n=1] The number of elements to take.
  26428. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26429. * @returns {Array} Returns the slice of `array`.
  26430. * @example
  26431. *
  26432. * _.takeRight([1, 2, 3]);
  26433. * // => [3]
  26434. *
  26435. * _.takeRight([1, 2, 3], 2);
  26436. * // => [2, 3]
  26437. *
  26438. * _.takeRight([1, 2, 3], 5);
  26439. * // => [1, 2, 3]
  26440. *
  26441. * _.takeRight([1, 2, 3], 0);
  26442. * // => []
  26443. */
  26444. function takeRight(array, n, guard) {
  26445. var length = array == null ? 0 : array.length;
  26446. if (!length) {
  26447. return [];
  26448. }
  26449. n = (guard || n === undefined) ? 1 : toInteger(n);
  26450. n = length - n;
  26451. return baseSlice(array, n < 0 ? 0 : n, length);
  26452. }
  26453. /**
  26454. * Creates a slice of `array` with elements taken from the end. Elements are
  26455. * taken until `predicate` returns falsey. The predicate is invoked with
  26456. * three arguments: (value, index, array).
  26457. *
  26458. * @static
  26459. * @memberOf _
  26460. * @since 3.0.0
  26461. * @category Array
  26462. * @param {Array} array The array to query.
  26463. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26464. * @returns {Array} Returns the slice of `array`.
  26465. * @example
  26466. *
  26467. * var users = [
  26468. * { 'user': 'barney', 'active': true },
  26469. * { 'user': 'fred', 'active': false },
  26470. * { 'user': 'pebbles', 'active': false }
  26471. * ];
  26472. *
  26473. * _.takeRightWhile(users, function(o) { return !o.active; });
  26474. * // => objects for ['fred', 'pebbles']
  26475. *
  26476. * // The `_.matches` iteratee shorthand.
  26477. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26478. * // => objects for ['pebbles']
  26479. *
  26480. * // The `_.matchesProperty` iteratee shorthand.
  26481. * _.takeRightWhile(users, ['active', false]);
  26482. * // => objects for ['fred', 'pebbles']
  26483. *
  26484. * // The `_.property` iteratee shorthand.
  26485. * _.takeRightWhile(users, 'active');
  26486. * // => []
  26487. */
  26488. function takeRightWhile(array, predicate) {
  26489. return (array && array.length)
  26490. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26491. : [];
  26492. }
  26493. /**
  26494. * Creates a slice of `array` with elements taken from the beginning. Elements
  26495. * are taken until `predicate` returns falsey. The predicate is invoked with
  26496. * three arguments: (value, index, array).
  26497. *
  26498. * @static
  26499. * @memberOf _
  26500. * @since 3.0.0
  26501. * @category Array
  26502. * @param {Array} array The array to query.
  26503. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26504. * @returns {Array} Returns the slice of `array`.
  26505. * @example
  26506. *
  26507. * var users = [
  26508. * { 'user': 'barney', 'active': false },
  26509. * { 'user': 'fred', 'active': false },
  26510. * { 'user': 'pebbles', 'active': true }
  26511. * ];
  26512. *
  26513. * _.takeWhile(users, function(o) { return !o.active; });
  26514. * // => objects for ['barney', 'fred']
  26515. *
  26516. * // The `_.matches` iteratee shorthand.
  26517. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26518. * // => objects for ['barney']
  26519. *
  26520. * // The `_.matchesProperty` iteratee shorthand.
  26521. * _.takeWhile(users, ['active', false]);
  26522. * // => objects for ['barney', 'fred']
  26523. *
  26524. * // The `_.property` iteratee shorthand.
  26525. * _.takeWhile(users, 'active');
  26526. * // => []
  26527. */
  26528. function takeWhile(array, predicate) {
  26529. return (array && array.length)
  26530. ? baseWhile(array, getIteratee(predicate, 3))
  26531. : [];
  26532. }
  26533. /**
  26534. * Creates an array of unique values, in order, from all given arrays using
  26535. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26536. * for equality comparisons.
  26537. *
  26538. * @static
  26539. * @memberOf _
  26540. * @since 0.1.0
  26541. * @category Array
  26542. * @param {...Array} [arrays] The arrays to inspect.
  26543. * @returns {Array} Returns the new array of combined values.
  26544. * @example
  26545. *
  26546. * _.union([2], [1, 2]);
  26547. * // => [2, 1]
  26548. */
  26549. var union = baseRest(function(arrays) {
  26550. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26551. });
  26552. /**
  26553. * This method is like `_.union` except that it accepts `iteratee` which is
  26554. * invoked for each element of each `arrays` to generate the criterion by
  26555. * which uniqueness is computed. Result values are chosen from the first
  26556. * array in which the value occurs. The iteratee is invoked with one argument:
  26557. * (value).
  26558. *
  26559. * @static
  26560. * @memberOf _
  26561. * @since 4.0.0
  26562. * @category Array
  26563. * @param {...Array} [arrays] The arrays to inspect.
  26564. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26565. * @returns {Array} Returns the new array of combined values.
  26566. * @example
  26567. *
  26568. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26569. * // => [2.1, 1.2]
  26570. *
  26571. * // The `_.property` iteratee shorthand.
  26572. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26573. * // => [{ 'x': 1 }, { 'x': 2 }]
  26574. */
  26575. var unionBy = baseRest(function(arrays) {
  26576. var iteratee = last(arrays);
  26577. if (isArrayLikeObject(iteratee)) {
  26578. iteratee = undefined;
  26579. }
  26580. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26581. });
  26582. /**
  26583. * This method is like `_.union` except that it accepts `comparator` which
  26584. * is invoked to compare elements of `arrays`. Result values are chosen from
  26585. * the first array in which the value occurs. The comparator is invoked
  26586. * with two arguments: (arrVal, othVal).
  26587. *
  26588. * @static
  26589. * @memberOf _
  26590. * @since 4.0.0
  26591. * @category Array
  26592. * @param {...Array} [arrays] The arrays to inspect.
  26593. * @param {Function} [comparator] The comparator invoked per element.
  26594. * @returns {Array} Returns the new array of combined values.
  26595. * @example
  26596. *
  26597. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26598. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26599. *
  26600. * _.unionWith(objects, others, _.isEqual);
  26601. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26602. */
  26603. var unionWith = baseRest(function(arrays) {
  26604. var comparator = last(arrays);
  26605. comparator = typeof comparator == 'function' ? comparator : undefined;
  26606. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26607. });
  26608. /**
  26609. * Creates a duplicate-free version of an array, using
  26610. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26611. * for equality comparisons, in which only the first occurrence of each element
  26612. * is kept. The order of result values is determined by the order they occur
  26613. * in the array.
  26614. *
  26615. * @static
  26616. * @memberOf _
  26617. * @since 0.1.0
  26618. * @category Array
  26619. * @param {Array} array The array to inspect.
  26620. * @returns {Array} Returns the new duplicate free array.
  26621. * @example
  26622. *
  26623. * _.uniq([2, 1, 2]);
  26624. * // => [2, 1]
  26625. */
  26626. function uniq(array) {
  26627. return (array && array.length) ? baseUniq(array) : [];
  26628. }
  26629. /**
  26630. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26631. * invoked for each element in `array` to generate the criterion by which
  26632. * uniqueness is computed. The order of result values is determined by the
  26633. * order they occur in the array. The iteratee is invoked with one argument:
  26634. * (value).
  26635. *
  26636. * @static
  26637. * @memberOf _
  26638. * @since 4.0.0
  26639. * @category Array
  26640. * @param {Array} array The array to inspect.
  26641. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26642. * @returns {Array} Returns the new duplicate free array.
  26643. * @example
  26644. *
  26645. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26646. * // => [2.1, 1.2]
  26647. *
  26648. * // The `_.property` iteratee shorthand.
  26649. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26650. * // => [{ 'x': 1 }, { 'x': 2 }]
  26651. */
  26652. function uniqBy(array, iteratee) {
  26653. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26654. }
  26655. /**
  26656. * This method is like `_.uniq` except that it accepts `comparator` which
  26657. * is invoked to compare elements of `array`. The order of result values is
  26658. * determined by the order they occur in the array.The comparator is invoked
  26659. * with two arguments: (arrVal, othVal).
  26660. *
  26661. * @static
  26662. * @memberOf _
  26663. * @since 4.0.0
  26664. * @category Array
  26665. * @param {Array} array The array to inspect.
  26666. * @param {Function} [comparator] The comparator invoked per element.
  26667. * @returns {Array} Returns the new duplicate free array.
  26668. * @example
  26669. *
  26670. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26671. *
  26672. * _.uniqWith(objects, _.isEqual);
  26673. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26674. */
  26675. function uniqWith(array, comparator) {
  26676. comparator = typeof comparator == 'function' ? comparator : undefined;
  26677. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26678. }
  26679. /**
  26680. * This method is like `_.zip` except that it accepts an array of grouped
  26681. * elements and creates an array regrouping the elements to their pre-zip
  26682. * configuration.
  26683. *
  26684. * @static
  26685. * @memberOf _
  26686. * @since 1.2.0
  26687. * @category Array
  26688. * @param {Array} array The array of grouped elements to process.
  26689. * @returns {Array} Returns the new array of regrouped elements.
  26690. * @example
  26691. *
  26692. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26693. * // => [['a', 1, true], ['b', 2, false]]
  26694. *
  26695. * _.unzip(zipped);
  26696. * // => [['a', 'b'], [1, 2], [true, false]]
  26697. */
  26698. function unzip(array) {
  26699. if (!(array && array.length)) {
  26700. return [];
  26701. }
  26702. var length = 0;
  26703. array = arrayFilter(array, function(group) {
  26704. if (isArrayLikeObject(group)) {
  26705. length = nativeMax(group.length, length);
  26706. return true;
  26707. }
  26708. });
  26709. return baseTimes(length, function(index) {
  26710. return arrayMap(array, baseProperty(index));
  26711. });
  26712. }
  26713. /**
  26714. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26715. * how regrouped values should be combined. The iteratee is invoked with the
  26716. * elements of each group: (...group).
  26717. *
  26718. * @static
  26719. * @memberOf _
  26720. * @since 3.8.0
  26721. * @category Array
  26722. * @param {Array} array The array of grouped elements to process.
  26723. * @param {Function} [iteratee=_.identity] The function to combine
  26724. * regrouped values.
  26725. * @returns {Array} Returns the new array of regrouped elements.
  26726. * @example
  26727. *
  26728. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26729. * // => [[1, 10, 100], [2, 20, 200]]
  26730. *
  26731. * _.unzipWith(zipped, _.add);
  26732. * // => [3, 30, 300]
  26733. */
  26734. function unzipWith(array, iteratee) {
  26735. if (!(array && array.length)) {
  26736. return [];
  26737. }
  26738. var result = unzip(array);
  26739. if (iteratee == null) {
  26740. return result;
  26741. }
  26742. return arrayMap(result, function(group) {
  26743. return apply(iteratee, undefined, group);
  26744. });
  26745. }
  26746. /**
  26747. * Creates an array excluding all given values using
  26748. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26749. * for equality comparisons.
  26750. *
  26751. * **Note:** Unlike `_.pull`, this method returns a new array.
  26752. *
  26753. * @static
  26754. * @memberOf _
  26755. * @since 0.1.0
  26756. * @category Array
  26757. * @param {Array} array The array to inspect.
  26758. * @param {...*} [values] The values to exclude.
  26759. * @returns {Array} Returns the new array of filtered values.
  26760. * @see _.difference, _.xor
  26761. * @example
  26762. *
  26763. * _.without([2, 1, 2, 3], 1, 2);
  26764. * // => [3]
  26765. */
  26766. var without = baseRest(function(array, values) {
  26767. return isArrayLikeObject(array)
  26768. ? baseDifference(array, values)
  26769. : [];
  26770. });
  26771. /**
  26772. * Creates an array of unique values that is the
  26773. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26774. * of the given arrays. The order of result values is determined by the order
  26775. * they occur in the arrays.
  26776. *
  26777. * @static
  26778. * @memberOf _
  26779. * @since 2.4.0
  26780. * @category Array
  26781. * @param {...Array} [arrays] The arrays to inspect.
  26782. * @returns {Array} Returns the new array of filtered values.
  26783. * @see _.difference, _.without
  26784. * @example
  26785. *
  26786. * _.xor([2, 1], [2, 3]);
  26787. * // => [1, 3]
  26788. */
  26789. var xor = baseRest(function(arrays) {
  26790. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26791. });
  26792. /**
  26793. * This method is like `_.xor` except that it accepts `iteratee` which is
  26794. * invoked for each element of each `arrays` to generate the criterion by
  26795. * which by which they're compared. The order of result values is determined
  26796. * by the order they occur in the arrays. The iteratee is invoked with one
  26797. * argument: (value).
  26798. *
  26799. * @static
  26800. * @memberOf _
  26801. * @since 4.0.0
  26802. * @category Array
  26803. * @param {...Array} [arrays] The arrays to inspect.
  26804. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26805. * @returns {Array} Returns the new array of filtered values.
  26806. * @example
  26807. *
  26808. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26809. * // => [1.2, 3.4]
  26810. *
  26811. * // The `_.property` iteratee shorthand.
  26812. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26813. * // => [{ 'x': 2 }]
  26814. */
  26815. var xorBy = baseRest(function(arrays) {
  26816. var iteratee = last(arrays);
  26817. if (isArrayLikeObject(iteratee)) {
  26818. iteratee = undefined;
  26819. }
  26820. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26821. });
  26822. /**
  26823. * This method is like `_.xor` except that it accepts `comparator` which is
  26824. * invoked to compare elements of `arrays`. The order of result values is
  26825. * determined by the order they occur in the arrays. The comparator is invoked
  26826. * with two arguments: (arrVal, othVal).
  26827. *
  26828. * @static
  26829. * @memberOf _
  26830. * @since 4.0.0
  26831. * @category Array
  26832. * @param {...Array} [arrays] The arrays to inspect.
  26833. * @param {Function} [comparator] The comparator invoked per element.
  26834. * @returns {Array} Returns the new array of filtered values.
  26835. * @example
  26836. *
  26837. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26838. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26839. *
  26840. * _.xorWith(objects, others, _.isEqual);
  26841. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26842. */
  26843. var xorWith = baseRest(function(arrays) {
  26844. var comparator = last(arrays);
  26845. comparator = typeof comparator == 'function' ? comparator : undefined;
  26846. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26847. });
  26848. /**
  26849. * Creates an array of grouped elements, the first of which contains the
  26850. * first elements of the given arrays, the second of which contains the
  26851. * second elements of the given arrays, and so on.
  26852. *
  26853. * @static
  26854. * @memberOf _
  26855. * @since 0.1.0
  26856. * @category Array
  26857. * @param {...Array} [arrays] The arrays to process.
  26858. * @returns {Array} Returns the new array of grouped elements.
  26859. * @example
  26860. *
  26861. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26862. * // => [['a', 1, true], ['b', 2, false]]
  26863. */
  26864. var zip = baseRest(unzip);
  26865. /**
  26866. * This method is like `_.fromPairs` except that it accepts two arrays,
  26867. * one of property identifiers and one of corresponding values.
  26868. *
  26869. * @static
  26870. * @memberOf _
  26871. * @since 0.4.0
  26872. * @category Array
  26873. * @param {Array} [props=[]] The property identifiers.
  26874. * @param {Array} [values=[]] The property values.
  26875. * @returns {Object} Returns the new object.
  26876. * @example
  26877. *
  26878. * _.zipObject(['a', 'b'], [1, 2]);
  26879. * // => { 'a': 1, 'b': 2 }
  26880. */
  26881. function zipObject(props, values) {
  26882. return baseZipObject(props || [], values || [], assignValue);
  26883. }
  26884. /**
  26885. * This method is like `_.zipObject` except that it supports property paths.
  26886. *
  26887. * @static
  26888. * @memberOf _
  26889. * @since 4.1.0
  26890. * @category Array
  26891. * @param {Array} [props=[]] The property identifiers.
  26892. * @param {Array} [values=[]] The property values.
  26893. * @returns {Object} Returns the new object.
  26894. * @example
  26895. *
  26896. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26897. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26898. */
  26899. function zipObjectDeep(props, values) {
  26900. return baseZipObject(props || [], values || [], baseSet);
  26901. }
  26902. /**
  26903. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26904. * how grouped values should be combined. The iteratee is invoked with the
  26905. * elements of each group: (...group).
  26906. *
  26907. * @static
  26908. * @memberOf _
  26909. * @since 3.8.0
  26910. * @category Array
  26911. * @param {...Array} [arrays] The arrays to process.
  26912. * @param {Function} [iteratee=_.identity] The function to combine
  26913. * grouped values.
  26914. * @returns {Array} Returns the new array of grouped elements.
  26915. * @example
  26916. *
  26917. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26918. * return a + b + c;
  26919. * });
  26920. * // => [111, 222]
  26921. */
  26922. var zipWith = baseRest(function(arrays) {
  26923. var length = arrays.length,
  26924. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26925. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26926. return unzipWith(arrays, iteratee);
  26927. });
  26928. /*------------------------------------------------------------------------*/
  26929. /**
  26930. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26931. * chain sequences enabled. The result of such sequences must be unwrapped
  26932. * with `_#value`.
  26933. *
  26934. * @static
  26935. * @memberOf _
  26936. * @since 1.3.0
  26937. * @category Seq
  26938. * @param {*} value The value to wrap.
  26939. * @returns {Object} Returns the new `lodash` wrapper instance.
  26940. * @example
  26941. *
  26942. * var users = [
  26943. * { 'user': 'barney', 'age': 36 },
  26944. * { 'user': 'fred', 'age': 40 },
  26945. * { 'user': 'pebbles', 'age': 1 }
  26946. * ];
  26947. *
  26948. * var youngest = _
  26949. * .chain(users)
  26950. * .sortBy('age')
  26951. * .map(function(o) {
  26952. * return o.user + ' is ' + o.age;
  26953. * })
  26954. * .head()
  26955. * .value();
  26956. * // => 'pebbles is 1'
  26957. */
  26958. function chain(value) {
  26959. var result = lodash(value);
  26960. result.__chain__ = true;
  26961. return result;
  26962. }
  26963. /**
  26964. * This method invokes `interceptor` and returns `value`. The interceptor
  26965. * is invoked with one argument; (value). The purpose of this method is to
  26966. * "tap into" a method chain sequence in order to modify intermediate results.
  26967. *
  26968. * @static
  26969. * @memberOf _
  26970. * @since 0.1.0
  26971. * @category Seq
  26972. * @param {*} value The value to provide to `interceptor`.
  26973. * @param {Function} interceptor The function to invoke.
  26974. * @returns {*} Returns `value`.
  26975. * @example
  26976. *
  26977. * _([1, 2, 3])
  26978. * .tap(function(array) {
  26979. * // Mutate input array.
  26980. * array.pop();
  26981. * })
  26982. * .reverse()
  26983. * .value();
  26984. * // => [2, 1]
  26985. */
  26986. function tap(value, interceptor) {
  26987. interceptor(value);
  26988. return value;
  26989. }
  26990. /**
  26991. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26992. * The purpose of this method is to "pass thru" values replacing intermediate
  26993. * results in a method chain sequence.
  26994. *
  26995. * @static
  26996. * @memberOf _
  26997. * @since 3.0.0
  26998. * @category Seq
  26999. * @param {*} value The value to provide to `interceptor`.
  27000. * @param {Function} interceptor The function to invoke.
  27001. * @returns {*} Returns the result of `interceptor`.
  27002. * @example
  27003. *
  27004. * _(' abc ')
  27005. * .chain()
  27006. * .trim()
  27007. * .thru(function(value) {
  27008. * return [value];
  27009. * })
  27010. * .value();
  27011. * // => ['abc']
  27012. */
  27013. function thru(value, interceptor) {
  27014. return interceptor(value);
  27015. }
  27016. /**
  27017. * This method is the wrapper version of `_.at`.
  27018. *
  27019. * @name at
  27020. * @memberOf _
  27021. * @since 1.0.0
  27022. * @category Seq
  27023. * @param {...(string|string[])} [paths] The property paths to pick.
  27024. * @returns {Object} Returns the new `lodash` wrapper instance.
  27025. * @example
  27026. *
  27027. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27028. *
  27029. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27030. * // => [3, 4]
  27031. */
  27032. var wrapperAt = flatRest(function(paths) {
  27033. var length = paths.length,
  27034. start = length ? paths[0] : 0,
  27035. value = this.__wrapped__,
  27036. interceptor = function(object) { return baseAt(object, paths); };
  27037. if (length > 1 || this.__actions__.length ||
  27038. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27039. return this.thru(interceptor);
  27040. }
  27041. value = value.slice(start, +start + (length ? 1 : 0));
  27042. value.__actions__.push({
  27043. 'func': thru,
  27044. 'args': [interceptor],
  27045. 'thisArg': undefined
  27046. });
  27047. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27048. if (length && !array.length) {
  27049. array.push(undefined);
  27050. }
  27051. return array;
  27052. });
  27053. });
  27054. /**
  27055. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27056. *
  27057. * @name chain
  27058. * @memberOf _
  27059. * @since 0.1.0
  27060. * @category Seq
  27061. * @returns {Object} Returns the new `lodash` wrapper instance.
  27062. * @example
  27063. *
  27064. * var users = [
  27065. * { 'user': 'barney', 'age': 36 },
  27066. * { 'user': 'fred', 'age': 40 }
  27067. * ];
  27068. *
  27069. * // A sequence without explicit chaining.
  27070. * _(users).head();
  27071. * // => { 'user': 'barney', 'age': 36 }
  27072. *
  27073. * // A sequence with explicit chaining.
  27074. * _(users)
  27075. * .chain()
  27076. * .head()
  27077. * .pick('user')
  27078. * .value();
  27079. * // => { 'user': 'barney' }
  27080. */
  27081. function wrapperChain() {
  27082. return chain(this);
  27083. }
  27084. /**
  27085. * Executes the chain sequence and returns the wrapped result.
  27086. *
  27087. * @name commit
  27088. * @memberOf _
  27089. * @since 3.2.0
  27090. * @category Seq
  27091. * @returns {Object} Returns the new `lodash` wrapper instance.
  27092. * @example
  27093. *
  27094. * var array = [1, 2];
  27095. * var wrapped = _(array).push(3);
  27096. *
  27097. * console.log(array);
  27098. * // => [1, 2]
  27099. *
  27100. * wrapped = wrapped.commit();
  27101. * console.log(array);
  27102. * // => [1, 2, 3]
  27103. *
  27104. * wrapped.last();
  27105. * // => 3
  27106. *
  27107. * console.log(array);
  27108. * // => [1, 2, 3]
  27109. */
  27110. function wrapperCommit() {
  27111. return new LodashWrapper(this.value(), this.__chain__);
  27112. }
  27113. /**
  27114. * Gets the next value on a wrapped object following the
  27115. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27116. *
  27117. * @name next
  27118. * @memberOf _
  27119. * @since 4.0.0
  27120. * @category Seq
  27121. * @returns {Object} Returns the next iterator value.
  27122. * @example
  27123. *
  27124. * var wrapped = _([1, 2]);
  27125. *
  27126. * wrapped.next();
  27127. * // => { 'done': false, 'value': 1 }
  27128. *
  27129. * wrapped.next();
  27130. * // => { 'done': false, 'value': 2 }
  27131. *
  27132. * wrapped.next();
  27133. * // => { 'done': true, 'value': undefined }
  27134. */
  27135. function wrapperNext() {
  27136. if (this.__values__ === undefined) {
  27137. this.__values__ = toArray(this.value());
  27138. }
  27139. var done = this.__index__ >= this.__values__.length,
  27140. value = done ? undefined : this.__values__[this.__index__++];
  27141. return { 'done': done, 'value': value };
  27142. }
  27143. /**
  27144. * Enables the wrapper to be iterable.
  27145. *
  27146. * @name Symbol.iterator
  27147. * @memberOf _
  27148. * @since 4.0.0
  27149. * @category Seq
  27150. * @returns {Object} Returns the wrapper object.
  27151. * @example
  27152. *
  27153. * var wrapped = _([1, 2]);
  27154. *
  27155. * wrapped[Symbol.iterator]() === wrapped;
  27156. * // => true
  27157. *
  27158. * Array.from(wrapped);
  27159. * // => [1, 2]
  27160. */
  27161. function wrapperToIterator() {
  27162. return this;
  27163. }
  27164. /**
  27165. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27166. *
  27167. * @name plant
  27168. * @memberOf _
  27169. * @since 3.2.0
  27170. * @category Seq
  27171. * @param {*} value The value to plant.
  27172. * @returns {Object} Returns the new `lodash` wrapper instance.
  27173. * @example
  27174. *
  27175. * function square(n) {
  27176. * return n * n;
  27177. * }
  27178. *
  27179. * var wrapped = _([1, 2]).map(square);
  27180. * var other = wrapped.plant([3, 4]);
  27181. *
  27182. * other.value();
  27183. * // => [9, 16]
  27184. *
  27185. * wrapped.value();
  27186. * // => [1, 4]
  27187. */
  27188. function wrapperPlant(value) {
  27189. var result,
  27190. parent = this;
  27191. while (parent instanceof baseLodash) {
  27192. var clone = wrapperClone(parent);
  27193. clone.__index__ = 0;
  27194. clone.__values__ = undefined;
  27195. if (result) {
  27196. previous.__wrapped__ = clone;
  27197. } else {
  27198. result = clone;
  27199. }
  27200. var previous = clone;
  27201. parent = parent.__wrapped__;
  27202. }
  27203. previous.__wrapped__ = value;
  27204. return result;
  27205. }
  27206. /**
  27207. * This method is the wrapper version of `_.reverse`.
  27208. *
  27209. * **Note:** This method mutates the wrapped array.
  27210. *
  27211. * @name reverse
  27212. * @memberOf _
  27213. * @since 0.1.0
  27214. * @category Seq
  27215. * @returns {Object} Returns the new `lodash` wrapper instance.
  27216. * @example
  27217. *
  27218. * var array = [1, 2, 3];
  27219. *
  27220. * _(array).reverse().value()
  27221. * // => [3, 2, 1]
  27222. *
  27223. * console.log(array);
  27224. * // => [3, 2, 1]
  27225. */
  27226. function wrapperReverse() {
  27227. var value = this.__wrapped__;
  27228. if (value instanceof LazyWrapper) {
  27229. var wrapped = value;
  27230. if (this.__actions__.length) {
  27231. wrapped = new LazyWrapper(this);
  27232. }
  27233. wrapped = wrapped.reverse();
  27234. wrapped.__actions__.push({
  27235. 'func': thru,
  27236. 'args': [reverse],
  27237. 'thisArg': undefined
  27238. });
  27239. return new LodashWrapper(wrapped, this.__chain__);
  27240. }
  27241. return this.thru(reverse);
  27242. }
  27243. /**
  27244. * Executes the chain sequence to resolve the unwrapped value.
  27245. *
  27246. * @name value
  27247. * @memberOf _
  27248. * @since 0.1.0
  27249. * @alias toJSON, valueOf
  27250. * @category Seq
  27251. * @returns {*} Returns the resolved unwrapped value.
  27252. * @example
  27253. *
  27254. * _([1, 2, 3]).value();
  27255. * // => [1, 2, 3]
  27256. */
  27257. function wrapperValue() {
  27258. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27259. }
  27260. /*------------------------------------------------------------------------*/
  27261. /**
  27262. * Creates an object composed of keys generated from the results of running
  27263. * each element of `collection` thru `iteratee`. The corresponding value of
  27264. * each key is the number of times the key was returned by `iteratee`. The
  27265. * iteratee is invoked with one argument: (value).
  27266. *
  27267. * @static
  27268. * @memberOf _
  27269. * @since 0.5.0
  27270. * @category Collection
  27271. * @param {Array|Object} collection The collection to iterate over.
  27272. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27273. * @returns {Object} Returns the composed aggregate object.
  27274. * @example
  27275. *
  27276. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27277. * // => { '4': 1, '6': 2 }
  27278. *
  27279. * // The `_.property` iteratee shorthand.
  27280. * _.countBy(['one', 'two', 'three'], 'length');
  27281. * // => { '3': 2, '5': 1 }
  27282. */
  27283. var countBy = createAggregator(function(result, value, key) {
  27284. if (hasOwnProperty.call(result, key)) {
  27285. ++result[key];
  27286. } else {
  27287. baseAssignValue(result, key, 1);
  27288. }
  27289. });
  27290. /**
  27291. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27292. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27293. * invoked with three arguments: (value, index|key, collection).
  27294. *
  27295. * **Note:** This method returns `true` for
  27296. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27297. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27298. * elements of empty collections.
  27299. *
  27300. * @static
  27301. * @memberOf _
  27302. * @since 0.1.0
  27303. * @category Collection
  27304. * @param {Array|Object} collection The collection to iterate over.
  27305. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27306. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27307. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27308. * else `false`.
  27309. * @example
  27310. *
  27311. * _.every([true, 1, null, 'yes'], Boolean);
  27312. * // => false
  27313. *
  27314. * var users = [
  27315. * { 'user': 'barney', 'age': 36, 'active': false },
  27316. * { 'user': 'fred', 'age': 40, 'active': false }
  27317. * ];
  27318. *
  27319. * // The `_.matches` iteratee shorthand.
  27320. * _.every(users, { 'user': 'barney', 'active': false });
  27321. * // => false
  27322. *
  27323. * // The `_.matchesProperty` iteratee shorthand.
  27324. * _.every(users, ['active', false]);
  27325. * // => true
  27326. *
  27327. * // The `_.property` iteratee shorthand.
  27328. * _.every(users, 'active');
  27329. * // => false
  27330. */
  27331. function every(collection, predicate, guard) {
  27332. var func = isArray(collection) ? arrayEvery : baseEvery;
  27333. if (guard && isIterateeCall(collection, predicate, guard)) {
  27334. predicate = undefined;
  27335. }
  27336. return func(collection, getIteratee(predicate, 3));
  27337. }
  27338. /**
  27339. * Iterates over elements of `collection`, returning an array of all elements
  27340. * `predicate` returns truthy for. The predicate is invoked with three
  27341. * arguments: (value, index|key, collection).
  27342. *
  27343. * **Note:** Unlike `_.remove`, this method returns a new array.
  27344. *
  27345. * @static
  27346. * @memberOf _
  27347. * @since 0.1.0
  27348. * @category Collection
  27349. * @param {Array|Object} collection The collection to iterate over.
  27350. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27351. * @returns {Array} Returns the new filtered array.
  27352. * @see _.reject
  27353. * @example
  27354. *
  27355. * var users = [
  27356. * { 'user': 'barney', 'age': 36, 'active': true },
  27357. * { 'user': 'fred', 'age': 40, 'active': false }
  27358. * ];
  27359. *
  27360. * _.filter(users, function(o) { return !o.active; });
  27361. * // => objects for ['fred']
  27362. *
  27363. * // The `_.matches` iteratee shorthand.
  27364. * _.filter(users, { 'age': 36, 'active': true });
  27365. * // => objects for ['barney']
  27366. *
  27367. * // The `_.matchesProperty` iteratee shorthand.
  27368. * _.filter(users, ['active', false]);
  27369. * // => objects for ['fred']
  27370. *
  27371. * // The `_.property` iteratee shorthand.
  27372. * _.filter(users, 'active');
  27373. * // => objects for ['barney']
  27374. */
  27375. function filter(collection, predicate) {
  27376. var func = isArray(collection) ? arrayFilter : baseFilter;
  27377. return func(collection, getIteratee(predicate, 3));
  27378. }
  27379. /**
  27380. * Iterates over elements of `collection`, returning the first element
  27381. * `predicate` returns truthy for. The predicate is invoked with three
  27382. * arguments: (value, index|key, collection).
  27383. *
  27384. * @static
  27385. * @memberOf _
  27386. * @since 0.1.0
  27387. * @category Collection
  27388. * @param {Array|Object} collection The collection to inspect.
  27389. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27390. * @param {number} [fromIndex=0] The index to search from.
  27391. * @returns {*} Returns the matched element, else `undefined`.
  27392. * @example
  27393. *
  27394. * var users = [
  27395. * { 'user': 'barney', 'age': 36, 'active': true },
  27396. * { 'user': 'fred', 'age': 40, 'active': false },
  27397. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27398. * ];
  27399. *
  27400. * _.find(users, function(o) { return o.age < 40; });
  27401. * // => object for 'barney'
  27402. *
  27403. * // The `_.matches` iteratee shorthand.
  27404. * _.find(users, { 'age': 1, 'active': true });
  27405. * // => object for 'pebbles'
  27406. *
  27407. * // The `_.matchesProperty` iteratee shorthand.
  27408. * _.find(users, ['active', false]);
  27409. * // => object for 'fred'
  27410. *
  27411. * // The `_.property` iteratee shorthand.
  27412. * _.find(users, 'active');
  27413. * // => object for 'barney'
  27414. */
  27415. var find = createFind(findIndex);
  27416. /**
  27417. * This method is like `_.find` except that it iterates over elements of
  27418. * `collection` from right to left.
  27419. *
  27420. * @static
  27421. * @memberOf _
  27422. * @since 2.0.0
  27423. * @category Collection
  27424. * @param {Array|Object} collection The collection to inspect.
  27425. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27426. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27427. * @returns {*} Returns the matched element, else `undefined`.
  27428. * @example
  27429. *
  27430. * _.findLast([1, 2, 3, 4], function(n) {
  27431. * return n % 2 == 1;
  27432. * });
  27433. * // => 3
  27434. */
  27435. var findLast = createFind(findLastIndex);
  27436. /**
  27437. * Creates a flattened array of values by running each element in `collection`
  27438. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27439. * with three arguments: (value, index|key, collection).
  27440. *
  27441. * @static
  27442. * @memberOf _
  27443. * @since 4.0.0
  27444. * @category Collection
  27445. * @param {Array|Object} collection The collection to iterate over.
  27446. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27447. * @returns {Array} Returns the new flattened array.
  27448. * @example
  27449. *
  27450. * function duplicate(n) {
  27451. * return [n, n];
  27452. * }
  27453. *
  27454. * _.flatMap([1, 2], duplicate);
  27455. * // => [1, 1, 2, 2]
  27456. */
  27457. function flatMap(collection, iteratee) {
  27458. return baseFlatten(map(collection, iteratee), 1);
  27459. }
  27460. /**
  27461. * This method is like `_.flatMap` except that it recursively flattens the
  27462. * mapped results.
  27463. *
  27464. * @static
  27465. * @memberOf _
  27466. * @since 4.7.0
  27467. * @category Collection
  27468. * @param {Array|Object} collection The collection to iterate over.
  27469. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27470. * @returns {Array} Returns the new flattened array.
  27471. * @example
  27472. *
  27473. * function duplicate(n) {
  27474. * return [[[n, n]]];
  27475. * }
  27476. *
  27477. * _.flatMapDeep([1, 2], duplicate);
  27478. * // => [1, 1, 2, 2]
  27479. */
  27480. function flatMapDeep(collection, iteratee) {
  27481. return baseFlatten(map(collection, iteratee), INFINITY);
  27482. }
  27483. /**
  27484. * This method is like `_.flatMap` except that it recursively flattens the
  27485. * mapped results up to `depth` times.
  27486. *
  27487. * @static
  27488. * @memberOf _
  27489. * @since 4.7.0
  27490. * @category Collection
  27491. * @param {Array|Object} collection The collection to iterate over.
  27492. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27493. * @param {number} [depth=1] The maximum recursion depth.
  27494. * @returns {Array} Returns the new flattened array.
  27495. * @example
  27496. *
  27497. * function duplicate(n) {
  27498. * return [[[n, n]]];
  27499. * }
  27500. *
  27501. * _.flatMapDepth([1, 2], duplicate, 2);
  27502. * // => [[1, 1], [2, 2]]
  27503. */
  27504. function flatMapDepth(collection, iteratee, depth) {
  27505. depth = depth === undefined ? 1 : toInteger(depth);
  27506. return baseFlatten(map(collection, iteratee), depth);
  27507. }
  27508. /**
  27509. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27510. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27511. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27512. *
  27513. * **Note:** As with other "Collections" methods, objects with a "length"
  27514. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27515. * or `_.forOwn` for object iteration.
  27516. *
  27517. * @static
  27518. * @memberOf _
  27519. * @since 0.1.0
  27520. * @alias each
  27521. * @category Collection
  27522. * @param {Array|Object} collection The collection to iterate over.
  27523. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27524. * @returns {Array|Object} Returns `collection`.
  27525. * @see _.forEachRight
  27526. * @example
  27527. *
  27528. * _.forEach([1, 2], function(value) {
  27529. * console.log(value);
  27530. * });
  27531. * // => Logs `1` then `2`.
  27532. *
  27533. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27534. * console.log(key);
  27535. * });
  27536. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27537. */
  27538. function forEach(collection, iteratee) {
  27539. var func = isArray(collection) ? arrayEach : baseEach;
  27540. return func(collection, getIteratee(iteratee, 3));
  27541. }
  27542. /**
  27543. * This method is like `_.forEach` except that it iterates over elements of
  27544. * `collection` from right to left.
  27545. *
  27546. * @static
  27547. * @memberOf _
  27548. * @since 2.0.0
  27549. * @alias eachRight
  27550. * @category Collection
  27551. * @param {Array|Object} collection The collection to iterate over.
  27552. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27553. * @returns {Array|Object} Returns `collection`.
  27554. * @see _.forEach
  27555. * @example
  27556. *
  27557. * _.forEachRight([1, 2], function(value) {
  27558. * console.log(value);
  27559. * });
  27560. * // => Logs `2` then `1`.
  27561. */
  27562. function forEachRight(collection, iteratee) {
  27563. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27564. return func(collection, getIteratee(iteratee, 3));
  27565. }
  27566. /**
  27567. * Creates an object composed of keys generated from the results of running
  27568. * each element of `collection` thru `iteratee`. The order of grouped values
  27569. * is determined by the order they occur in `collection`. The corresponding
  27570. * value of each key is an array of elements responsible for generating the
  27571. * key. The iteratee is invoked with one argument: (value).
  27572. *
  27573. * @static
  27574. * @memberOf _
  27575. * @since 0.1.0
  27576. * @category Collection
  27577. * @param {Array|Object} collection The collection to iterate over.
  27578. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27579. * @returns {Object} Returns the composed aggregate object.
  27580. * @example
  27581. *
  27582. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27583. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27584. *
  27585. * // The `_.property` iteratee shorthand.
  27586. * _.groupBy(['one', 'two', 'three'], 'length');
  27587. * // => { '3': ['one', 'two'], '5': ['three'] }
  27588. */
  27589. var groupBy = createAggregator(function(result, value, key) {
  27590. if (hasOwnProperty.call(result, key)) {
  27591. result[key].push(value);
  27592. } else {
  27593. baseAssignValue(result, key, [value]);
  27594. }
  27595. });
  27596. /**
  27597. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27598. * checked for a substring of `value`, otherwise
  27599. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27600. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27601. * the offset from the end of `collection`.
  27602. *
  27603. * @static
  27604. * @memberOf _
  27605. * @since 0.1.0
  27606. * @category Collection
  27607. * @param {Array|Object|string} collection The collection to inspect.
  27608. * @param {*} value The value to search for.
  27609. * @param {number} [fromIndex=0] The index to search from.
  27610. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27611. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27612. * @example
  27613. *
  27614. * _.includes([1, 2, 3], 1);
  27615. * // => true
  27616. *
  27617. * _.includes([1, 2, 3], 1, 2);
  27618. * // => false
  27619. *
  27620. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27621. * // => true
  27622. *
  27623. * _.includes('abcd', 'bc');
  27624. * // => true
  27625. */
  27626. function includes(collection, value, fromIndex, guard) {
  27627. collection = isArrayLike(collection) ? collection : values(collection);
  27628. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27629. var length = collection.length;
  27630. if (fromIndex < 0) {
  27631. fromIndex = nativeMax(length + fromIndex, 0);
  27632. }
  27633. return isString(collection)
  27634. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27635. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27636. }
  27637. /**
  27638. * Invokes the method at `path` of each element in `collection`, returning
  27639. * an array of the results of each invoked method. Any additional arguments
  27640. * are provided to each invoked method. If `path` is a function, it's invoked
  27641. * for, and `this` bound to, each element in `collection`.
  27642. *
  27643. * @static
  27644. * @memberOf _
  27645. * @since 4.0.0
  27646. * @category Collection
  27647. * @param {Array|Object} collection The collection to iterate over.
  27648. * @param {Array|Function|string} path The path of the method to invoke or
  27649. * the function invoked per iteration.
  27650. * @param {...*} [args] The arguments to invoke each method with.
  27651. * @returns {Array} Returns the array of results.
  27652. * @example
  27653. *
  27654. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27655. * // => [[1, 5, 7], [1, 2, 3]]
  27656. *
  27657. * _.invokeMap([123, 456], String.prototype.split, '');
  27658. * // => [['1', '2', '3'], ['4', '5', '6']]
  27659. */
  27660. var invokeMap = baseRest(function(collection, path, args) {
  27661. var index = -1,
  27662. isFunc = typeof path == 'function',
  27663. result = isArrayLike(collection) ? Array(collection.length) : [];
  27664. baseEach(collection, function(value) {
  27665. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27666. });
  27667. return result;
  27668. });
  27669. /**
  27670. * Creates an object composed of keys generated from the results of running
  27671. * each element of `collection` thru `iteratee`. The corresponding value of
  27672. * each key is the last element responsible for generating the key. The
  27673. * iteratee is invoked with one argument: (value).
  27674. *
  27675. * @static
  27676. * @memberOf _
  27677. * @since 4.0.0
  27678. * @category Collection
  27679. * @param {Array|Object} collection The collection to iterate over.
  27680. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27681. * @returns {Object} Returns the composed aggregate object.
  27682. * @example
  27683. *
  27684. * var array = [
  27685. * { 'dir': 'left', 'code': 97 },
  27686. * { 'dir': 'right', 'code': 100 }
  27687. * ];
  27688. *
  27689. * _.keyBy(array, function(o) {
  27690. * return String.fromCharCode(o.code);
  27691. * });
  27692. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27693. *
  27694. * _.keyBy(array, 'dir');
  27695. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27696. */
  27697. var keyBy = createAggregator(function(result, value, key) {
  27698. baseAssignValue(result, key, value);
  27699. });
  27700. /**
  27701. * Creates an array of values by running each element in `collection` thru
  27702. * `iteratee`. The iteratee is invoked with three arguments:
  27703. * (value, index|key, collection).
  27704. *
  27705. * Many lodash methods are guarded to work as iteratees for methods like
  27706. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27707. *
  27708. * The guarded methods are:
  27709. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27710. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27711. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27712. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27713. *
  27714. * @static
  27715. * @memberOf _
  27716. * @since 0.1.0
  27717. * @category Collection
  27718. * @param {Array|Object} collection The collection to iterate over.
  27719. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27720. * @returns {Array} Returns the new mapped array.
  27721. * @example
  27722. *
  27723. * function square(n) {
  27724. * return n * n;
  27725. * }
  27726. *
  27727. * _.map([4, 8], square);
  27728. * // => [16, 64]
  27729. *
  27730. * _.map({ 'a': 4, 'b': 8 }, square);
  27731. * // => [16, 64] (iteration order is not guaranteed)
  27732. *
  27733. * var users = [
  27734. * { 'user': 'barney' },
  27735. * { 'user': 'fred' }
  27736. * ];
  27737. *
  27738. * // The `_.property` iteratee shorthand.
  27739. * _.map(users, 'user');
  27740. * // => ['barney', 'fred']
  27741. */
  27742. function map(collection, iteratee) {
  27743. var func = isArray(collection) ? arrayMap : baseMap;
  27744. return func(collection, getIteratee(iteratee, 3));
  27745. }
  27746. /**
  27747. * This method is like `_.sortBy` except that it allows specifying the sort
  27748. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27749. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27750. * descending or "asc" for ascending sort order of corresponding values.
  27751. *
  27752. * @static
  27753. * @memberOf _
  27754. * @since 4.0.0
  27755. * @category Collection
  27756. * @param {Array|Object} collection The collection to iterate over.
  27757. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27758. * The iteratees to sort by.
  27759. * @param {string[]} [orders] The sort orders of `iteratees`.
  27760. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27761. * @returns {Array} Returns the new sorted array.
  27762. * @example
  27763. *
  27764. * var users = [
  27765. * { 'user': 'fred', 'age': 48 },
  27766. * { 'user': 'barney', 'age': 34 },
  27767. * { 'user': 'fred', 'age': 40 },
  27768. * { 'user': 'barney', 'age': 36 }
  27769. * ];
  27770. *
  27771. * // Sort by `user` in ascending order and by `age` in descending order.
  27772. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27773. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27774. */
  27775. function orderBy(collection, iteratees, orders, guard) {
  27776. if (collection == null) {
  27777. return [];
  27778. }
  27779. if (!isArray(iteratees)) {
  27780. iteratees = iteratees == null ? [] : [iteratees];
  27781. }
  27782. orders = guard ? undefined : orders;
  27783. if (!isArray(orders)) {
  27784. orders = orders == null ? [] : [orders];
  27785. }
  27786. return baseOrderBy(collection, iteratees, orders);
  27787. }
  27788. /**
  27789. * Creates an array of elements split into two groups, the first of which
  27790. * contains elements `predicate` returns truthy for, the second of which
  27791. * contains elements `predicate` returns falsey for. The predicate is
  27792. * invoked with one argument: (value).
  27793. *
  27794. * @static
  27795. * @memberOf _
  27796. * @since 3.0.0
  27797. * @category Collection
  27798. * @param {Array|Object} collection The collection to iterate over.
  27799. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27800. * @returns {Array} Returns the array of grouped elements.
  27801. * @example
  27802. *
  27803. * var users = [
  27804. * { 'user': 'barney', 'age': 36, 'active': false },
  27805. * { 'user': 'fred', 'age': 40, 'active': true },
  27806. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27807. * ];
  27808. *
  27809. * _.partition(users, function(o) { return o.active; });
  27810. * // => objects for [['fred'], ['barney', 'pebbles']]
  27811. *
  27812. * // The `_.matches` iteratee shorthand.
  27813. * _.partition(users, { 'age': 1, 'active': false });
  27814. * // => objects for [['pebbles'], ['barney', 'fred']]
  27815. *
  27816. * // The `_.matchesProperty` iteratee shorthand.
  27817. * _.partition(users, ['active', false]);
  27818. * // => objects for [['barney', 'pebbles'], ['fred']]
  27819. *
  27820. * // The `_.property` iteratee shorthand.
  27821. * _.partition(users, 'active');
  27822. * // => objects for [['fred'], ['barney', 'pebbles']]
  27823. */
  27824. var partition = createAggregator(function(result, value, key) {
  27825. result[key ? 0 : 1].push(value);
  27826. }, function() { return [[], []]; });
  27827. /**
  27828. * Reduces `collection` to a value which is the accumulated result of running
  27829. * each element in `collection` thru `iteratee`, where each successive
  27830. * invocation is supplied the return value of the previous. If `accumulator`
  27831. * is not given, the first element of `collection` is used as the initial
  27832. * value. The iteratee is invoked with four arguments:
  27833. * (accumulator, value, index|key, collection).
  27834. *
  27835. * Many lodash methods are guarded to work as iteratees for methods like
  27836. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27837. *
  27838. * The guarded methods are:
  27839. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27840. * and `sortBy`
  27841. *
  27842. * @static
  27843. * @memberOf _
  27844. * @since 0.1.0
  27845. * @category Collection
  27846. * @param {Array|Object} collection The collection to iterate over.
  27847. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27848. * @param {*} [accumulator] The initial value.
  27849. * @returns {*} Returns the accumulated value.
  27850. * @see _.reduceRight
  27851. * @example
  27852. *
  27853. * _.reduce([1, 2], function(sum, n) {
  27854. * return sum + n;
  27855. * }, 0);
  27856. * // => 3
  27857. *
  27858. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27859. * (result[value] || (result[value] = [])).push(key);
  27860. * return result;
  27861. * }, {});
  27862. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27863. */
  27864. function reduce(collection, iteratee, accumulator) {
  27865. var func = isArray(collection) ? arrayReduce : baseReduce,
  27866. initAccum = arguments.length < 3;
  27867. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27868. }
  27869. /**
  27870. * This method is like `_.reduce` except that it iterates over elements of
  27871. * `collection` from right to left.
  27872. *
  27873. * @static
  27874. * @memberOf _
  27875. * @since 0.1.0
  27876. * @category Collection
  27877. * @param {Array|Object} collection The collection to iterate over.
  27878. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27879. * @param {*} [accumulator] The initial value.
  27880. * @returns {*} Returns the accumulated value.
  27881. * @see _.reduce
  27882. * @example
  27883. *
  27884. * var array = [[0, 1], [2, 3], [4, 5]];
  27885. *
  27886. * _.reduceRight(array, function(flattened, other) {
  27887. * return flattened.concat(other);
  27888. * }, []);
  27889. * // => [4, 5, 2, 3, 0, 1]
  27890. */
  27891. function reduceRight(collection, iteratee, accumulator) {
  27892. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27893. initAccum = arguments.length < 3;
  27894. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27895. }
  27896. /**
  27897. * The opposite of `_.filter`; this method returns the elements of `collection`
  27898. * that `predicate` does **not** return truthy for.
  27899. *
  27900. * @static
  27901. * @memberOf _
  27902. * @since 0.1.0
  27903. * @category Collection
  27904. * @param {Array|Object} collection The collection to iterate over.
  27905. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27906. * @returns {Array} Returns the new filtered array.
  27907. * @see _.filter
  27908. * @example
  27909. *
  27910. * var users = [
  27911. * { 'user': 'barney', 'age': 36, 'active': false },
  27912. * { 'user': 'fred', 'age': 40, 'active': true }
  27913. * ];
  27914. *
  27915. * _.reject(users, function(o) { return !o.active; });
  27916. * // => objects for ['fred']
  27917. *
  27918. * // The `_.matches` iteratee shorthand.
  27919. * _.reject(users, { 'age': 40, 'active': true });
  27920. * // => objects for ['barney']
  27921. *
  27922. * // The `_.matchesProperty` iteratee shorthand.
  27923. * _.reject(users, ['active', false]);
  27924. * // => objects for ['fred']
  27925. *
  27926. * // The `_.property` iteratee shorthand.
  27927. * _.reject(users, 'active');
  27928. * // => objects for ['barney']
  27929. */
  27930. function reject(collection, predicate) {
  27931. var func = isArray(collection) ? arrayFilter : baseFilter;
  27932. return func(collection, negate(getIteratee(predicate, 3)));
  27933. }
  27934. /**
  27935. * Gets a random element from `collection`.
  27936. *
  27937. * @static
  27938. * @memberOf _
  27939. * @since 2.0.0
  27940. * @category Collection
  27941. * @param {Array|Object} collection The collection to sample.
  27942. * @returns {*} Returns the random element.
  27943. * @example
  27944. *
  27945. * _.sample([1, 2, 3, 4]);
  27946. * // => 2
  27947. */
  27948. function sample(collection) {
  27949. var func = isArray(collection) ? arraySample : baseSample;
  27950. return func(collection);
  27951. }
  27952. /**
  27953. * Gets `n` random elements at unique keys from `collection` up to the
  27954. * size of `collection`.
  27955. *
  27956. * @static
  27957. * @memberOf _
  27958. * @since 4.0.0
  27959. * @category Collection
  27960. * @param {Array|Object} collection The collection to sample.
  27961. * @param {number} [n=1] The number of elements to sample.
  27962. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27963. * @returns {Array} Returns the random elements.
  27964. * @example
  27965. *
  27966. * _.sampleSize([1, 2, 3], 2);
  27967. * // => [3, 1]
  27968. *
  27969. * _.sampleSize([1, 2, 3], 4);
  27970. * // => [2, 3, 1]
  27971. */
  27972. function sampleSize(collection, n, guard) {
  27973. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27974. n = 1;
  27975. } else {
  27976. n = toInteger(n);
  27977. }
  27978. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27979. return func(collection, n);
  27980. }
  27981. /**
  27982. * Creates an array of shuffled values, using a version of the
  27983. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27984. *
  27985. * @static
  27986. * @memberOf _
  27987. * @since 0.1.0
  27988. * @category Collection
  27989. * @param {Array|Object} collection The collection to shuffle.
  27990. * @returns {Array} Returns the new shuffled array.
  27991. * @example
  27992. *
  27993. * _.shuffle([1, 2, 3, 4]);
  27994. * // => [4, 1, 3, 2]
  27995. */
  27996. function shuffle(collection) {
  27997. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27998. return func(collection);
  27999. }
  28000. /**
  28001. * Gets the size of `collection` by returning its length for array-like
  28002. * values or the number of own enumerable string keyed properties for objects.
  28003. *
  28004. * @static
  28005. * @memberOf _
  28006. * @since 0.1.0
  28007. * @category Collection
  28008. * @param {Array|Object|string} collection The collection to inspect.
  28009. * @returns {number} Returns the collection size.
  28010. * @example
  28011. *
  28012. * _.size([1, 2, 3]);
  28013. * // => 3
  28014. *
  28015. * _.size({ 'a': 1, 'b': 2 });
  28016. * // => 2
  28017. *
  28018. * _.size('pebbles');
  28019. * // => 7
  28020. */
  28021. function size(collection) {
  28022. if (collection == null) {
  28023. return 0;
  28024. }
  28025. if (isArrayLike(collection)) {
  28026. return isString(collection) ? stringSize(collection) : collection.length;
  28027. }
  28028. var tag = getTag(collection);
  28029. if (tag == mapTag || tag == setTag) {
  28030. return collection.size;
  28031. }
  28032. return baseKeys(collection).length;
  28033. }
  28034. /**
  28035. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28036. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28037. * invoked with three arguments: (value, index|key, collection).
  28038. *
  28039. * @static
  28040. * @memberOf _
  28041. * @since 0.1.0
  28042. * @category Collection
  28043. * @param {Array|Object} collection The collection to iterate over.
  28044. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28045. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28046. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28047. * else `false`.
  28048. * @example
  28049. *
  28050. * _.some([null, 0, 'yes', false], Boolean);
  28051. * // => true
  28052. *
  28053. * var users = [
  28054. * { 'user': 'barney', 'active': true },
  28055. * { 'user': 'fred', 'active': false }
  28056. * ];
  28057. *
  28058. * // The `_.matches` iteratee shorthand.
  28059. * _.some(users, { 'user': 'barney', 'active': false });
  28060. * // => false
  28061. *
  28062. * // The `_.matchesProperty` iteratee shorthand.
  28063. * _.some(users, ['active', false]);
  28064. * // => true
  28065. *
  28066. * // The `_.property` iteratee shorthand.
  28067. * _.some(users, 'active');
  28068. * // => true
  28069. */
  28070. function some(collection, predicate, guard) {
  28071. var func = isArray(collection) ? arraySome : baseSome;
  28072. if (guard && isIterateeCall(collection, predicate, guard)) {
  28073. predicate = undefined;
  28074. }
  28075. return func(collection, getIteratee(predicate, 3));
  28076. }
  28077. /**
  28078. * Creates an array of elements, sorted in ascending order by the results of
  28079. * running each element in a collection thru each iteratee. This method
  28080. * performs a stable sort, that is, it preserves the original sort order of
  28081. * equal elements. The iteratees are invoked with one argument: (value).
  28082. *
  28083. * @static
  28084. * @memberOf _
  28085. * @since 0.1.0
  28086. * @category Collection
  28087. * @param {Array|Object} collection The collection to iterate over.
  28088. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28089. * The iteratees to sort by.
  28090. * @returns {Array} Returns the new sorted array.
  28091. * @example
  28092. *
  28093. * var users = [
  28094. * { 'user': 'fred', 'age': 48 },
  28095. * { 'user': 'barney', 'age': 36 },
  28096. * { 'user': 'fred', 'age': 40 },
  28097. * { 'user': 'barney', 'age': 34 }
  28098. * ];
  28099. *
  28100. * _.sortBy(users, [function(o) { return o.user; }]);
  28101. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28102. *
  28103. * _.sortBy(users, ['user', 'age']);
  28104. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28105. */
  28106. var sortBy = baseRest(function(collection, iteratees) {
  28107. if (collection == null) {
  28108. return [];
  28109. }
  28110. var length = iteratees.length;
  28111. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28112. iteratees = [];
  28113. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28114. iteratees = [iteratees[0]];
  28115. }
  28116. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28117. });
  28118. /*------------------------------------------------------------------------*/
  28119. /**
  28120. * Gets the timestamp of the number of milliseconds that have elapsed since
  28121. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28122. *
  28123. * @static
  28124. * @memberOf _
  28125. * @since 2.4.0
  28126. * @category Date
  28127. * @returns {number} Returns the timestamp.
  28128. * @example
  28129. *
  28130. * _.defer(function(stamp) {
  28131. * console.log(_.now() - stamp);
  28132. * }, _.now());
  28133. * // => Logs the number of milliseconds it took for the deferred invocation.
  28134. */
  28135. var now = ctxNow || function() {
  28136. return root.Date.now();
  28137. };
  28138. /*------------------------------------------------------------------------*/
  28139. /**
  28140. * The opposite of `_.before`; this method creates a function that invokes
  28141. * `func` once it's called `n` or more times.
  28142. *
  28143. * @static
  28144. * @memberOf _
  28145. * @since 0.1.0
  28146. * @category Function
  28147. * @param {number} n The number of calls before `func` is invoked.
  28148. * @param {Function} func The function to restrict.
  28149. * @returns {Function} Returns the new restricted function.
  28150. * @example
  28151. *
  28152. * var saves = ['profile', 'settings'];
  28153. *
  28154. * var done = _.after(saves.length, function() {
  28155. * console.log('done saving!');
  28156. * });
  28157. *
  28158. * _.forEach(saves, function(type) {
  28159. * asyncSave({ 'type': type, 'complete': done });
  28160. * });
  28161. * // => Logs 'done saving!' after the two async saves have completed.
  28162. */
  28163. function after(n, func) {
  28164. if (typeof func != 'function') {
  28165. throw new TypeError(FUNC_ERROR_TEXT);
  28166. }
  28167. n = toInteger(n);
  28168. return function() {
  28169. if (--n < 1) {
  28170. return func.apply(this, arguments);
  28171. }
  28172. };
  28173. }
  28174. /**
  28175. * Creates a function that invokes `func`, with up to `n` arguments,
  28176. * ignoring any additional arguments.
  28177. *
  28178. * @static
  28179. * @memberOf _
  28180. * @since 3.0.0
  28181. * @category Function
  28182. * @param {Function} func The function to cap arguments for.
  28183. * @param {number} [n=func.length] The arity cap.
  28184. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28185. * @returns {Function} Returns the new capped function.
  28186. * @example
  28187. *
  28188. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28189. * // => [6, 8, 10]
  28190. */
  28191. function ary(func, n, guard) {
  28192. n = guard ? undefined : n;
  28193. n = (func && n == null) ? func.length : n;
  28194. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28195. }
  28196. /**
  28197. * Creates a function that invokes `func`, with the `this` binding and arguments
  28198. * of the created function, while it's called less than `n` times. Subsequent
  28199. * calls to the created function return the result of the last `func` invocation.
  28200. *
  28201. * @static
  28202. * @memberOf _
  28203. * @since 3.0.0
  28204. * @category Function
  28205. * @param {number} n The number of calls at which `func` is no longer invoked.
  28206. * @param {Function} func The function to restrict.
  28207. * @returns {Function} Returns the new restricted function.
  28208. * @example
  28209. *
  28210. * jQuery(element).on('click', _.before(5, addContactToList));
  28211. * // => Allows adding up to 4 contacts to the list.
  28212. */
  28213. function before(n, func) {
  28214. var result;
  28215. if (typeof func != 'function') {
  28216. throw new TypeError(FUNC_ERROR_TEXT);
  28217. }
  28218. n = toInteger(n);
  28219. return function() {
  28220. if (--n > 0) {
  28221. result = func.apply(this, arguments);
  28222. }
  28223. if (n <= 1) {
  28224. func = undefined;
  28225. }
  28226. return result;
  28227. };
  28228. }
  28229. /**
  28230. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28231. * and `partials` prepended to the arguments it receives.
  28232. *
  28233. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28234. * may be used as a placeholder for partially applied arguments.
  28235. *
  28236. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28237. * property of bound functions.
  28238. *
  28239. * @static
  28240. * @memberOf _
  28241. * @since 0.1.0
  28242. * @category Function
  28243. * @param {Function} func The function to bind.
  28244. * @param {*} thisArg The `this` binding of `func`.
  28245. * @param {...*} [partials] The arguments to be partially applied.
  28246. * @returns {Function} Returns the new bound function.
  28247. * @example
  28248. *
  28249. * function greet(greeting, punctuation) {
  28250. * return greeting + ' ' + this.user + punctuation;
  28251. * }
  28252. *
  28253. * var object = { 'user': 'fred' };
  28254. *
  28255. * var bound = _.bind(greet, object, 'hi');
  28256. * bound('!');
  28257. * // => 'hi fred!'
  28258. *
  28259. * // Bound with placeholders.
  28260. * var bound = _.bind(greet, object, _, '!');
  28261. * bound('hi');
  28262. * // => 'hi fred!'
  28263. */
  28264. var bind = baseRest(function(func, thisArg, partials) {
  28265. var bitmask = WRAP_BIND_FLAG;
  28266. if (partials.length) {
  28267. var holders = replaceHolders(partials, getHolder(bind));
  28268. bitmask |= WRAP_PARTIAL_FLAG;
  28269. }
  28270. return createWrap(func, bitmask, thisArg, partials, holders);
  28271. });
  28272. /**
  28273. * Creates a function that invokes the method at `object[key]` with `partials`
  28274. * prepended to the arguments it receives.
  28275. *
  28276. * This method differs from `_.bind` by allowing bound functions to reference
  28277. * methods that may be redefined or don't yet exist. See
  28278. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28279. * for more details.
  28280. *
  28281. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28282. * builds, may be used as a placeholder for partially applied arguments.
  28283. *
  28284. * @static
  28285. * @memberOf _
  28286. * @since 0.10.0
  28287. * @category Function
  28288. * @param {Object} object The object to invoke the method on.
  28289. * @param {string} key The key of the method.
  28290. * @param {...*} [partials] The arguments to be partially applied.
  28291. * @returns {Function} Returns the new bound function.
  28292. * @example
  28293. *
  28294. * var object = {
  28295. * 'user': 'fred',
  28296. * 'greet': function(greeting, punctuation) {
  28297. * return greeting + ' ' + this.user + punctuation;
  28298. * }
  28299. * };
  28300. *
  28301. * var bound = _.bindKey(object, 'greet', 'hi');
  28302. * bound('!');
  28303. * // => 'hi fred!'
  28304. *
  28305. * object.greet = function(greeting, punctuation) {
  28306. * return greeting + 'ya ' + this.user + punctuation;
  28307. * };
  28308. *
  28309. * bound('!');
  28310. * // => 'hiya fred!'
  28311. *
  28312. * // Bound with placeholders.
  28313. * var bound = _.bindKey(object, 'greet', _, '!');
  28314. * bound('hi');
  28315. * // => 'hiya fred!'
  28316. */
  28317. var bindKey = baseRest(function(object, key, partials) {
  28318. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28319. if (partials.length) {
  28320. var holders = replaceHolders(partials, getHolder(bindKey));
  28321. bitmask |= WRAP_PARTIAL_FLAG;
  28322. }
  28323. return createWrap(key, bitmask, object, partials, holders);
  28324. });
  28325. /**
  28326. * Creates a function that accepts arguments of `func` and either invokes
  28327. * `func` returning its result, if at least `arity` number of arguments have
  28328. * been provided, or returns a function that accepts the remaining `func`
  28329. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28330. * is not sufficient.
  28331. *
  28332. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28333. * may be used as a placeholder for provided arguments.
  28334. *
  28335. * **Note:** This method doesn't set the "length" property of curried functions.
  28336. *
  28337. * @static
  28338. * @memberOf _
  28339. * @since 2.0.0
  28340. * @category Function
  28341. * @param {Function} func The function to curry.
  28342. * @param {number} [arity=func.length] The arity of `func`.
  28343. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28344. * @returns {Function} Returns the new curried function.
  28345. * @example
  28346. *
  28347. * var abc = function(a, b, c) {
  28348. * return [a, b, c];
  28349. * };
  28350. *
  28351. * var curried = _.curry(abc);
  28352. *
  28353. * curried(1)(2)(3);
  28354. * // => [1, 2, 3]
  28355. *
  28356. * curried(1, 2)(3);
  28357. * // => [1, 2, 3]
  28358. *
  28359. * curried(1, 2, 3);
  28360. * // => [1, 2, 3]
  28361. *
  28362. * // Curried with placeholders.
  28363. * curried(1)(_, 3)(2);
  28364. * // => [1, 2, 3]
  28365. */
  28366. function curry(func, arity, guard) {
  28367. arity = guard ? undefined : arity;
  28368. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28369. result.placeholder = curry.placeholder;
  28370. return result;
  28371. }
  28372. /**
  28373. * This method is like `_.curry` except that arguments are applied to `func`
  28374. * in the manner of `_.partialRight` instead of `_.partial`.
  28375. *
  28376. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28377. * builds, may be used as a placeholder for provided arguments.
  28378. *
  28379. * **Note:** This method doesn't set the "length" property of curried functions.
  28380. *
  28381. * @static
  28382. * @memberOf _
  28383. * @since 3.0.0
  28384. * @category Function
  28385. * @param {Function} func The function to curry.
  28386. * @param {number} [arity=func.length] The arity of `func`.
  28387. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28388. * @returns {Function} Returns the new curried function.
  28389. * @example
  28390. *
  28391. * var abc = function(a, b, c) {
  28392. * return [a, b, c];
  28393. * };
  28394. *
  28395. * var curried = _.curryRight(abc);
  28396. *
  28397. * curried(3)(2)(1);
  28398. * // => [1, 2, 3]
  28399. *
  28400. * curried(2, 3)(1);
  28401. * // => [1, 2, 3]
  28402. *
  28403. * curried(1, 2, 3);
  28404. * // => [1, 2, 3]
  28405. *
  28406. * // Curried with placeholders.
  28407. * curried(3)(1, _)(2);
  28408. * // => [1, 2, 3]
  28409. */
  28410. function curryRight(func, arity, guard) {
  28411. arity = guard ? undefined : arity;
  28412. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28413. result.placeholder = curryRight.placeholder;
  28414. return result;
  28415. }
  28416. /**
  28417. * Creates a debounced function that delays invoking `func` until after `wait`
  28418. * milliseconds have elapsed since the last time the debounced function was
  28419. * invoked. The debounced function comes with a `cancel` method to cancel
  28420. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28421. * Provide `options` to indicate whether `func` should be invoked on the
  28422. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28423. * with the last arguments provided to the debounced function. Subsequent
  28424. * calls to the debounced function return the result of the last `func`
  28425. * invocation.
  28426. *
  28427. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28428. * invoked on the trailing edge of the timeout only if the debounced function
  28429. * is invoked more than once during the `wait` timeout.
  28430. *
  28431. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28432. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28433. *
  28434. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28435. * for details over the differences between `_.debounce` and `_.throttle`.
  28436. *
  28437. * @static
  28438. * @memberOf _
  28439. * @since 0.1.0
  28440. * @category Function
  28441. * @param {Function} func The function to debounce.
  28442. * @param {number} [wait=0] The number of milliseconds to delay.
  28443. * @param {Object} [options={}] The options object.
  28444. * @param {boolean} [options.leading=false]
  28445. * Specify invoking on the leading edge of the timeout.
  28446. * @param {number} [options.maxWait]
  28447. * The maximum time `func` is allowed to be delayed before it's invoked.
  28448. * @param {boolean} [options.trailing=true]
  28449. * Specify invoking on the trailing edge of the timeout.
  28450. * @returns {Function} Returns the new debounced function.
  28451. * @example
  28452. *
  28453. * // Avoid costly calculations while the window size is in flux.
  28454. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28455. *
  28456. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28457. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28458. * 'leading': true,
  28459. * 'trailing': false
  28460. * }));
  28461. *
  28462. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28463. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28464. * var source = new EventSource('/stream');
  28465. * jQuery(source).on('message', debounced);
  28466. *
  28467. * // Cancel the trailing debounced invocation.
  28468. * jQuery(window).on('popstate', debounced.cancel);
  28469. */
  28470. function debounce(func, wait, options) {
  28471. var lastArgs,
  28472. lastThis,
  28473. maxWait,
  28474. result,
  28475. timerId,
  28476. lastCallTime,
  28477. lastInvokeTime = 0,
  28478. leading = false,
  28479. maxing = false,
  28480. trailing = true;
  28481. if (typeof func != 'function') {
  28482. throw new TypeError(FUNC_ERROR_TEXT);
  28483. }
  28484. wait = toNumber(wait) || 0;
  28485. if (isObject(options)) {
  28486. leading = !!options.leading;
  28487. maxing = 'maxWait' in options;
  28488. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28489. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28490. }
  28491. function invokeFunc(time) {
  28492. var args = lastArgs,
  28493. thisArg = lastThis;
  28494. lastArgs = lastThis = undefined;
  28495. lastInvokeTime = time;
  28496. result = func.apply(thisArg, args);
  28497. return result;
  28498. }
  28499. function leadingEdge(time) {
  28500. // Reset any `maxWait` timer.
  28501. lastInvokeTime = time;
  28502. // Start the timer for the trailing edge.
  28503. timerId = setTimeout(timerExpired, wait);
  28504. // Invoke the leading edge.
  28505. return leading ? invokeFunc(time) : result;
  28506. }
  28507. function remainingWait(time) {
  28508. var timeSinceLastCall = time - lastCallTime,
  28509. timeSinceLastInvoke = time - lastInvokeTime,
  28510. timeWaiting = wait - timeSinceLastCall;
  28511. return maxing
  28512. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28513. : timeWaiting;
  28514. }
  28515. function shouldInvoke(time) {
  28516. var timeSinceLastCall = time - lastCallTime,
  28517. timeSinceLastInvoke = time - lastInvokeTime;
  28518. // Either this is the first call, activity has stopped and we're at the
  28519. // trailing edge, the system time has gone backwards and we're treating
  28520. // it as the trailing edge, or we've hit the `maxWait` limit.
  28521. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28522. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28523. }
  28524. function timerExpired() {
  28525. var time = now();
  28526. if (shouldInvoke(time)) {
  28527. return trailingEdge(time);
  28528. }
  28529. // Restart the timer.
  28530. timerId = setTimeout(timerExpired, remainingWait(time));
  28531. }
  28532. function trailingEdge(time) {
  28533. timerId = undefined;
  28534. // Only invoke if we have `lastArgs` which means `func` has been
  28535. // debounced at least once.
  28536. if (trailing && lastArgs) {
  28537. return invokeFunc(time);
  28538. }
  28539. lastArgs = lastThis = undefined;
  28540. return result;
  28541. }
  28542. function cancel() {
  28543. if (timerId !== undefined) {
  28544. clearTimeout(timerId);
  28545. }
  28546. lastInvokeTime = 0;
  28547. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28548. }
  28549. function flush() {
  28550. return timerId === undefined ? result : trailingEdge(now());
  28551. }
  28552. function debounced() {
  28553. var time = now(),
  28554. isInvoking = shouldInvoke(time);
  28555. lastArgs = arguments;
  28556. lastThis = this;
  28557. lastCallTime = time;
  28558. if (isInvoking) {
  28559. if (timerId === undefined) {
  28560. return leadingEdge(lastCallTime);
  28561. }
  28562. if (maxing) {
  28563. // Handle invocations in a tight loop.
  28564. clearTimeout(timerId);
  28565. timerId = setTimeout(timerExpired, wait);
  28566. return invokeFunc(lastCallTime);
  28567. }
  28568. }
  28569. if (timerId === undefined) {
  28570. timerId = setTimeout(timerExpired, wait);
  28571. }
  28572. return result;
  28573. }
  28574. debounced.cancel = cancel;
  28575. debounced.flush = flush;
  28576. return debounced;
  28577. }
  28578. /**
  28579. * Defers invoking the `func` until the current call stack has cleared. Any
  28580. * additional arguments are provided to `func` when it's invoked.
  28581. *
  28582. * @static
  28583. * @memberOf _
  28584. * @since 0.1.0
  28585. * @category Function
  28586. * @param {Function} func The function to defer.
  28587. * @param {...*} [args] The arguments to invoke `func` with.
  28588. * @returns {number} Returns the timer id.
  28589. * @example
  28590. *
  28591. * _.defer(function(text) {
  28592. * console.log(text);
  28593. * }, 'deferred');
  28594. * // => Logs 'deferred' after one millisecond.
  28595. */
  28596. var defer = baseRest(function(func, args) {
  28597. return baseDelay(func, 1, args);
  28598. });
  28599. /**
  28600. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28601. * provided to `func` when it's invoked.
  28602. *
  28603. * @static
  28604. * @memberOf _
  28605. * @since 0.1.0
  28606. * @category Function
  28607. * @param {Function} func The function to delay.
  28608. * @param {number} wait The number of milliseconds to delay invocation.
  28609. * @param {...*} [args] The arguments to invoke `func` with.
  28610. * @returns {number} Returns the timer id.
  28611. * @example
  28612. *
  28613. * _.delay(function(text) {
  28614. * console.log(text);
  28615. * }, 1000, 'later');
  28616. * // => Logs 'later' after one second.
  28617. */
  28618. var delay = baseRest(function(func, wait, args) {
  28619. return baseDelay(func, toNumber(wait) || 0, args);
  28620. });
  28621. /**
  28622. * Creates a function that invokes `func` with arguments reversed.
  28623. *
  28624. * @static
  28625. * @memberOf _
  28626. * @since 4.0.0
  28627. * @category Function
  28628. * @param {Function} func The function to flip arguments for.
  28629. * @returns {Function} Returns the new flipped function.
  28630. * @example
  28631. *
  28632. * var flipped = _.flip(function() {
  28633. * return _.toArray(arguments);
  28634. * });
  28635. *
  28636. * flipped('a', 'b', 'c', 'd');
  28637. * // => ['d', 'c', 'b', 'a']
  28638. */
  28639. function flip(func) {
  28640. return createWrap(func, WRAP_FLIP_FLAG);
  28641. }
  28642. /**
  28643. * Creates a function that memoizes the result of `func`. If `resolver` is
  28644. * provided, it determines the cache key for storing the result based on the
  28645. * arguments provided to the memoized function. By default, the first argument
  28646. * provided to the memoized function is used as the map cache key. The `func`
  28647. * is invoked with the `this` binding of the memoized function.
  28648. *
  28649. * **Note:** The cache is exposed as the `cache` property on the memoized
  28650. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28651. * constructor with one whose instances implement the
  28652. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28653. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28654. *
  28655. * @static
  28656. * @memberOf _
  28657. * @since 0.1.0
  28658. * @category Function
  28659. * @param {Function} func The function to have its output memoized.
  28660. * @param {Function} [resolver] The function to resolve the cache key.
  28661. * @returns {Function} Returns the new memoized function.
  28662. * @example
  28663. *
  28664. * var object = { 'a': 1, 'b': 2 };
  28665. * var other = { 'c': 3, 'd': 4 };
  28666. *
  28667. * var values = _.memoize(_.values);
  28668. * values(object);
  28669. * // => [1, 2]
  28670. *
  28671. * values(other);
  28672. * // => [3, 4]
  28673. *
  28674. * object.a = 2;
  28675. * values(object);
  28676. * // => [1, 2]
  28677. *
  28678. * // Modify the result cache.
  28679. * values.cache.set(object, ['a', 'b']);
  28680. * values(object);
  28681. * // => ['a', 'b']
  28682. *
  28683. * // Replace `_.memoize.Cache`.
  28684. * _.memoize.Cache = WeakMap;
  28685. */
  28686. function memoize(func, resolver) {
  28687. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28688. throw new TypeError(FUNC_ERROR_TEXT);
  28689. }
  28690. var memoized = function() {
  28691. var args = arguments,
  28692. key = resolver ? resolver.apply(this, args) : args[0],
  28693. cache = memoized.cache;
  28694. if (cache.has(key)) {
  28695. return cache.get(key);
  28696. }
  28697. var result = func.apply(this, args);
  28698. memoized.cache = cache.set(key, result) || cache;
  28699. return result;
  28700. };
  28701. memoized.cache = new (memoize.Cache || MapCache);
  28702. return memoized;
  28703. }
  28704. // Expose `MapCache`.
  28705. memoize.Cache = MapCache;
  28706. /**
  28707. * Creates a function that negates the result of the predicate `func`. The
  28708. * `func` predicate is invoked with the `this` binding and arguments of the
  28709. * created function.
  28710. *
  28711. * @static
  28712. * @memberOf _
  28713. * @since 3.0.0
  28714. * @category Function
  28715. * @param {Function} predicate The predicate to negate.
  28716. * @returns {Function} Returns the new negated function.
  28717. * @example
  28718. *
  28719. * function isEven(n) {
  28720. * return n % 2 == 0;
  28721. * }
  28722. *
  28723. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28724. * // => [1, 3, 5]
  28725. */
  28726. function negate(predicate) {
  28727. if (typeof predicate != 'function') {
  28728. throw new TypeError(FUNC_ERROR_TEXT);
  28729. }
  28730. return function() {
  28731. var args = arguments;
  28732. switch (args.length) {
  28733. case 0: return !predicate.call(this);
  28734. case 1: return !predicate.call(this, args[0]);
  28735. case 2: return !predicate.call(this, args[0], args[1]);
  28736. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28737. }
  28738. return !predicate.apply(this, args);
  28739. };
  28740. }
  28741. /**
  28742. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28743. * to the function return the value of the first invocation. The `func` is
  28744. * invoked with the `this` binding and arguments of the created function.
  28745. *
  28746. * @static
  28747. * @memberOf _
  28748. * @since 0.1.0
  28749. * @category Function
  28750. * @param {Function} func The function to restrict.
  28751. * @returns {Function} Returns the new restricted function.
  28752. * @example
  28753. *
  28754. * var initialize = _.once(createApplication);
  28755. * initialize();
  28756. * initialize();
  28757. * // => `createApplication` is invoked once
  28758. */
  28759. function once(func) {
  28760. return before(2, func);
  28761. }
  28762. /**
  28763. * Creates a function that invokes `func` with its arguments transformed.
  28764. *
  28765. * @static
  28766. * @since 4.0.0
  28767. * @memberOf _
  28768. * @category Function
  28769. * @param {Function} func The function to wrap.
  28770. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28771. * The argument transforms.
  28772. * @returns {Function} Returns the new function.
  28773. * @example
  28774. *
  28775. * function doubled(n) {
  28776. * return n * 2;
  28777. * }
  28778. *
  28779. * function square(n) {
  28780. * return n * n;
  28781. * }
  28782. *
  28783. * var func = _.overArgs(function(x, y) {
  28784. * return [x, y];
  28785. * }, [square, doubled]);
  28786. *
  28787. * func(9, 3);
  28788. * // => [81, 6]
  28789. *
  28790. * func(10, 5);
  28791. * // => [100, 10]
  28792. */
  28793. var overArgs = castRest(function(func, transforms) {
  28794. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28795. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28796. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28797. var funcsLength = transforms.length;
  28798. return baseRest(function(args) {
  28799. var index = -1,
  28800. length = nativeMin(args.length, funcsLength);
  28801. while (++index < length) {
  28802. args[index] = transforms[index].call(this, args[index]);
  28803. }
  28804. return apply(func, this, args);
  28805. });
  28806. });
  28807. /**
  28808. * Creates a function that invokes `func` with `partials` prepended to the
  28809. * arguments it receives. This method is like `_.bind` except it does **not**
  28810. * alter the `this` binding.
  28811. *
  28812. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28813. * builds, may be used as a placeholder for partially applied arguments.
  28814. *
  28815. * **Note:** This method doesn't set the "length" property of partially
  28816. * applied functions.
  28817. *
  28818. * @static
  28819. * @memberOf _
  28820. * @since 0.2.0
  28821. * @category Function
  28822. * @param {Function} func The function to partially apply arguments to.
  28823. * @param {...*} [partials] The arguments to be partially applied.
  28824. * @returns {Function} Returns the new partially applied function.
  28825. * @example
  28826. *
  28827. * function greet(greeting, name) {
  28828. * return greeting + ' ' + name;
  28829. * }
  28830. *
  28831. * var sayHelloTo = _.partial(greet, 'hello');
  28832. * sayHelloTo('fred');
  28833. * // => 'hello fred'
  28834. *
  28835. * // Partially applied with placeholders.
  28836. * var greetFred = _.partial(greet, _, 'fred');
  28837. * greetFred('hi');
  28838. * // => 'hi fred'
  28839. */
  28840. var partial = baseRest(function(func, partials) {
  28841. var holders = replaceHolders(partials, getHolder(partial));
  28842. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28843. });
  28844. /**
  28845. * This method is like `_.partial` except that partially applied arguments
  28846. * are appended to the arguments it receives.
  28847. *
  28848. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28849. * builds, may be used as a placeholder for partially applied arguments.
  28850. *
  28851. * **Note:** This method doesn't set the "length" property of partially
  28852. * applied functions.
  28853. *
  28854. * @static
  28855. * @memberOf _
  28856. * @since 1.0.0
  28857. * @category Function
  28858. * @param {Function} func The function to partially apply arguments to.
  28859. * @param {...*} [partials] The arguments to be partially applied.
  28860. * @returns {Function} Returns the new partially applied function.
  28861. * @example
  28862. *
  28863. * function greet(greeting, name) {
  28864. * return greeting + ' ' + name;
  28865. * }
  28866. *
  28867. * var greetFred = _.partialRight(greet, 'fred');
  28868. * greetFred('hi');
  28869. * // => 'hi fred'
  28870. *
  28871. * // Partially applied with placeholders.
  28872. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28873. * sayHelloTo('fred');
  28874. * // => 'hello fred'
  28875. */
  28876. var partialRight = baseRest(function(func, partials) {
  28877. var holders = replaceHolders(partials, getHolder(partialRight));
  28878. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28879. });
  28880. /**
  28881. * Creates a function that invokes `func` with arguments arranged according
  28882. * to the specified `indexes` where the argument value at the first index is
  28883. * provided as the first argument, the argument value at the second index is
  28884. * provided as the second argument, and so on.
  28885. *
  28886. * @static
  28887. * @memberOf _
  28888. * @since 3.0.0
  28889. * @category Function
  28890. * @param {Function} func The function to rearrange arguments for.
  28891. * @param {...(number|number[])} indexes The arranged argument indexes.
  28892. * @returns {Function} Returns the new function.
  28893. * @example
  28894. *
  28895. * var rearged = _.rearg(function(a, b, c) {
  28896. * return [a, b, c];
  28897. * }, [2, 0, 1]);
  28898. *
  28899. * rearged('b', 'c', 'a')
  28900. * // => ['a', 'b', 'c']
  28901. */
  28902. var rearg = flatRest(function(func, indexes) {
  28903. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28904. });
  28905. /**
  28906. * Creates a function that invokes `func` with the `this` binding of the
  28907. * created function and arguments from `start` and beyond provided as
  28908. * an array.
  28909. *
  28910. * **Note:** This method is based on the
  28911. * [rest parameter](https://mdn.io/rest_parameters).
  28912. *
  28913. * @static
  28914. * @memberOf _
  28915. * @since 4.0.0
  28916. * @category Function
  28917. * @param {Function} func The function to apply a rest parameter to.
  28918. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28919. * @returns {Function} Returns the new function.
  28920. * @example
  28921. *
  28922. * var say = _.rest(function(what, names) {
  28923. * return what + ' ' + _.initial(names).join(', ') +
  28924. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28925. * });
  28926. *
  28927. * say('hello', 'fred', 'barney', 'pebbles');
  28928. * // => 'hello fred, barney, & pebbles'
  28929. */
  28930. function rest(func, start) {
  28931. if (typeof func != 'function') {
  28932. throw new TypeError(FUNC_ERROR_TEXT);
  28933. }
  28934. start = start === undefined ? start : toInteger(start);
  28935. return baseRest(func, start);
  28936. }
  28937. /**
  28938. * Creates a function that invokes `func` with the `this` binding of the
  28939. * create function and an array of arguments much like
  28940. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28941. *
  28942. * **Note:** This method is based on the
  28943. * [spread operator](https://mdn.io/spread_operator).
  28944. *
  28945. * @static
  28946. * @memberOf _
  28947. * @since 3.2.0
  28948. * @category Function
  28949. * @param {Function} func The function to spread arguments over.
  28950. * @param {number} [start=0] The start position of the spread.
  28951. * @returns {Function} Returns the new function.
  28952. * @example
  28953. *
  28954. * var say = _.spread(function(who, what) {
  28955. * return who + ' says ' + what;
  28956. * });
  28957. *
  28958. * say(['fred', 'hello']);
  28959. * // => 'fred says hello'
  28960. *
  28961. * var numbers = Promise.all([
  28962. * Promise.resolve(40),
  28963. * Promise.resolve(36)
  28964. * ]);
  28965. *
  28966. * numbers.then(_.spread(function(x, y) {
  28967. * return x + y;
  28968. * }));
  28969. * // => a Promise of 76
  28970. */
  28971. function spread(func, start) {
  28972. if (typeof func != 'function') {
  28973. throw new TypeError(FUNC_ERROR_TEXT);
  28974. }
  28975. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28976. return baseRest(function(args) {
  28977. var array = args[start],
  28978. otherArgs = castSlice(args, 0, start);
  28979. if (array) {
  28980. arrayPush(otherArgs, array);
  28981. }
  28982. return apply(func, this, otherArgs);
  28983. });
  28984. }
  28985. /**
  28986. * Creates a throttled function that only invokes `func` at most once per
  28987. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28988. * method to cancel delayed `func` invocations and a `flush` method to
  28989. * immediately invoke them. Provide `options` to indicate whether `func`
  28990. * should be invoked on the leading and/or trailing edge of the `wait`
  28991. * timeout. The `func` is invoked with the last arguments provided to the
  28992. * throttled function. Subsequent calls to the throttled function return the
  28993. * result of the last `func` invocation.
  28994. *
  28995. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28996. * invoked on the trailing edge of the timeout only if the throttled function
  28997. * is invoked more than once during the `wait` timeout.
  28998. *
  28999. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29000. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29001. *
  29002. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29003. * for details over the differences between `_.throttle` and `_.debounce`.
  29004. *
  29005. * @static
  29006. * @memberOf _
  29007. * @since 0.1.0
  29008. * @category Function
  29009. * @param {Function} func The function to throttle.
  29010. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29011. * @param {Object} [options={}] The options object.
  29012. * @param {boolean} [options.leading=true]
  29013. * Specify invoking on the leading edge of the timeout.
  29014. * @param {boolean} [options.trailing=true]
  29015. * Specify invoking on the trailing edge of the timeout.
  29016. * @returns {Function} Returns the new throttled function.
  29017. * @example
  29018. *
  29019. * // Avoid excessively updating the position while scrolling.
  29020. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29021. *
  29022. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29023. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29024. * jQuery(element).on('click', throttled);
  29025. *
  29026. * // Cancel the trailing throttled invocation.
  29027. * jQuery(window).on('popstate', throttled.cancel);
  29028. */
  29029. function throttle(func, wait, options) {
  29030. var leading = true,
  29031. trailing = true;
  29032. if (typeof func != 'function') {
  29033. throw new TypeError(FUNC_ERROR_TEXT);
  29034. }
  29035. if (isObject(options)) {
  29036. leading = 'leading' in options ? !!options.leading : leading;
  29037. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29038. }
  29039. return debounce(func, wait, {
  29040. 'leading': leading,
  29041. 'maxWait': wait,
  29042. 'trailing': trailing
  29043. });
  29044. }
  29045. /**
  29046. * Creates a function that accepts up to one argument, ignoring any
  29047. * additional arguments.
  29048. *
  29049. * @static
  29050. * @memberOf _
  29051. * @since 4.0.0
  29052. * @category Function
  29053. * @param {Function} func The function to cap arguments for.
  29054. * @returns {Function} Returns the new capped function.
  29055. * @example
  29056. *
  29057. * _.map(['6', '8', '10'], _.unary(parseInt));
  29058. * // => [6, 8, 10]
  29059. */
  29060. function unary(func) {
  29061. return ary(func, 1);
  29062. }
  29063. /**
  29064. * Creates a function that provides `value` to `wrapper` as its first
  29065. * argument. Any additional arguments provided to the function are appended
  29066. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29067. * binding of the created function.
  29068. *
  29069. * @static
  29070. * @memberOf _
  29071. * @since 0.1.0
  29072. * @category Function
  29073. * @param {*} value The value to wrap.
  29074. * @param {Function} [wrapper=identity] The wrapper function.
  29075. * @returns {Function} Returns the new function.
  29076. * @example
  29077. *
  29078. * var p = _.wrap(_.escape, function(func, text) {
  29079. * return '<p>' + func(text) + '</p>';
  29080. * });
  29081. *
  29082. * p('fred, barney, & pebbles');
  29083. * // => '<p>fred, barney, &amp; pebbles</p>'
  29084. */
  29085. function wrap(value, wrapper) {
  29086. return partial(castFunction(wrapper), value);
  29087. }
  29088. /*------------------------------------------------------------------------*/
  29089. /**
  29090. * Casts `value` as an array if it's not one.
  29091. *
  29092. * @static
  29093. * @memberOf _
  29094. * @since 4.4.0
  29095. * @category Lang
  29096. * @param {*} value The value to inspect.
  29097. * @returns {Array} Returns the cast array.
  29098. * @example
  29099. *
  29100. * _.castArray(1);
  29101. * // => [1]
  29102. *
  29103. * _.castArray({ 'a': 1 });
  29104. * // => [{ 'a': 1 }]
  29105. *
  29106. * _.castArray('abc');
  29107. * // => ['abc']
  29108. *
  29109. * _.castArray(null);
  29110. * // => [null]
  29111. *
  29112. * _.castArray(undefined);
  29113. * // => [undefined]
  29114. *
  29115. * _.castArray();
  29116. * // => []
  29117. *
  29118. * var array = [1, 2, 3];
  29119. * console.log(_.castArray(array) === array);
  29120. * // => true
  29121. */
  29122. function castArray() {
  29123. if (!arguments.length) {
  29124. return [];
  29125. }
  29126. var value = arguments[0];
  29127. return isArray(value) ? value : [value];
  29128. }
  29129. /**
  29130. * Creates a shallow clone of `value`.
  29131. *
  29132. * **Note:** This method is loosely based on the
  29133. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29134. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29135. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29136. * arrays. The own enumerable properties of `arguments` objects are cloned
  29137. * as plain objects. An empty object is returned for uncloneable values such
  29138. * as error objects, functions, DOM nodes, and WeakMaps.
  29139. *
  29140. * @static
  29141. * @memberOf _
  29142. * @since 0.1.0
  29143. * @category Lang
  29144. * @param {*} value The value to clone.
  29145. * @returns {*} Returns the cloned value.
  29146. * @see _.cloneDeep
  29147. * @example
  29148. *
  29149. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29150. *
  29151. * var shallow = _.clone(objects);
  29152. * console.log(shallow[0] === objects[0]);
  29153. * // => true
  29154. */
  29155. function clone(value) {
  29156. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29157. }
  29158. /**
  29159. * This method is like `_.clone` except that it accepts `customizer` which
  29160. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29161. * cloning is handled by the method instead. The `customizer` is invoked with
  29162. * up to four arguments; (value [, index|key, object, stack]).
  29163. *
  29164. * @static
  29165. * @memberOf _
  29166. * @since 4.0.0
  29167. * @category Lang
  29168. * @param {*} value The value to clone.
  29169. * @param {Function} [customizer] The function to customize cloning.
  29170. * @returns {*} Returns the cloned value.
  29171. * @see _.cloneDeepWith
  29172. * @example
  29173. *
  29174. * function customizer(value) {
  29175. * if (_.isElement(value)) {
  29176. * return value.cloneNode(false);
  29177. * }
  29178. * }
  29179. *
  29180. * var el = _.cloneWith(document.body, customizer);
  29181. *
  29182. * console.log(el === document.body);
  29183. * // => false
  29184. * console.log(el.nodeName);
  29185. * // => 'BODY'
  29186. * console.log(el.childNodes.length);
  29187. * // => 0
  29188. */
  29189. function cloneWith(value, customizer) {
  29190. customizer = typeof customizer == 'function' ? customizer : undefined;
  29191. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29192. }
  29193. /**
  29194. * This method is like `_.clone` except that it recursively clones `value`.
  29195. *
  29196. * @static
  29197. * @memberOf _
  29198. * @since 1.0.0
  29199. * @category Lang
  29200. * @param {*} value The value to recursively clone.
  29201. * @returns {*} Returns the deep cloned value.
  29202. * @see _.clone
  29203. * @example
  29204. *
  29205. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29206. *
  29207. * var deep = _.cloneDeep(objects);
  29208. * console.log(deep[0] === objects[0]);
  29209. * // => false
  29210. */
  29211. function cloneDeep(value) {
  29212. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29213. }
  29214. /**
  29215. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29216. *
  29217. * @static
  29218. * @memberOf _
  29219. * @since 4.0.0
  29220. * @category Lang
  29221. * @param {*} value The value to recursively clone.
  29222. * @param {Function} [customizer] The function to customize cloning.
  29223. * @returns {*} Returns the deep cloned value.
  29224. * @see _.cloneWith
  29225. * @example
  29226. *
  29227. * function customizer(value) {
  29228. * if (_.isElement(value)) {
  29229. * return value.cloneNode(true);
  29230. * }
  29231. * }
  29232. *
  29233. * var el = _.cloneDeepWith(document.body, customizer);
  29234. *
  29235. * console.log(el === document.body);
  29236. * // => false
  29237. * console.log(el.nodeName);
  29238. * // => 'BODY'
  29239. * console.log(el.childNodes.length);
  29240. * // => 20
  29241. */
  29242. function cloneDeepWith(value, customizer) {
  29243. customizer = typeof customizer == 'function' ? customizer : undefined;
  29244. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29245. }
  29246. /**
  29247. * Checks if `object` conforms to `source` by invoking the predicate
  29248. * properties of `source` with the corresponding property values of `object`.
  29249. *
  29250. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29251. * partially applied.
  29252. *
  29253. * @static
  29254. * @memberOf _
  29255. * @since 4.14.0
  29256. * @category Lang
  29257. * @param {Object} object The object to inspect.
  29258. * @param {Object} source The object of property predicates to conform to.
  29259. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29260. * @example
  29261. *
  29262. * var object = { 'a': 1, 'b': 2 };
  29263. *
  29264. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29265. * // => true
  29266. *
  29267. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29268. * // => false
  29269. */
  29270. function conformsTo(object, source) {
  29271. return source == null || baseConformsTo(object, source, keys(source));
  29272. }
  29273. /**
  29274. * Performs a
  29275. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29276. * comparison between two values to determine if they are equivalent.
  29277. *
  29278. * @static
  29279. * @memberOf _
  29280. * @since 4.0.0
  29281. * @category Lang
  29282. * @param {*} value The value to compare.
  29283. * @param {*} other The other value to compare.
  29284. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29285. * @example
  29286. *
  29287. * var object = { 'a': 1 };
  29288. * var other = { 'a': 1 };
  29289. *
  29290. * _.eq(object, object);
  29291. * // => true
  29292. *
  29293. * _.eq(object, other);
  29294. * // => false
  29295. *
  29296. * _.eq('a', 'a');
  29297. * // => true
  29298. *
  29299. * _.eq('a', Object('a'));
  29300. * // => false
  29301. *
  29302. * _.eq(NaN, NaN);
  29303. * // => true
  29304. */
  29305. function eq(value, other) {
  29306. return value === other || (value !== value && other !== other);
  29307. }
  29308. /**
  29309. * Checks if `value` is greater than `other`.
  29310. *
  29311. * @static
  29312. * @memberOf _
  29313. * @since 3.9.0
  29314. * @category Lang
  29315. * @param {*} value The value to compare.
  29316. * @param {*} other The other value to compare.
  29317. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29318. * else `false`.
  29319. * @see _.lt
  29320. * @example
  29321. *
  29322. * _.gt(3, 1);
  29323. * // => true
  29324. *
  29325. * _.gt(3, 3);
  29326. * // => false
  29327. *
  29328. * _.gt(1, 3);
  29329. * // => false
  29330. */
  29331. var gt = createRelationalOperation(baseGt);
  29332. /**
  29333. * Checks if `value` is greater than or equal to `other`.
  29334. *
  29335. * @static
  29336. * @memberOf _
  29337. * @since 3.9.0
  29338. * @category Lang
  29339. * @param {*} value The value to compare.
  29340. * @param {*} other The other value to compare.
  29341. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29342. * `other`, else `false`.
  29343. * @see _.lte
  29344. * @example
  29345. *
  29346. * _.gte(3, 1);
  29347. * // => true
  29348. *
  29349. * _.gte(3, 3);
  29350. * // => true
  29351. *
  29352. * _.gte(1, 3);
  29353. * // => false
  29354. */
  29355. var gte = createRelationalOperation(function(value, other) {
  29356. return value >= other;
  29357. });
  29358. /**
  29359. * Checks if `value` is likely an `arguments` object.
  29360. *
  29361. * @static
  29362. * @memberOf _
  29363. * @since 0.1.0
  29364. * @category Lang
  29365. * @param {*} value The value to check.
  29366. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29367. * else `false`.
  29368. * @example
  29369. *
  29370. * _.isArguments(function() { return arguments; }());
  29371. * // => true
  29372. *
  29373. * _.isArguments([1, 2, 3]);
  29374. * // => false
  29375. */
  29376. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29377. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29378. !propertyIsEnumerable.call(value, 'callee');
  29379. };
  29380. /**
  29381. * Checks if `value` is classified as an `Array` object.
  29382. *
  29383. * @static
  29384. * @memberOf _
  29385. * @since 0.1.0
  29386. * @category Lang
  29387. * @param {*} value The value to check.
  29388. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29389. * @example
  29390. *
  29391. * _.isArray([1, 2, 3]);
  29392. * // => true
  29393. *
  29394. * _.isArray(document.body.children);
  29395. * // => false
  29396. *
  29397. * _.isArray('abc');
  29398. * // => false
  29399. *
  29400. * _.isArray(_.noop);
  29401. * // => false
  29402. */
  29403. var isArray = Array.isArray;
  29404. /**
  29405. * Checks if `value` is classified as an `ArrayBuffer` object.
  29406. *
  29407. * @static
  29408. * @memberOf _
  29409. * @since 4.3.0
  29410. * @category Lang
  29411. * @param {*} value The value to check.
  29412. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29413. * @example
  29414. *
  29415. * _.isArrayBuffer(new ArrayBuffer(2));
  29416. * // => true
  29417. *
  29418. * _.isArrayBuffer(new Array(2));
  29419. * // => false
  29420. */
  29421. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29422. /**
  29423. * Checks if `value` is array-like. A value is considered array-like if it's
  29424. * not a function and has a `value.length` that's an integer greater than or
  29425. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29426. *
  29427. * @static
  29428. * @memberOf _
  29429. * @since 4.0.0
  29430. * @category Lang
  29431. * @param {*} value The value to check.
  29432. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29433. * @example
  29434. *
  29435. * _.isArrayLike([1, 2, 3]);
  29436. * // => true
  29437. *
  29438. * _.isArrayLike(document.body.children);
  29439. * // => true
  29440. *
  29441. * _.isArrayLike('abc');
  29442. * // => true
  29443. *
  29444. * _.isArrayLike(_.noop);
  29445. * // => false
  29446. */
  29447. function isArrayLike(value) {
  29448. return value != null && isLength(value.length) && !isFunction(value);
  29449. }
  29450. /**
  29451. * This method is like `_.isArrayLike` except that it also checks if `value`
  29452. * is an object.
  29453. *
  29454. * @static
  29455. * @memberOf _
  29456. * @since 4.0.0
  29457. * @category Lang
  29458. * @param {*} value The value to check.
  29459. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29460. * else `false`.
  29461. * @example
  29462. *
  29463. * _.isArrayLikeObject([1, 2, 3]);
  29464. * // => true
  29465. *
  29466. * _.isArrayLikeObject(document.body.children);
  29467. * // => true
  29468. *
  29469. * _.isArrayLikeObject('abc');
  29470. * // => false
  29471. *
  29472. * _.isArrayLikeObject(_.noop);
  29473. * // => false
  29474. */
  29475. function isArrayLikeObject(value) {
  29476. return isObjectLike(value) && isArrayLike(value);
  29477. }
  29478. /**
  29479. * Checks if `value` is classified as a boolean primitive or object.
  29480. *
  29481. * @static
  29482. * @memberOf _
  29483. * @since 0.1.0
  29484. * @category Lang
  29485. * @param {*} value The value to check.
  29486. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29487. * @example
  29488. *
  29489. * _.isBoolean(false);
  29490. * // => true
  29491. *
  29492. * _.isBoolean(null);
  29493. * // => false
  29494. */
  29495. function isBoolean(value) {
  29496. return value === true || value === false ||
  29497. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29498. }
  29499. /**
  29500. * Checks if `value` is a buffer.
  29501. *
  29502. * @static
  29503. * @memberOf _
  29504. * @since 4.3.0
  29505. * @category Lang
  29506. * @param {*} value The value to check.
  29507. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29508. * @example
  29509. *
  29510. * _.isBuffer(new Buffer(2));
  29511. * // => true
  29512. *
  29513. * _.isBuffer(new Uint8Array(2));
  29514. * // => false
  29515. */
  29516. var isBuffer = nativeIsBuffer || stubFalse;
  29517. /**
  29518. * Checks if `value` is classified as a `Date` object.
  29519. *
  29520. * @static
  29521. * @memberOf _
  29522. * @since 0.1.0
  29523. * @category Lang
  29524. * @param {*} value The value to check.
  29525. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29526. * @example
  29527. *
  29528. * _.isDate(new Date);
  29529. * // => true
  29530. *
  29531. * _.isDate('Mon April 23 2012');
  29532. * // => false
  29533. */
  29534. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29535. /**
  29536. * Checks if `value` is likely a DOM element.
  29537. *
  29538. * @static
  29539. * @memberOf _
  29540. * @since 0.1.0
  29541. * @category Lang
  29542. * @param {*} value The value to check.
  29543. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29544. * @example
  29545. *
  29546. * _.isElement(document.body);
  29547. * // => true
  29548. *
  29549. * _.isElement('<body>');
  29550. * // => false
  29551. */
  29552. function isElement(value) {
  29553. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29554. }
  29555. /**
  29556. * Checks if `value` is an empty object, collection, map, or set.
  29557. *
  29558. * Objects are considered empty if they have no own enumerable string keyed
  29559. * properties.
  29560. *
  29561. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29562. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29563. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29564. *
  29565. * @static
  29566. * @memberOf _
  29567. * @since 0.1.0
  29568. * @category Lang
  29569. * @param {*} value The value to check.
  29570. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29571. * @example
  29572. *
  29573. * _.isEmpty(null);
  29574. * // => true
  29575. *
  29576. * _.isEmpty(true);
  29577. * // => true
  29578. *
  29579. * _.isEmpty(1);
  29580. * // => true
  29581. *
  29582. * _.isEmpty([1, 2, 3]);
  29583. * // => false
  29584. *
  29585. * _.isEmpty({ 'a': 1 });
  29586. * // => false
  29587. */
  29588. function isEmpty(value) {
  29589. if (value == null) {
  29590. return true;
  29591. }
  29592. if (isArrayLike(value) &&
  29593. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29594. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29595. return !value.length;
  29596. }
  29597. var tag = getTag(value);
  29598. if (tag == mapTag || tag == setTag) {
  29599. return !value.size;
  29600. }
  29601. if (isPrototype(value)) {
  29602. return !baseKeys(value).length;
  29603. }
  29604. for (var key in value) {
  29605. if (hasOwnProperty.call(value, key)) {
  29606. return false;
  29607. }
  29608. }
  29609. return true;
  29610. }
  29611. /**
  29612. * Performs a deep comparison between two values to determine if they are
  29613. * equivalent.
  29614. *
  29615. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29616. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29617. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29618. * by their own, not inherited, enumerable properties. Functions and DOM
  29619. * nodes are compared by strict equality, i.e. `===`.
  29620. *
  29621. * @static
  29622. * @memberOf _
  29623. * @since 0.1.0
  29624. * @category Lang
  29625. * @param {*} value The value to compare.
  29626. * @param {*} other The other value to compare.
  29627. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29628. * @example
  29629. *
  29630. * var object = { 'a': 1 };
  29631. * var other = { 'a': 1 };
  29632. *
  29633. * _.isEqual(object, other);
  29634. * // => true
  29635. *
  29636. * object === other;
  29637. * // => false
  29638. */
  29639. function isEqual(value, other) {
  29640. return baseIsEqual(value, other);
  29641. }
  29642. /**
  29643. * This method is like `_.isEqual` except that it accepts `customizer` which
  29644. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29645. * are handled by the method instead. The `customizer` is invoked with up to
  29646. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29647. *
  29648. * @static
  29649. * @memberOf _
  29650. * @since 4.0.0
  29651. * @category Lang
  29652. * @param {*} value The value to compare.
  29653. * @param {*} other The other value to compare.
  29654. * @param {Function} [customizer] The function to customize comparisons.
  29655. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29656. * @example
  29657. *
  29658. * function isGreeting(value) {
  29659. * return /^h(?:i|ello)$/.test(value);
  29660. * }
  29661. *
  29662. * function customizer(objValue, othValue) {
  29663. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29664. * return true;
  29665. * }
  29666. * }
  29667. *
  29668. * var array = ['hello', 'goodbye'];
  29669. * var other = ['hi', 'goodbye'];
  29670. *
  29671. * _.isEqualWith(array, other, customizer);
  29672. * // => true
  29673. */
  29674. function isEqualWith(value, other, customizer) {
  29675. customizer = typeof customizer == 'function' ? customizer : undefined;
  29676. var result = customizer ? customizer(value, other) : undefined;
  29677. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29678. }
  29679. /**
  29680. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29681. * `SyntaxError`, `TypeError`, or `URIError` object.
  29682. *
  29683. * @static
  29684. * @memberOf _
  29685. * @since 3.0.0
  29686. * @category Lang
  29687. * @param {*} value The value to check.
  29688. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29689. * @example
  29690. *
  29691. * _.isError(new Error);
  29692. * // => true
  29693. *
  29694. * _.isError(Error);
  29695. * // => false
  29696. */
  29697. function isError(value) {
  29698. if (!isObjectLike(value)) {
  29699. return false;
  29700. }
  29701. var tag = baseGetTag(value);
  29702. return tag == errorTag || tag == domExcTag ||
  29703. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29704. }
  29705. /**
  29706. * Checks if `value` is a finite primitive number.
  29707. *
  29708. * **Note:** This method is based on
  29709. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29710. *
  29711. * @static
  29712. * @memberOf _
  29713. * @since 0.1.0
  29714. * @category Lang
  29715. * @param {*} value The value to check.
  29716. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29717. * @example
  29718. *
  29719. * _.isFinite(3);
  29720. * // => true
  29721. *
  29722. * _.isFinite(Number.MIN_VALUE);
  29723. * // => true
  29724. *
  29725. * _.isFinite(Infinity);
  29726. * // => false
  29727. *
  29728. * _.isFinite('3');
  29729. * // => false
  29730. */
  29731. function isFinite(value) {
  29732. return typeof value == 'number' && nativeIsFinite(value);
  29733. }
  29734. /**
  29735. * Checks if `value` is classified as a `Function` object.
  29736. *
  29737. * @static
  29738. * @memberOf _
  29739. * @since 0.1.0
  29740. * @category Lang
  29741. * @param {*} value The value to check.
  29742. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29743. * @example
  29744. *
  29745. * _.isFunction(_);
  29746. * // => true
  29747. *
  29748. * _.isFunction(/abc/);
  29749. * // => false
  29750. */
  29751. function isFunction(value) {
  29752. if (!isObject(value)) {
  29753. return false;
  29754. }
  29755. // The use of `Object#toString` avoids issues with the `typeof` operator
  29756. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29757. var tag = baseGetTag(value);
  29758. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29759. }
  29760. /**
  29761. * Checks if `value` is an integer.
  29762. *
  29763. * **Note:** This method is based on
  29764. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29765. *
  29766. * @static
  29767. * @memberOf _
  29768. * @since 4.0.0
  29769. * @category Lang
  29770. * @param {*} value The value to check.
  29771. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29772. * @example
  29773. *
  29774. * _.isInteger(3);
  29775. * // => true
  29776. *
  29777. * _.isInteger(Number.MIN_VALUE);
  29778. * // => false
  29779. *
  29780. * _.isInteger(Infinity);
  29781. * // => false
  29782. *
  29783. * _.isInteger('3');
  29784. * // => false
  29785. */
  29786. function isInteger(value) {
  29787. return typeof value == 'number' && value == toInteger(value);
  29788. }
  29789. /**
  29790. * Checks if `value` is a valid array-like length.
  29791. *
  29792. * **Note:** This method is loosely based on
  29793. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29794. *
  29795. * @static
  29796. * @memberOf _
  29797. * @since 4.0.0
  29798. * @category Lang
  29799. * @param {*} value The value to check.
  29800. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29801. * @example
  29802. *
  29803. * _.isLength(3);
  29804. * // => true
  29805. *
  29806. * _.isLength(Number.MIN_VALUE);
  29807. * // => false
  29808. *
  29809. * _.isLength(Infinity);
  29810. * // => false
  29811. *
  29812. * _.isLength('3');
  29813. * // => false
  29814. */
  29815. function isLength(value) {
  29816. return typeof value == 'number' &&
  29817. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29818. }
  29819. /**
  29820. * Checks if `value` is the
  29821. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29822. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29823. *
  29824. * @static
  29825. * @memberOf _
  29826. * @since 0.1.0
  29827. * @category Lang
  29828. * @param {*} value The value to check.
  29829. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29830. * @example
  29831. *
  29832. * _.isObject({});
  29833. * // => true
  29834. *
  29835. * _.isObject([1, 2, 3]);
  29836. * // => true
  29837. *
  29838. * _.isObject(_.noop);
  29839. * // => true
  29840. *
  29841. * _.isObject(null);
  29842. * // => false
  29843. */
  29844. function isObject(value) {
  29845. var type = typeof value;
  29846. return value != null && (type == 'object' || type == 'function');
  29847. }
  29848. /**
  29849. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29850. * and has a `typeof` result of "object".
  29851. *
  29852. * @static
  29853. * @memberOf _
  29854. * @since 4.0.0
  29855. * @category Lang
  29856. * @param {*} value The value to check.
  29857. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29858. * @example
  29859. *
  29860. * _.isObjectLike({});
  29861. * // => true
  29862. *
  29863. * _.isObjectLike([1, 2, 3]);
  29864. * // => true
  29865. *
  29866. * _.isObjectLike(_.noop);
  29867. * // => false
  29868. *
  29869. * _.isObjectLike(null);
  29870. * // => false
  29871. */
  29872. function isObjectLike(value) {
  29873. return value != null && typeof value == 'object';
  29874. }
  29875. /**
  29876. * Checks if `value` is classified as a `Map` object.
  29877. *
  29878. * @static
  29879. * @memberOf _
  29880. * @since 4.3.0
  29881. * @category Lang
  29882. * @param {*} value The value to check.
  29883. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29884. * @example
  29885. *
  29886. * _.isMap(new Map);
  29887. * // => true
  29888. *
  29889. * _.isMap(new WeakMap);
  29890. * // => false
  29891. */
  29892. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29893. /**
  29894. * Performs a partial deep comparison between `object` and `source` to
  29895. * determine if `object` contains equivalent property values.
  29896. *
  29897. * **Note:** This method is equivalent to `_.matches` when `source` is
  29898. * partially applied.
  29899. *
  29900. * Partial comparisons will match empty array and empty object `source`
  29901. * values against any array or object value, respectively. See `_.isEqual`
  29902. * for a list of supported value comparisons.
  29903. *
  29904. * @static
  29905. * @memberOf _
  29906. * @since 3.0.0
  29907. * @category Lang
  29908. * @param {Object} object The object to inspect.
  29909. * @param {Object} source The object of property values to match.
  29910. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29911. * @example
  29912. *
  29913. * var object = { 'a': 1, 'b': 2 };
  29914. *
  29915. * _.isMatch(object, { 'b': 2 });
  29916. * // => true
  29917. *
  29918. * _.isMatch(object, { 'b': 1 });
  29919. * // => false
  29920. */
  29921. function isMatch(object, source) {
  29922. return object === source || baseIsMatch(object, source, getMatchData(source));
  29923. }
  29924. /**
  29925. * This method is like `_.isMatch` except that it accepts `customizer` which
  29926. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29927. * are handled by the method instead. The `customizer` is invoked with five
  29928. * arguments: (objValue, srcValue, index|key, object, source).
  29929. *
  29930. * @static
  29931. * @memberOf _
  29932. * @since 4.0.0
  29933. * @category Lang
  29934. * @param {Object} object The object to inspect.
  29935. * @param {Object} source The object of property values to match.
  29936. * @param {Function} [customizer] The function to customize comparisons.
  29937. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29938. * @example
  29939. *
  29940. * function isGreeting(value) {
  29941. * return /^h(?:i|ello)$/.test(value);
  29942. * }
  29943. *
  29944. * function customizer(objValue, srcValue) {
  29945. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29946. * return true;
  29947. * }
  29948. * }
  29949. *
  29950. * var object = { 'greeting': 'hello' };
  29951. * var source = { 'greeting': 'hi' };
  29952. *
  29953. * _.isMatchWith(object, source, customizer);
  29954. * // => true
  29955. */
  29956. function isMatchWith(object, source, customizer) {
  29957. customizer = typeof customizer == 'function' ? customizer : undefined;
  29958. return baseIsMatch(object, source, getMatchData(source), customizer);
  29959. }
  29960. /**
  29961. * Checks if `value` is `NaN`.
  29962. *
  29963. * **Note:** This method is based on
  29964. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29965. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29966. * `undefined` and other non-number values.
  29967. *
  29968. * @static
  29969. * @memberOf _
  29970. * @since 0.1.0
  29971. * @category Lang
  29972. * @param {*} value The value to check.
  29973. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29974. * @example
  29975. *
  29976. * _.isNaN(NaN);
  29977. * // => true
  29978. *
  29979. * _.isNaN(new Number(NaN));
  29980. * // => true
  29981. *
  29982. * isNaN(undefined);
  29983. * // => true
  29984. *
  29985. * _.isNaN(undefined);
  29986. * // => false
  29987. */
  29988. function isNaN(value) {
  29989. // An `NaN` primitive is the only value that is not equal to itself.
  29990. // Perform the `toStringTag` check first to avoid errors with some
  29991. // ActiveX objects in IE.
  29992. return isNumber(value) && value != +value;
  29993. }
  29994. /**
  29995. * Checks if `value` is a pristine native function.
  29996. *
  29997. * **Note:** This method can't reliably detect native functions in the presence
  29998. * of the core-js package because core-js circumvents this kind of detection.
  29999. * Despite multiple requests, the core-js maintainer has made it clear: any
  30000. * attempt to fix the detection will be obstructed. As a result, we're left
  30001. * with little choice but to throw an error. Unfortunately, this also affects
  30002. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30003. * which rely on core-js.
  30004. *
  30005. * @static
  30006. * @memberOf _
  30007. * @since 3.0.0
  30008. * @category Lang
  30009. * @param {*} value The value to check.
  30010. * @returns {boolean} Returns `true` if `value` is a native function,
  30011. * else `false`.
  30012. * @example
  30013. *
  30014. * _.isNative(Array.prototype.push);
  30015. * // => true
  30016. *
  30017. * _.isNative(_);
  30018. * // => false
  30019. */
  30020. function isNative(value) {
  30021. if (isMaskable(value)) {
  30022. throw new Error(CORE_ERROR_TEXT);
  30023. }
  30024. return baseIsNative(value);
  30025. }
  30026. /**
  30027. * Checks if `value` is `null`.
  30028. *
  30029. * @static
  30030. * @memberOf _
  30031. * @since 0.1.0
  30032. * @category Lang
  30033. * @param {*} value The value to check.
  30034. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30035. * @example
  30036. *
  30037. * _.isNull(null);
  30038. * // => true
  30039. *
  30040. * _.isNull(void 0);
  30041. * // => false
  30042. */
  30043. function isNull(value) {
  30044. return value === null;
  30045. }
  30046. /**
  30047. * Checks if `value` is `null` or `undefined`.
  30048. *
  30049. * @static
  30050. * @memberOf _
  30051. * @since 4.0.0
  30052. * @category Lang
  30053. * @param {*} value The value to check.
  30054. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30055. * @example
  30056. *
  30057. * _.isNil(null);
  30058. * // => true
  30059. *
  30060. * _.isNil(void 0);
  30061. * // => true
  30062. *
  30063. * _.isNil(NaN);
  30064. * // => false
  30065. */
  30066. function isNil(value) {
  30067. return value == null;
  30068. }
  30069. /**
  30070. * Checks if `value` is classified as a `Number` primitive or object.
  30071. *
  30072. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30073. * classified as numbers, use the `_.isFinite` method.
  30074. *
  30075. * @static
  30076. * @memberOf _
  30077. * @since 0.1.0
  30078. * @category Lang
  30079. * @param {*} value The value to check.
  30080. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30081. * @example
  30082. *
  30083. * _.isNumber(3);
  30084. * // => true
  30085. *
  30086. * _.isNumber(Number.MIN_VALUE);
  30087. * // => true
  30088. *
  30089. * _.isNumber(Infinity);
  30090. * // => true
  30091. *
  30092. * _.isNumber('3');
  30093. * // => false
  30094. */
  30095. function isNumber(value) {
  30096. return typeof value == 'number' ||
  30097. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30098. }
  30099. /**
  30100. * Checks if `value` is a plain object, that is, an object created by the
  30101. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30102. *
  30103. * @static
  30104. * @memberOf _
  30105. * @since 0.8.0
  30106. * @category Lang
  30107. * @param {*} value The value to check.
  30108. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30109. * @example
  30110. *
  30111. * function Foo() {
  30112. * this.a = 1;
  30113. * }
  30114. *
  30115. * _.isPlainObject(new Foo);
  30116. * // => false
  30117. *
  30118. * _.isPlainObject([1, 2, 3]);
  30119. * // => false
  30120. *
  30121. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30122. * // => true
  30123. *
  30124. * _.isPlainObject(Object.create(null));
  30125. * // => true
  30126. */
  30127. function isPlainObject(value) {
  30128. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30129. return false;
  30130. }
  30131. var proto = getPrototype(value);
  30132. if (proto === null) {
  30133. return true;
  30134. }
  30135. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30136. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30137. funcToString.call(Ctor) == objectCtorString;
  30138. }
  30139. /**
  30140. * Checks if `value` is classified as a `RegExp` object.
  30141. *
  30142. * @static
  30143. * @memberOf _
  30144. * @since 0.1.0
  30145. * @category Lang
  30146. * @param {*} value The value to check.
  30147. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30148. * @example
  30149. *
  30150. * _.isRegExp(/abc/);
  30151. * // => true
  30152. *
  30153. * _.isRegExp('/abc/');
  30154. * // => false
  30155. */
  30156. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30157. /**
  30158. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30159. * double precision number which isn't the result of a rounded unsafe integer.
  30160. *
  30161. * **Note:** This method is based on
  30162. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30163. *
  30164. * @static
  30165. * @memberOf _
  30166. * @since 4.0.0
  30167. * @category Lang
  30168. * @param {*} value The value to check.
  30169. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30170. * @example
  30171. *
  30172. * _.isSafeInteger(3);
  30173. * // => true
  30174. *
  30175. * _.isSafeInteger(Number.MIN_VALUE);
  30176. * // => false
  30177. *
  30178. * _.isSafeInteger(Infinity);
  30179. * // => false
  30180. *
  30181. * _.isSafeInteger('3');
  30182. * // => false
  30183. */
  30184. function isSafeInteger(value) {
  30185. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30186. }
  30187. /**
  30188. * Checks if `value` is classified as a `Set` object.
  30189. *
  30190. * @static
  30191. * @memberOf _
  30192. * @since 4.3.0
  30193. * @category Lang
  30194. * @param {*} value The value to check.
  30195. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30196. * @example
  30197. *
  30198. * _.isSet(new Set);
  30199. * // => true
  30200. *
  30201. * _.isSet(new WeakSet);
  30202. * // => false
  30203. */
  30204. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30205. /**
  30206. * Checks if `value` is classified as a `String` primitive or object.
  30207. *
  30208. * @static
  30209. * @since 0.1.0
  30210. * @memberOf _
  30211. * @category Lang
  30212. * @param {*} value The value to check.
  30213. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30214. * @example
  30215. *
  30216. * _.isString('abc');
  30217. * // => true
  30218. *
  30219. * _.isString(1);
  30220. * // => false
  30221. */
  30222. function isString(value) {
  30223. return typeof value == 'string' ||
  30224. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30225. }
  30226. /**
  30227. * Checks if `value` is classified as a `Symbol` primitive or object.
  30228. *
  30229. * @static
  30230. * @memberOf _
  30231. * @since 4.0.0
  30232. * @category Lang
  30233. * @param {*} value The value to check.
  30234. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30235. * @example
  30236. *
  30237. * _.isSymbol(Symbol.iterator);
  30238. * // => true
  30239. *
  30240. * _.isSymbol('abc');
  30241. * // => false
  30242. */
  30243. function isSymbol(value) {
  30244. return typeof value == 'symbol' ||
  30245. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30246. }
  30247. /**
  30248. * Checks if `value` is classified as a typed array.
  30249. *
  30250. * @static
  30251. * @memberOf _
  30252. * @since 3.0.0
  30253. * @category Lang
  30254. * @param {*} value The value to check.
  30255. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30256. * @example
  30257. *
  30258. * _.isTypedArray(new Uint8Array);
  30259. * // => true
  30260. *
  30261. * _.isTypedArray([]);
  30262. * // => false
  30263. */
  30264. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30265. /**
  30266. * Checks if `value` is `undefined`.
  30267. *
  30268. * @static
  30269. * @since 0.1.0
  30270. * @memberOf _
  30271. * @category Lang
  30272. * @param {*} value The value to check.
  30273. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30274. * @example
  30275. *
  30276. * _.isUndefined(void 0);
  30277. * // => true
  30278. *
  30279. * _.isUndefined(null);
  30280. * // => false
  30281. */
  30282. function isUndefined(value) {
  30283. return value === undefined;
  30284. }
  30285. /**
  30286. * Checks if `value` is classified as a `WeakMap` object.
  30287. *
  30288. * @static
  30289. * @memberOf _
  30290. * @since 4.3.0
  30291. * @category Lang
  30292. * @param {*} value The value to check.
  30293. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30294. * @example
  30295. *
  30296. * _.isWeakMap(new WeakMap);
  30297. * // => true
  30298. *
  30299. * _.isWeakMap(new Map);
  30300. * // => false
  30301. */
  30302. function isWeakMap(value) {
  30303. return isObjectLike(value) && getTag(value) == weakMapTag;
  30304. }
  30305. /**
  30306. * Checks if `value` is classified as a `WeakSet` object.
  30307. *
  30308. * @static
  30309. * @memberOf _
  30310. * @since 4.3.0
  30311. * @category Lang
  30312. * @param {*} value The value to check.
  30313. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30314. * @example
  30315. *
  30316. * _.isWeakSet(new WeakSet);
  30317. * // => true
  30318. *
  30319. * _.isWeakSet(new Set);
  30320. * // => false
  30321. */
  30322. function isWeakSet(value) {
  30323. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30324. }
  30325. /**
  30326. * Checks if `value` is less than `other`.
  30327. *
  30328. * @static
  30329. * @memberOf _
  30330. * @since 3.9.0
  30331. * @category Lang
  30332. * @param {*} value The value to compare.
  30333. * @param {*} other The other value to compare.
  30334. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30335. * else `false`.
  30336. * @see _.gt
  30337. * @example
  30338. *
  30339. * _.lt(1, 3);
  30340. * // => true
  30341. *
  30342. * _.lt(3, 3);
  30343. * // => false
  30344. *
  30345. * _.lt(3, 1);
  30346. * // => false
  30347. */
  30348. var lt = createRelationalOperation(baseLt);
  30349. /**
  30350. * Checks if `value` is less than or equal to `other`.
  30351. *
  30352. * @static
  30353. * @memberOf _
  30354. * @since 3.9.0
  30355. * @category Lang
  30356. * @param {*} value The value to compare.
  30357. * @param {*} other The other value to compare.
  30358. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30359. * `other`, else `false`.
  30360. * @see _.gte
  30361. * @example
  30362. *
  30363. * _.lte(1, 3);
  30364. * // => true
  30365. *
  30366. * _.lte(3, 3);
  30367. * // => true
  30368. *
  30369. * _.lte(3, 1);
  30370. * // => false
  30371. */
  30372. var lte = createRelationalOperation(function(value, other) {
  30373. return value <= other;
  30374. });
  30375. /**
  30376. * Converts `value` to an array.
  30377. *
  30378. * @static
  30379. * @since 0.1.0
  30380. * @memberOf _
  30381. * @category Lang
  30382. * @param {*} value The value to convert.
  30383. * @returns {Array} Returns the converted array.
  30384. * @example
  30385. *
  30386. * _.toArray({ 'a': 1, 'b': 2 });
  30387. * // => [1, 2]
  30388. *
  30389. * _.toArray('abc');
  30390. * // => ['a', 'b', 'c']
  30391. *
  30392. * _.toArray(1);
  30393. * // => []
  30394. *
  30395. * _.toArray(null);
  30396. * // => []
  30397. */
  30398. function toArray(value) {
  30399. if (!value) {
  30400. return [];
  30401. }
  30402. if (isArrayLike(value)) {
  30403. return isString(value) ? stringToArray(value) : copyArray(value);
  30404. }
  30405. if (symIterator && value[symIterator]) {
  30406. return iteratorToArray(value[symIterator]());
  30407. }
  30408. var tag = getTag(value),
  30409. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30410. return func(value);
  30411. }
  30412. /**
  30413. * Converts `value` to a finite number.
  30414. *
  30415. * @static
  30416. * @memberOf _
  30417. * @since 4.12.0
  30418. * @category Lang
  30419. * @param {*} value The value to convert.
  30420. * @returns {number} Returns the converted number.
  30421. * @example
  30422. *
  30423. * _.toFinite(3.2);
  30424. * // => 3.2
  30425. *
  30426. * _.toFinite(Number.MIN_VALUE);
  30427. * // => 5e-324
  30428. *
  30429. * _.toFinite(Infinity);
  30430. * // => 1.7976931348623157e+308
  30431. *
  30432. * _.toFinite('3.2');
  30433. * // => 3.2
  30434. */
  30435. function toFinite(value) {
  30436. if (!value) {
  30437. return value === 0 ? value : 0;
  30438. }
  30439. value = toNumber(value);
  30440. if (value === INFINITY || value === -INFINITY) {
  30441. var sign = (value < 0 ? -1 : 1);
  30442. return sign * MAX_INTEGER;
  30443. }
  30444. return value === value ? value : 0;
  30445. }
  30446. /**
  30447. * Converts `value` to an integer.
  30448. *
  30449. * **Note:** This method is loosely based on
  30450. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30451. *
  30452. * @static
  30453. * @memberOf _
  30454. * @since 4.0.0
  30455. * @category Lang
  30456. * @param {*} value The value to convert.
  30457. * @returns {number} Returns the converted integer.
  30458. * @example
  30459. *
  30460. * _.toInteger(3.2);
  30461. * // => 3
  30462. *
  30463. * _.toInteger(Number.MIN_VALUE);
  30464. * // => 0
  30465. *
  30466. * _.toInteger(Infinity);
  30467. * // => 1.7976931348623157e+308
  30468. *
  30469. * _.toInteger('3.2');
  30470. * // => 3
  30471. */
  30472. function toInteger(value) {
  30473. var result = toFinite(value),
  30474. remainder = result % 1;
  30475. return result === result ? (remainder ? result - remainder : result) : 0;
  30476. }
  30477. /**
  30478. * Converts `value` to an integer suitable for use as the length of an
  30479. * array-like object.
  30480. *
  30481. * **Note:** This method is based on
  30482. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30483. *
  30484. * @static
  30485. * @memberOf _
  30486. * @since 4.0.0
  30487. * @category Lang
  30488. * @param {*} value The value to convert.
  30489. * @returns {number} Returns the converted integer.
  30490. * @example
  30491. *
  30492. * _.toLength(3.2);
  30493. * // => 3
  30494. *
  30495. * _.toLength(Number.MIN_VALUE);
  30496. * // => 0
  30497. *
  30498. * _.toLength(Infinity);
  30499. * // => 4294967295
  30500. *
  30501. * _.toLength('3.2');
  30502. * // => 3
  30503. */
  30504. function toLength(value) {
  30505. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30506. }
  30507. /**
  30508. * Converts `value` to a number.
  30509. *
  30510. * @static
  30511. * @memberOf _
  30512. * @since 4.0.0
  30513. * @category Lang
  30514. * @param {*} value The value to process.
  30515. * @returns {number} Returns the number.
  30516. * @example
  30517. *
  30518. * _.toNumber(3.2);
  30519. * // => 3.2
  30520. *
  30521. * _.toNumber(Number.MIN_VALUE);
  30522. * // => 5e-324
  30523. *
  30524. * _.toNumber(Infinity);
  30525. * // => Infinity
  30526. *
  30527. * _.toNumber('3.2');
  30528. * // => 3.2
  30529. */
  30530. function toNumber(value) {
  30531. if (typeof value == 'number') {
  30532. return value;
  30533. }
  30534. if (isSymbol(value)) {
  30535. return NAN;
  30536. }
  30537. if (isObject(value)) {
  30538. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30539. value = isObject(other) ? (other + '') : other;
  30540. }
  30541. if (typeof value != 'string') {
  30542. return value === 0 ? value : +value;
  30543. }
  30544. value = value.replace(reTrim, '');
  30545. var isBinary = reIsBinary.test(value);
  30546. return (isBinary || reIsOctal.test(value))
  30547. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30548. : (reIsBadHex.test(value) ? NAN : +value);
  30549. }
  30550. /**
  30551. * Converts `value` to a plain object flattening inherited enumerable string
  30552. * keyed properties of `value` to own properties of the plain object.
  30553. *
  30554. * @static
  30555. * @memberOf _
  30556. * @since 3.0.0
  30557. * @category Lang
  30558. * @param {*} value The value to convert.
  30559. * @returns {Object} Returns the converted plain object.
  30560. * @example
  30561. *
  30562. * function Foo() {
  30563. * this.b = 2;
  30564. * }
  30565. *
  30566. * Foo.prototype.c = 3;
  30567. *
  30568. * _.assign({ 'a': 1 }, new Foo);
  30569. * // => { 'a': 1, 'b': 2 }
  30570. *
  30571. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30572. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30573. */
  30574. function toPlainObject(value) {
  30575. return copyObject(value, keysIn(value));
  30576. }
  30577. /**
  30578. * Converts `value` to a safe integer. A safe integer can be compared and
  30579. * represented correctly.
  30580. *
  30581. * @static
  30582. * @memberOf _
  30583. * @since 4.0.0
  30584. * @category Lang
  30585. * @param {*} value The value to convert.
  30586. * @returns {number} Returns the converted integer.
  30587. * @example
  30588. *
  30589. * _.toSafeInteger(3.2);
  30590. * // => 3
  30591. *
  30592. * _.toSafeInteger(Number.MIN_VALUE);
  30593. * // => 0
  30594. *
  30595. * _.toSafeInteger(Infinity);
  30596. * // => 9007199254740991
  30597. *
  30598. * _.toSafeInteger('3.2');
  30599. * // => 3
  30600. */
  30601. function toSafeInteger(value) {
  30602. return value
  30603. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30604. : (value === 0 ? value : 0);
  30605. }
  30606. /**
  30607. * Converts `value` to a string. An empty string is returned for `null`
  30608. * and `undefined` values. The sign of `-0` is preserved.
  30609. *
  30610. * @static
  30611. * @memberOf _
  30612. * @since 4.0.0
  30613. * @category Lang
  30614. * @param {*} value The value to convert.
  30615. * @returns {string} Returns the converted string.
  30616. * @example
  30617. *
  30618. * _.toString(null);
  30619. * // => ''
  30620. *
  30621. * _.toString(-0);
  30622. * // => '-0'
  30623. *
  30624. * _.toString([1, 2, 3]);
  30625. * // => '1,2,3'
  30626. */
  30627. function toString(value) {
  30628. return value == null ? '' : baseToString(value);
  30629. }
  30630. /*------------------------------------------------------------------------*/
  30631. /**
  30632. * Assigns own enumerable string keyed properties of source objects to the
  30633. * destination object. Source objects are applied from left to right.
  30634. * Subsequent sources overwrite property assignments of previous sources.
  30635. *
  30636. * **Note:** This method mutates `object` and is loosely based on
  30637. * [`Object.assign`](https://mdn.io/Object/assign).
  30638. *
  30639. * @static
  30640. * @memberOf _
  30641. * @since 0.10.0
  30642. * @category Object
  30643. * @param {Object} object The destination object.
  30644. * @param {...Object} [sources] The source objects.
  30645. * @returns {Object} Returns `object`.
  30646. * @see _.assignIn
  30647. * @example
  30648. *
  30649. * function Foo() {
  30650. * this.a = 1;
  30651. * }
  30652. *
  30653. * function Bar() {
  30654. * this.c = 3;
  30655. * }
  30656. *
  30657. * Foo.prototype.b = 2;
  30658. * Bar.prototype.d = 4;
  30659. *
  30660. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30661. * // => { 'a': 1, 'c': 3 }
  30662. */
  30663. var assign = createAssigner(function(object, source) {
  30664. if (isPrototype(source) || isArrayLike(source)) {
  30665. copyObject(source, keys(source), object);
  30666. return;
  30667. }
  30668. for (var key in source) {
  30669. if (hasOwnProperty.call(source, key)) {
  30670. assignValue(object, key, source[key]);
  30671. }
  30672. }
  30673. });
  30674. /**
  30675. * This method is like `_.assign` except that it iterates over own and
  30676. * inherited source properties.
  30677. *
  30678. * **Note:** This method mutates `object`.
  30679. *
  30680. * @static
  30681. * @memberOf _
  30682. * @since 4.0.0
  30683. * @alias extend
  30684. * @category Object
  30685. * @param {Object} object The destination object.
  30686. * @param {...Object} [sources] The source objects.
  30687. * @returns {Object} Returns `object`.
  30688. * @see _.assign
  30689. * @example
  30690. *
  30691. * function Foo() {
  30692. * this.a = 1;
  30693. * }
  30694. *
  30695. * function Bar() {
  30696. * this.c = 3;
  30697. * }
  30698. *
  30699. * Foo.prototype.b = 2;
  30700. * Bar.prototype.d = 4;
  30701. *
  30702. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30703. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30704. */
  30705. var assignIn = createAssigner(function(object, source) {
  30706. copyObject(source, keysIn(source), object);
  30707. });
  30708. /**
  30709. * This method is like `_.assignIn` except that it accepts `customizer`
  30710. * which is invoked to produce the assigned values. If `customizer` returns
  30711. * `undefined`, assignment is handled by the method instead. The `customizer`
  30712. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30713. *
  30714. * **Note:** This method mutates `object`.
  30715. *
  30716. * @static
  30717. * @memberOf _
  30718. * @since 4.0.0
  30719. * @alias extendWith
  30720. * @category Object
  30721. * @param {Object} object The destination object.
  30722. * @param {...Object} sources The source objects.
  30723. * @param {Function} [customizer] The function to customize assigned values.
  30724. * @returns {Object} Returns `object`.
  30725. * @see _.assignWith
  30726. * @example
  30727. *
  30728. * function customizer(objValue, srcValue) {
  30729. * return _.isUndefined(objValue) ? srcValue : objValue;
  30730. * }
  30731. *
  30732. * var defaults = _.partialRight(_.assignInWith, customizer);
  30733. *
  30734. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30735. * // => { 'a': 1, 'b': 2 }
  30736. */
  30737. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30738. copyObject(source, keysIn(source), object, customizer);
  30739. });
  30740. /**
  30741. * This method is like `_.assign` except that it accepts `customizer`
  30742. * which is invoked to produce the assigned values. If `customizer` returns
  30743. * `undefined`, assignment is handled by the method instead. The `customizer`
  30744. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30745. *
  30746. * **Note:** This method mutates `object`.
  30747. *
  30748. * @static
  30749. * @memberOf _
  30750. * @since 4.0.0
  30751. * @category Object
  30752. * @param {Object} object The destination object.
  30753. * @param {...Object} sources The source objects.
  30754. * @param {Function} [customizer] The function to customize assigned values.
  30755. * @returns {Object} Returns `object`.
  30756. * @see _.assignInWith
  30757. * @example
  30758. *
  30759. * function customizer(objValue, srcValue) {
  30760. * return _.isUndefined(objValue) ? srcValue : objValue;
  30761. * }
  30762. *
  30763. * var defaults = _.partialRight(_.assignWith, customizer);
  30764. *
  30765. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30766. * // => { 'a': 1, 'b': 2 }
  30767. */
  30768. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30769. copyObject(source, keys(source), object, customizer);
  30770. });
  30771. /**
  30772. * Creates an array of values corresponding to `paths` of `object`.
  30773. *
  30774. * @static
  30775. * @memberOf _
  30776. * @since 1.0.0
  30777. * @category Object
  30778. * @param {Object} object The object to iterate over.
  30779. * @param {...(string|string[])} [paths] The property paths to pick.
  30780. * @returns {Array} Returns the picked values.
  30781. * @example
  30782. *
  30783. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30784. *
  30785. * _.at(object, ['a[0].b.c', 'a[1]']);
  30786. * // => [3, 4]
  30787. */
  30788. var at = flatRest(baseAt);
  30789. /**
  30790. * Creates an object that inherits from the `prototype` object. If a
  30791. * `properties` object is given, its own enumerable string keyed properties
  30792. * are assigned to the created object.
  30793. *
  30794. * @static
  30795. * @memberOf _
  30796. * @since 2.3.0
  30797. * @category Object
  30798. * @param {Object} prototype The object to inherit from.
  30799. * @param {Object} [properties] The properties to assign to the object.
  30800. * @returns {Object} Returns the new object.
  30801. * @example
  30802. *
  30803. * function Shape() {
  30804. * this.x = 0;
  30805. * this.y = 0;
  30806. * }
  30807. *
  30808. * function Circle() {
  30809. * Shape.call(this);
  30810. * }
  30811. *
  30812. * Circle.prototype = _.create(Shape.prototype, {
  30813. * 'constructor': Circle
  30814. * });
  30815. *
  30816. * var circle = new Circle;
  30817. * circle instanceof Circle;
  30818. * // => true
  30819. *
  30820. * circle instanceof Shape;
  30821. * // => true
  30822. */
  30823. function create(prototype, properties) {
  30824. var result = baseCreate(prototype);
  30825. return properties == null ? result : baseAssign(result, properties);
  30826. }
  30827. /**
  30828. * Assigns own and inherited enumerable string keyed properties of source
  30829. * objects to the destination object for all destination properties that
  30830. * resolve to `undefined`. Source objects are applied from left to right.
  30831. * Once a property is set, additional values of the same property are ignored.
  30832. *
  30833. * **Note:** This method mutates `object`.
  30834. *
  30835. * @static
  30836. * @since 0.1.0
  30837. * @memberOf _
  30838. * @category Object
  30839. * @param {Object} object The destination object.
  30840. * @param {...Object} [sources] The source objects.
  30841. * @returns {Object} Returns `object`.
  30842. * @see _.defaultsDeep
  30843. * @example
  30844. *
  30845. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30846. * // => { 'a': 1, 'b': 2 }
  30847. */
  30848. var defaults = baseRest(function(object, sources) {
  30849. object = Object(object);
  30850. var index = -1;
  30851. var length = sources.length;
  30852. var guard = length > 2 ? sources[2] : undefined;
  30853. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30854. length = 1;
  30855. }
  30856. while (++index < length) {
  30857. var source = sources[index];
  30858. var props = keysIn(source);
  30859. var propsIndex = -1;
  30860. var propsLength = props.length;
  30861. while (++propsIndex < propsLength) {
  30862. var key = props[propsIndex];
  30863. var value = object[key];
  30864. if (value === undefined ||
  30865. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30866. object[key] = source[key];
  30867. }
  30868. }
  30869. }
  30870. return object;
  30871. });
  30872. /**
  30873. * This method is like `_.defaults` except that it recursively assigns
  30874. * default properties.
  30875. *
  30876. * **Note:** This method mutates `object`.
  30877. *
  30878. * @static
  30879. * @memberOf _
  30880. * @since 3.10.0
  30881. * @category Object
  30882. * @param {Object} object The destination object.
  30883. * @param {...Object} [sources] The source objects.
  30884. * @returns {Object} Returns `object`.
  30885. * @see _.defaults
  30886. * @example
  30887. *
  30888. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30889. * // => { 'a': { 'b': 2, 'c': 3 } }
  30890. */
  30891. var defaultsDeep = baseRest(function(args) {
  30892. args.push(undefined, customDefaultsMerge);
  30893. return apply(mergeWith, undefined, args);
  30894. });
  30895. /**
  30896. * This method is like `_.find` except that it returns the key of the first
  30897. * element `predicate` returns truthy for instead of the element itself.
  30898. *
  30899. * @static
  30900. * @memberOf _
  30901. * @since 1.1.0
  30902. * @category Object
  30903. * @param {Object} object The object to inspect.
  30904. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30905. * @returns {string|undefined} Returns the key of the matched element,
  30906. * else `undefined`.
  30907. * @example
  30908. *
  30909. * var users = {
  30910. * 'barney': { 'age': 36, 'active': true },
  30911. * 'fred': { 'age': 40, 'active': false },
  30912. * 'pebbles': { 'age': 1, 'active': true }
  30913. * };
  30914. *
  30915. * _.findKey(users, function(o) { return o.age < 40; });
  30916. * // => 'barney' (iteration order is not guaranteed)
  30917. *
  30918. * // The `_.matches` iteratee shorthand.
  30919. * _.findKey(users, { 'age': 1, 'active': true });
  30920. * // => 'pebbles'
  30921. *
  30922. * // The `_.matchesProperty` iteratee shorthand.
  30923. * _.findKey(users, ['active', false]);
  30924. * // => 'fred'
  30925. *
  30926. * // The `_.property` iteratee shorthand.
  30927. * _.findKey(users, 'active');
  30928. * // => 'barney'
  30929. */
  30930. function findKey(object, predicate) {
  30931. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30932. }
  30933. /**
  30934. * This method is like `_.findKey` except that it iterates over elements of
  30935. * a collection in the opposite order.
  30936. *
  30937. * @static
  30938. * @memberOf _
  30939. * @since 2.0.0
  30940. * @category Object
  30941. * @param {Object} object The object to inspect.
  30942. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30943. * @returns {string|undefined} Returns the key of the matched element,
  30944. * else `undefined`.
  30945. * @example
  30946. *
  30947. * var users = {
  30948. * 'barney': { 'age': 36, 'active': true },
  30949. * 'fred': { 'age': 40, 'active': false },
  30950. * 'pebbles': { 'age': 1, 'active': true }
  30951. * };
  30952. *
  30953. * _.findLastKey(users, function(o) { return o.age < 40; });
  30954. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30955. *
  30956. * // The `_.matches` iteratee shorthand.
  30957. * _.findLastKey(users, { 'age': 36, 'active': true });
  30958. * // => 'barney'
  30959. *
  30960. * // The `_.matchesProperty` iteratee shorthand.
  30961. * _.findLastKey(users, ['active', false]);
  30962. * // => 'fred'
  30963. *
  30964. * // The `_.property` iteratee shorthand.
  30965. * _.findLastKey(users, 'active');
  30966. * // => 'pebbles'
  30967. */
  30968. function findLastKey(object, predicate) {
  30969. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30970. }
  30971. /**
  30972. * Iterates over own and inherited enumerable string keyed properties of an
  30973. * object and invokes `iteratee` for each property. The iteratee is invoked
  30974. * with three arguments: (value, key, object). Iteratee functions may exit
  30975. * iteration early by explicitly returning `false`.
  30976. *
  30977. * @static
  30978. * @memberOf _
  30979. * @since 0.3.0
  30980. * @category Object
  30981. * @param {Object} object The object to iterate over.
  30982. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30983. * @returns {Object} Returns `object`.
  30984. * @see _.forInRight
  30985. * @example
  30986. *
  30987. * function Foo() {
  30988. * this.a = 1;
  30989. * this.b = 2;
  30990. * }
  30991. *
  30992. * Foo.prototype.c = 3;
  30993. *
  30994. * _.forIn(new Foo, function(value, key) {
  30995. * console.log(key);
  30996. * });
  30997. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30998. */
  30999. function forIn(object, iteratee) {
  31000. return object == null
  31001. ? object
  31002. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31003. }
  31004. /**
  31005. * This method is like `_.forIn` except that it iterates over properties of
  31006. * `object` in the opposite order.
  31007. *
  31008. * @static
  31009. * @memberOf _
  31010. * @since 2.0.0
  31011. * @category Object
  31012. * @param {Object} object The object to iterate over.
  31013. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31014. * @returns {Object} Returns `object`.
  31015. * @see _.forIn
  31016. * @example
  31017. *
  31018. * function Foo() {
  31019. * this.a = 1;
  31020. * this.b = 2;
  31021. * }
  31022. *
  31023. * Foo.prototype.c = 3;
  31024. *
  31025. * _.forInRight(new Foo, function(value, key) {
  31026. * console.log(key);
  31027. * });
  31028. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31029. */
  31030. function forInRight(object, iteratee) {
  31031. return object == null
  31032. ? object
  31033. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31034. }
  31035. /**
  31036. * Iterates over own enumerable string keyed properties of an object and
  31037. * invokes `iteratee` for each property. The iteratee is invoked with three
  31038. * arguments: (value, key, object). Iteratee functions may exit iteration
  31039. * early by explicitly returning `false`.
  31040. *
  31041. * @static
  31042. * @memberOf _
  31043. * @since 0.3.0
  31044. * @category Object
  31045. * @param {Object} object The object to iterate over.
  31046. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31047. * @returns {Object} Returns `object`.
  31048. * @see _.forOwnRight
  31049. * @example
  31050. *
  31051. * function Foo() {
  31052. * this.a = 1;
  31053. * this.b = 2;
  31054. * }
  31055. *
  31056. * Foo.prototype.c = 3;
  31057. *
  31058. * _.forOwn(new Foo, function(value, key) {
  31059. * console.log(key);
  31060. * });
  31061. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31062. */
  31063. function forOwn(object, iteratee) {
  31064. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31065. }
  31066. /**
  31067. * This method is like `_.forOwn` except that it iterates over properties of
  31068. * `object` in the opposite order.
  31069. *
  31070. * @static
  31071. * @memberOf _
  31072. * @since 2.0.0
  31073. * @category Object
  31074. * @param {Object} object The object to iterate over.
  31075. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31076. * @returns {Object} Returns `object`.
  31077. * @see _.forOwn
  31078. * @example
  31079. *
  31080. * function Foo() {
  31081. * this.a = 1;
  31082. * this.b = 2;
  31083. * }
  31084. *
  31085. * Foo.prototype.c = 3;
  31086. *
  31087. * _.forOwnRight(new Foo, function(value, key) {
  31088. * console.log(key);
  31089. * });
  31090. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31091. */
  31092. function forOwnRight(object, iteratee) {
  31093. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31094. }
  31095. /**
  31096. * Creates an array of function property names from own enumerable properties
  31097. * of `object`.
  31098. *
  31099. * @static
  31100. * @since 0.1.0
  31101. * @memberOf _
  31102. * @category Object
  31103. * @param {Object} object The object to inspect.
  31104. * @returns {Array} Returns the function names.
  31105. * @see _.functionsIn
  31106. * @example
  31107. *
  31108. * function Foo() {
  31109. * this.a = _.constant('a');
  31110. * this.b = _.constant('b');
  31111. * }
  31112. *
  31113. * Foo.prototype.c = _.constant('c');
  31114. *
  31115. * _.functions(new Foo);
  31116. * // => ['a', 'b']
  31117. */
  31118. function functions(object) {
  31119. return object == null ? [] : baseFunctions(object, keys(object));
  31120. }
  31121. /**
  31122. * Creates an array of function property names from own and inherited
  31123. * enumerable properties of `object`.
  31124. *
  31125. * @static
  31126. * @memberOf _
  31127. * @since 4.0.0
  31128. * @category Object
  31129. * @param {Object} object The object to inspect.
  31130. * @returns {Array} Returns the function names.
  31131. * @see _.functions
  31132. * @example
  31133. *
  31134. * function Foo() {
  31135. * this.a = _.constant('a');
  31136. * this.b = _.constant('b');
  31137. * }
  31138. *
  31139. * Foo.prototype.c = _.constant('c');
  31140. *
  31141. * _.functionsIn(new Foo);
  31142. * // => ['a', 'b', 'c']
  31143. */
  31144. function functionsIn(object) {
  31145. return object == null ? [] : baseFunctions(object, keysIn(object));
  31146. }
  31147. /**
  31148. * Gets the value at `path` of `object`. If the resolved value is
  31149. * `undefined`, the `defaultValue` is returned in its place.
  31150. *
  31151. * @static
  31152. * @memberOf _
  31153. * @since 3.7.0
  31154. * @category Object
  31155. * @param {Object} object The object to query.
  31156. * @param {Array|string} path The path of the property to get.
  31157. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31158. * @returns {*} Returns the resolved value.
  31159. * @example
  31160. *
  31161. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31162. *
  31163. * _.get(object, 'a[0].b.c');
  31164. * // => 3
  31165. *
  31166. * _.get(object, ['a', '0', 'b', 'c']);
  31167. * // => 3
  31168. *
  31169. * _.get(object, 'a.b.c', 'default');
  31170. * // => 'default'
  31171. */
  31172. function get(object, path, defaultValue) {
  31173. var result = object == null ? undefined : baseGet(object, path);
  31174. return result === undefined ? defaultValue : result;
  31175. }
  31176. /**
  31177. * Checks if `path` is a direct property of `object`.
  31178. *
  31179. * @static
  31180. * @since 0.1.0
  31181. * @memberOf _
  31182. * @category Object
  31183. * @param {Object} object The object to query.
  31184. * @param {Array|string} path The path to check.
  31185. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31186. * @example
  31187. *
  31188. * var object = { 'a': { 'b': 2 } };
  31189. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31190. *
  31191. * _.has(object, 'a');
  31192. * // => true
  31193. *
  31194. * _.has(object, 'a.b');
  31195. * // => true
  31196. *
  31197. * _.has(object, ['a', 'b']);
  31198. * // => true
  31199. *
  31200. * _.has(other, 'a');
  31201. * // => false
  31202. */
  31203. function has(object, path) {
  31204. return object != null && hasPath(object, path, baseHas);
  31205. }
  31206. /**
  31207. * Checks if `path` is a direct or inherited property of `object`.
  31208. *
  31209. * @static
  31210. * @memberOf _
  31211. * @since 4.0.0
  31212. * @category Object
  31213. * @param {Object} object The object to query.
  31214. * @param {Array|string} path The path to check.
  31215. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31216. * @example
  31217. *
  31218. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31219. *
  31220. * _.hasIn(object, 'a');
  31221. * // => true
  31222. *
  31223. * _.hasIn(object, 'a.b');
  31224. * // => true
  31225. *
  31226. * _.hasIn(object, ['a', 'b']);
  31227. * // => true
  31228. *
  31229. * _.hasIn(object, 'b');
  31230. * // => false
  31231. */
  31232. function hasIn(object, path) {
  31233. return object != null && hasPath(object, path, baseHasIn);
  31234. }
  31235. /**
  31236. * Creates an object composed of the inverted keys and values of `object`.
  31237. * If `object` contains duplicate values, subsequent values overwrite
  31238. * property assignments of previous values.
  31239. *
  31240. * @static
  31241. * @memberOf _
  31242. * @since 0.7.0
  31243. * @category Object
  31244. * @param {Object} object The object to invert.
  31245. * @returns {Object} Returns the new inverted object.
  31246. * @example
  31247. *
  31248. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31249. *
  31250. * _.invert(object);
  31251. * // => { '1': 'c', '2': 'b' }
  31252. */
  31253. var invert = createInverter(function(result, value, key) {
  31254. if (value != null &&
  31255. typeof value.toString != 'function') {
  31256. value = nativeObjectToString.call(value);
  31257. }
  31258. result[value] = key;
  31259. }, constant(identity));
  31260. /**
  31261. * This method is like `_.invert` except that the inverted object is generated
  31262. * from the results of running each element of `object` thru `iteratee`. The
  31263. * corresponding inverted value of each inverted key is an array of keys
  31264. * responsible for generating the inverted value. The iteratee is invoked
  31265. * with one argument: (value).
  31266. *
  31267. * @static
  31268. * @memberOf _
  31269. * @since 4.1.0
  31270. * @category Object
  31271. * @param {Object} object The object to invert.
  31272. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31273. * @returns {Object} Returns the new inverted object.
  31274. * @example
  31275. *
  31276. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31277. *
  31278. * _.invertBy(object);
  31279. * // => { '1': ['a', 'c'], '2': ['b'] }
  31280. *
  31281. * _.invertBy(object, function(value) {
  31282. * return 'group' + value;
  31283. * });
  31284. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31285. */
  31286. var invertBy = createInverter(function(result, value, key) {
  31287. if (value != null &&
  31288. typeof value.toString != 'function') {
  31289. value = nativeObjectToString.call(value);
  31290. }
  31291. if (hasOwnProperty.call(result, value)) {
  31292. result[value].push(key);
  31293. } else {
  31294. result[value] = [key];
  31295. }
  31296. }, getIteratee);
  31297. /**
  31298. * Invokes the method at `path` of `object`.
  31299. *
  31300. * @static
  31301. * @memberOf _
  31302. * @since 4.0.0
  31303. * @category Object
  31304. * @param {Object} object The object to query.
  31305. * @param {Array|string} path The path of the method to invoke.
  31306. * @param {...*} [args] The arguments to invoke the method with.
  31307. * @returns {*} Returns the result of the invoked method.
  31308. * @example
  31309. *
  31310. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31311. *
  31312. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31313. * // => [2, 3]
  31314. */
  31315. var invoke = baseRest(baseInvoke);
  31316. /**
  31317. * Creates an array of the own enumerable property names of `object`.
  31318. *
  31319. * **Note:** Non-object values are coerced to objects. See the
  31320. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31321. * for more details.
  31322. *
  31323. * @static
  31324. * @since 0.1.0
  31325. * @memberOf _
  31326. * @category Object
  31327. * @param {Object} object The object to query.
  31328. * @returns {Array} Returns the array of property names.
  31329. * @example
  31330. *
  31331. * function Foo() {
  31332. * this.a = 1;
  31333. * this.b = 2;
  31334. * }
  31335. *
  31336. * Foo.prototype.c = 3;
  31337. *
  31338. * _.keys(new Foo);
  31339. * // => ['a', 'b'] (iteration order is not guaranteed)
  31340. *
  31341. * _.keys('hi');
  31342. * // => ['0', '1']
  31343. */
  31344. function keys(object) {
  31345. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31346. }
  31347. /**
  31348. * Creates an array of the own and inherited enumerable property names of `object`.
  31349. *
  31350. * **Note:** Non-object values are coerced to objects.
  31351. *
  31352. * @static
  31353. * @memberOf _
  31354. * @since 3.0.0
  31355. * @category Object
  31356. * @param {Object} object The object to query.
  31357. * @returns {Array} Returns the array of property names.
  31358. * @example
  31359. *
  31360. * function Foo() {
  31361. * this.a = 1;
  31362. * this.b = 2;
  31363. * }
  31364. *
  31365. * Foo.prototype.c = 3;
  31366. *
  31367. * _.keysIn(new Foo);
  31368. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31369. */
  31370. function keysIn(object) {
  31371. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31372. }
  31373. /**
  31374. * The opposite of `_.mapValues`; this method creates an object with the
  31375. * same values as `object` and keys generated by running each own enumerable
  31376. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31377. * with three arguments: (value, key, object).
  31378. *
  31379. * @static
  31380. * @memberOf _
  31381. * @since 3.8.0
  31382. * @category Object
  31383. * @param {Object} object The object to iterate over.
  31384. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31385. * @returns {Object} Returns the new mapped object.
  31386. * @see _.mapValues
  31387. * @example
  31388. *
  31389. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31390. * return key + value;
  31391. * });
  31392. * // => { 'a1': 1, 'b2': 2 }
  31393. */
  31394. function mapKeys(object, iteratee) {
  31395. var result = {};
  31396. iteratee = getIteratee(iteratee, 3);
  31397. baseForOwn(object, function(value, key, object) {
  31398. baseAssignValue(result, iteratee(value, key, object), value);
  31399. });
  31400. return result;
  31401. }
  31402. /**
  31403. * Creates an object with the same keys as `object` and values generated
  31404. * by running each own enumerable string keyed property of `object` thru
  31405. * `iteratee`. The iteratee is invoked with three arguments:
  31406. * (value, key, object).
  31407. *
  31408. * @static
  31409. * @memberOf _
  31410. * @since 2.4.0
  31411. * @category Object
  31412. * @param {Object} object The object to iterate over.
  31413. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31414. * @returns {Object} Returns the new mapped object.
  31415. * @see _.mapKeys
  31416. * @example
  31417. *
  31418. * var users = {
  31419. * 'fred': { 'user': 'fred', 'age': 40 },
  31420. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31421. * };
  31422. *
  31423. * _.mapValues(users, function(o) { return o.age; });
  31424. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31425. *
  31426. * // The `_.property` iteratee shorthand.
  31427. * _.mapValues(users, 'age');
  31428. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31429. */
  31430. function mapValues(object, iteratee) {
  31431. var result = {};
  31432. iteratee = getIteratee(iteratee, 3);
  31433. baseForOwn(object, function(value, key, object) {
  31434. baseAssignValue(result, key, iteratee(value, key, object));
  31435. });
  31436. return result;
  31437. }
  31438. /**
  31439. * This method is like `_.assign` except that it recursively merges own and
  31440. * inherited enumerable string keyed properties of source objects into the
  31441. * destination object. Source properties that resolve to `undefined` are
  31442. * skipped if a destination value exists. Array and plain object properties
  31443. * are merged recursively. Other objects and value types are overridden by
  31444. * assignment. Source objects are applied from left to right. Subsequent
  31445. * sources overwrite property assignments of previous sources.
  31446. *
  31447. * **Note:** This method mutates `object`.
  31448. *
  31449. * @static
  31450. * @memberOf _
  31451. * @since 0.5.0
  31452. * @category Object
  31453. * @param {Object} object The destination object.
  31454. * @param {...Object} [sources] The source objects.
  31455. * @returns {Object} Returns `object`.
  31456. * @example
  31457. *
  31458. * var object = {
  31459. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31460. * };
  31461. *
  31462. * var other = {
  31463. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31464. * };
  31465. *
  31466. * _.merge(object, other);
  31467. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31468. */
  31469. var merge = createAssigner(function(object, source, srcIndex) {
  31470. baseMerge(object, source, srcIndex);
  31471. });
  31472. /**
  31473. * This method is like `_.merge` except that it accepts `customizer` which
  31474. * is invoked to produce the merged values of the destination and source
  31475. * properties. If `customizer` returns `undefined`, merging is handled by the
  31476. * method instead. The `customizer` is invoked with six arguments:
  31477. * (objValue, srcValue, key, object, source, stack).
  31478. *
  31479. * **Note:** This method mutates `object`.
  31480. *
  31481. * @static
  31482. * @memberOf _
  31483. * @since 4.0.0
  31484. * @category Object
  31485. * @param {Object} object The destination object.
  31486. * @param {...Object} sources The source objects.
  31487. * @param {Function} customizer The function to customize assigned values.
  31488. * @returns {Object} Returns `object`.
  31489. * @example
  31490. *
  31491. * function customizer(objValue, srcValue) {
  31492. * if (_.isArray(objValue)) {
  31493. * return objValue.concat(srcValue);
  31494. * }
  31495. * }
  31496. *
  31497. * var object = { 'a': [1], 'b': [2] };
  31498. * var other = { 'a': [3], 'b': [4] };
  31499. *
  31500. * _.mergeWith(object, other, customizer);
  31501. * // => { 'a': [1, 3], 'b': [2, 4] }
  31502. */
  31503. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31504. baseMerge(object, source, srcIndex, customizer);
  31505. });
  31506. /**
  31507. * The opposite of `_.pick`; this method creates an object composed of the
  31508. * own and inherited enumerable property paths of `object` that are not omitted.
  31509. *
  31510. * **Note:** This method is considerably slower than `_.pick`.
  31511. *
  31512. * @static
  31513. * @since 0.1.0
  31514. * @memberOf _
  31515. * @category Object
  31516. * @param {Object} object The source object.
  31517. * @param {...(string|string[])} [paths] The property paths to omit.
  31518. * @returns {Object} Returns the new object.
  31519. * @example
  31520. *
  31521. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31522. *
  31523. * _.omit(object, ['a', 'c']);
  31524. * // => { 'b': '2' }
  31525. */
  31526. var omit = flatRest(function(object, paths) {
  31527. var result = {};
  31528. if (object == null) {
  31529. return result;
  31530. }
  31531. var isDeep = false;
  31532. paths = arrayMap(paths, function(path) {
  31533. path = castPath(path, object);
  31534. isDeep || (isDeep = path.length > 1);
  31535. return path;
  31536. });
  31537. copyObject(object, getAllKeysIn(object), result);
  31538. if (isDeep) {
  31539. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31540. }
  31541. var length = paths.length;
  31542. while (length--) {
  31543. baseUnset(result, paths[length]);
  31544. }
  31545. return result;
  31546. });
  31547. /**
  31548. * The opposite of `_.pickBy`; this method creates an object composed of
  31549. * the own and inherited enumerable string keyed properties of `object` that
  31550. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31551. * arguments: (value, key).
  31552. *
  31553. * @static
  31554. * @memberOf _
  31555. * @since 4.0.0
  31556. * @category Object
  31557. * @param {Object} object The source object.
  31558. * @param {Function} [predicate=_.identity] The function invoked per property.
  31559. * @returns {Object} Returns the new object.
  31560. * @example
  31561. *
  31562. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31563. *
  31564. * _.omitBy(object, _.isNumber);
  31565. * // => { 'b': '2' }
  31566. */
  31567. function omitBy(object, predicate) {
  31568. return pickBy(object, negate(getIteratee(predicate)));
  31569. }
  31570. /**
  31571. * Creates an object composed of the picked `object` properties.
  31572. *
  31573. * @static
  31574. * @since 0.1.0
  31575. * @memberOf _
  31576. * @category Object
  31577. * @param {Object} object The source object.
  31578. * @param {...(string|string[])} [paths] The property paths to pick.
  31579. * @returns {Object} Returns the new object.
  31580. * @example
  31581. *
  31582. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31583. *
  31584. * _.pick(object, ['a', 'c']);
  31585. * // => { 'a': 1, 'c': 3 }
  31586. */
  31587. var pick = flatRest(function(object, paths) {
  31588. return object == null ? {} : basePick(object, paths);
  31589. });
  31590. /**
  31591. * Creates an object composed of the `object` properties `predicate` returns
  31592. * truthy for. The predicate is invoked with two arguments: (value, key).
  31593. *
  31594. * @static
  31595. * @memberOf _
  31596. * @since 4.0.0
  31597. * @category Object
  31598. * @param {Object} object The source object.
  31599. * @param {Function} [predicate=_.identity] The function invoked per property.
  31600. * @returns {Object} Returns the new object.
  31601. * @example
  31602. *
  31603. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31604. *
  31605. * _.pickBy(object, _.isNumber);
  31606. * // => { 'a': 1, 'c': 3 }
  31607. */
  31608. function pickBy(object, predicate) {
  31609. if (object == null) {
  31610. return {};
  31611. }
  31612. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31613. return [prop];
  31614. });
  31615. predicate = getIteratee(predicate);
  31616. return basePickBy(object, props, function(value, path) {
  31617. return predicate(value, path[0]);
  31618. });
  31619. }
  31620. /**
  31621. * This method is like `_.get` except that if the resolved value is a
  31622. * function it's invoked with the `this` binding of its parent object and
  31623. * its result is returned.
  31624. *
  31625. * @static
  31626. * @since 0.1.0
  31627. * @memberOf _
  31628. * @category Object
  31629. * @param {Object} object The object to query.
  31630. * @param {Array|string} path The path of the property to resolve.
  31631. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31632. * @returns {*} Returns the resolved value.
  31633. * @example
  31634. *
  31635. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31636. *
  31637. * _.result(object, 'a[0].b.c1');
  31638. * // => 3
  31639. *
  31640. * _.result(object, 'a[0].b.c2');
  31641. * // => 4
  31642. *
  31643. * _.result(object, 'a[0].b.c3', 'default');
  31644. * // => 'default'
  31645. *
  31646. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31647. * // => 'default'
  31648. */
  31649. function result(object, path, defaultValue) {
  31650. path = castPath(path, object);
  31651. var index = -1,
  31652. length = path.length;
  31653. // Ensure the loop is entered when path is empty.
  31654. if (!length) {
  31655. length = 1;
  31656. object = undefined;
  31657. }
  31658. while (++index < length) {
  31659. var value = object == null ? undefined : object[toKey(path[index])];
  31660. if (value === undefined) {
  31661. index = length;
  31662. value = defaultValue;
  31663. }
  31664. object = isFunction(value) ? value.call(object) : value;
  31665. }
  31666. return object;
  31667. }
  31668. /**
  31669. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31670. * it's created. Arrays are created for missing index properties while objects
  31671. * are created for all other missing properties. Use `_.setWith` to customize
  31672. * `path` creation.
  31673. *
  31674. * **Note:** This method mutates `object`.
  31675. *
  31676. * @static
  31677. * @memberOf _
  31678. * @since 3.7.0
  31679. * @category Object
  31680. * @param {Object} object The object to modify.
  31681. * @param {Array|string} path The path of the property to set.
  31682. * @param {*} value The value to set.
  31683. * @returns {Object} Returns `object`.
  31684. * @example
  31685. *
  31686. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31687. *
  31688. * _.set(object, 'a[0].b.c', 4);
  31689. * console.log(object.a[0].b.c);
  31690. * // => 4
  31691. *
  31692. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31693. * console.log(object.x[0].y.z);
  31694. * // => 5
  31695. */
  31696. function set(object, path, value) {
  31697. return object == null ? object : baseSet(object, path, value);
  31698. }
  31699. /**
  31700. * This method is like `_.set` except that it accepts `customizer` which is
  31701. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31702. * path creation is handled by the method instead. The `customizer` is invoked
  31703. * with three arguments: (nsValue, key, nsObject).
  31704. *
  31705. * **Note:** This method mutates `object`.
  31706. *
  31707. * @static
  31708. * @memberOf _
  31709. * @since 4.0.0
  31710. * @category Object
  31711. * @param {Object} object The object to modify.
  31712. * @param {Array|string} path The path of the property to set.
  31713. * @param {*} value The value to set.
  31714. * @param {Function} [customizer] The function to customize assigned values.
  31715. * @returns {Object} Returns `object`.
  31716. * @example
  31717. *
  31718. * var object = {};
  31719. *
  31720. * _.setWith(object, '[0][1]', 'a', Object);
  31721. * // => { '0': { '1': 'a' } }
  31722. */
  31723. function setWith(object, path, value, customizer) {
  31724. customizer = typeof customizer == 'function' ? customizer : undefined;
  31725. return object == null ? object : baseSet(object, path, value, customizer);
  31726. }
  31727. /**
  31728. * Creates an array of own enumerable string keyed-value pairs for `object`
  31729. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31730. * entries are returned.
  31731. *
  31732. * @static
  31733. * @memberOf _
  31734. * @since 4.0.0
  31735. * @alias entries
  31736. * @category Object
  31737. * @param {Object} object The object to query.
  31738. * @returns {Array} Returns the key-value pairs.
  31739. * @example
  31740. *
  31741. * function Foo() {
  31742. * this.a = 1;
  31743. * this.b = 2;
  31744. * }
  31745. *
  31746. * Foo.prototype.c = 3;
  31747. *
  31748. * _.toPairs(new Foo);
  31749. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31750. */
  31751. var toPairs = createToPairs(keys);
  31752. /**
  31753. * Creates an array of own and inherited enumerable string keyed-value pairs
  31754. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31755. * or set, its entries are returned.
  31756. *
  31757. * @static
  31758. * @memberOf _
  31759. * @since 4.0.0
  31760. * @alias entriesIn
  31761. * @category Object
  31762. * @param {Object} object The object to query.
  31763. * @returns {Array} Returns the key-value pairs.
  31764. * @example
  31765. *
  31766. * function Foo() {
  31767. * this.a = 1;
  31768. * this.b = 2;
  31769. * }
  31770. *
  31771. * Foo.prototype.c = 3;
  31772. *
  31773. * _.toPairsIn(new Foo);
  31774. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31775. */
  31776. var toPairsIn = createToPairs(keysIn);
  31777. /**
  31778. * An alternative to `_.reduce`; this method transforms `object` to a new
  31779. * `accumulator` object which is the result of running each of its own
  31780. * enumerable string keyed properties thru `iteratee`, with each invocation
  31781. * potentially mutating the `accumulator` object. If `accumulator` is not
  31782. * provided, a new object with the same `[[Prototype]]` will be used. The
  31783. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31784. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31785. *
  31786. * @static
  31787. * @memberOf _
  31788. * @since 1.3.0
  31789. * @category Object
  31790. * @param {Object} object The object to iterate over.
  31791. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31792. * @param {*} [accumulator] The custom accumulator value.
  31793. * @returns {*} Returns the accumulated value.
  31794. * @example
  31795. *
  31796. * _.transform([2, 3, 4], function(result, n) {
  31797. * result.push(n *= n);
  31798. * return n % 2 == 0;
  31799. * }, []);
  31800. * // => [4, 9]
  31801. *
  31802. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31803. * (result[value] || (result[value] = [])).push(key);
  31804. * }, {});
  31805. * // => { '1': ['a', 'c'], '2': ['b'] }
  31806. */
  31807. function transform(object, iteratee, accumulator) {
  31808. var isArr = isArray(object),
  31809. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31810. iteratee = getIteratee(iteratee, 4);
  31811. if (accumulator == null) {
  31812. var Ctor = object && object.constructor;
  31813. if (isArrLike) {
  31814. accumulator = isArr ? new Ctor : [];
  31815. }
  31816. else if (isObject(object)) {
  31817. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31818. }
  31819. else {
  31820. accumulator = {};
  31821. }
  31822. }
  31823. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31824. return iteratee(accumulator, value, index, object);
  31825. });
  31826. return accumulator;
  31827. }
  31828. /**
  31829. * Removes the property at `path` of `object`.
  31830. *
  31831. * **Note:** This method mutates `object`.
  31832. *
  31833. * @static
  31834. * @memberOf _
  31835. * @since 4.0.0
  31836. * @category Object
  31837. * @param {Object} object The object to modify.
  31838. * @param {Array|string} path The path of the property to unset.
  31839. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31840. * @example
  31841. *
  31842. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31843. * _.unset(object, 'a[0].b.c');
  31844. * // => true
  31845. *
  31846. * console.log(object);
  31847. * // => { 'a': [{ 'b': {} }] };
  31848. *
  31849. * _.unset(object, ['a', '0', 'b', 'c']);
  31850. * // => true
  31851. *
  31852. * console.log(object);
  31853. * // => { 'a': [{ 'b': {} }] };
  31854. */
  31855. function unset(object, path) {
  31856. return object == null ? true : baseUnset(object, path);
  31857. }
  31858. /**
  31859. * This method is like `_.set` except that accepts `updater` to produce the
  31860. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31861. * is invoked with one argument: (value).
  31862. *
  31863. * **Note:** This method mutates `object`.
  31864. *
  31865. * @static
  31866. * @memberOf _
  31867. * @since 4.6.0
  31868. * @category Object
  31869. * @param {Object} object The object to modify.
  31870. * @param {Array|string} path The path of the property to set.
  31871. * @param {Function} updater The function to produce the updated value.
  31872. * @returns {Object} Returns `object`.
  31873. * @example
  31874. *
  31875. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31876. *
  31877. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31878. * console.log(object.a[0].b.c);
  31879. * // => 9
  31880. *
  31881. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31882. * console.log(object.x[0].y.z);
  31883. * // => 0
  31884. */
  31885. function update(object, path, updater) {
  31886. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31887. }
  31888. /**
  31889. * This method is like `_.update` except that it accepts `customizer` which is
  31890. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31891. * path creation is handled by the method instead. The `customizer` is invoked
  31892. * with three arguments: (nsValue, key, nsObject).
  31893. *
  31894. * **Note:** This method mutates `object`.
  31895. *
  31896. * @static
  31897. * @memberOf _
  31898. * @since 4.6.0
  31899. * @category Object
  31900. * @param {Object} object The object to modify.
  31901. * @param {Array|string} path The path of the property to set.
  31902. * @param {Function} updater The function to produce the updated value.
  31903. * @param {Function} [customizer] The function to customize assigned values.
  31904. * @returns {Object} Returns `object`.
  31905. * @example
  31906. *
  31907. * var object = {};
  31908. *
  31909. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31910. * // => { '0': { '1': 'a' } }
  31911. */
  31912. function updateWith(object, path, updater, customizer) {
  31913. customizer = typeof customizer == 'function' ? customizer : undefined;
  31914. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31915. }
  31916. /**
  31917. * Creates an array of the own enumerable string keyed property values of `object`.
  31918. *
  31919. * **Note:** Non-object values are coerced to objects.
  31920. *
  31921. * @static
  31922. * @since 0.1.0
  31923. * @memberOf _
  31924. * @category Object
  31925. * @param {Object} object The object to query.
  31926. * @returns {Array} Returns the array of property values.
  31927. * @example
  31928. *
  31929. * function Foo() {
  31930. * this.a = 1;
  31931. * this.b = 2;
  31932. * }
  31933. *
  31934. * Foo.prototype.c = 3;
  31935. *
  31936. * _.values(new Foo);
  31937. * // => [1, 2] (iteration order is not guaranteed)
  31938. *
  31939. * _.values('hi');
  31940. * // => ['h', 'i']
  31941. */
  31942. function values(object) {
  31943. return object == null ? [] : baseValues(object, keys(object));
  31944. }
  31945. /**
  31946. * Creates an array of the own and inherited enumerable string keyed property
  31947. * values of `object`.
  31948. *
  31949. * **Note:** Non-object values are coerced to objects.
  31950. *
  31951. * @static
  31952. * @memberOf _
  31953. * @since 3.0.0
  31954. * @category Object
  31955. * @param {Object} object The object to query.
  31956. * @returns {Array} Returns the array of property values.
  31957. * @example
  31958. *
  31959. * function Foo() {
  31960. * this.a = 1;
  31961. * this.b = 2;
  31962. * }
  31963. *
  31964. * Foo.prototype.c = 3;
  31965. *
  31966. * _.valuesIn(new Foo);
  31967. * // => [1, 2, 3] (iteration order is not guaranteed)
  31968. */
  31969. function valuesIn(object) {
  31970. return object == null ? [] : baseValues(object, keysIn(object));
  31971. }
  31972. /*------------------------------------------------------------------------*/
  31973. /**
  31974. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31975. *
  31976. * @static
  31977. * @memberOf _
  31978. * @since 4.0.0
  31979. * @category Number
  31980. * @param {number} number The number to clamp.
  31981. * @param {number} [lower] The lower bound.
  31982. * @param {number} upper The upper bound.
  31983. * @returns {number} Returns the clamped number.
  31984. * @example
  31985. *
  31986. * _.clamp(-10, -5, 5);
  31987. * // => -5
  31988. *
  31989. * _.clamp(10, -5, 5);
  31990. * // => 5
  31991. */
  31992. function clamp(number, lower, upper) {
  31993. if (upper === undefined) {
  31994. upper = lower;
  31995. lower = undefined;
  31996. }
  31997. if (upper !== undefined) {
  31998. upper = toNumber(upper);
  31999. upper = upper === upper ? upper : 0;
  32000. }
  32001. if (lower !== undefined) {
  32002. lower = toNumber(lower);
  32003. lower = lower === lower ? lower : 0;
  32004. }
  32005. return baseClamp(toNumber(number), lower, upper);
  32006. }
  32007. /**
  32008. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32009. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32010. * If `start` is greater than `end` the params are swapped to support
  32011. * negative ranges.
  32012. *
  32013. * @static
  32014. * @memberOf _
  32015. * @since 3.3.0
  32016. * @category Number
  32017. * @param {number} number The number to check.
  32018. * @param {number} [start=0] The start of the range.
  32019. * @param {number} end The end of the range.
  32020. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32021. * @see _.range, _.rangeRight
  32022. * @example
  32023. *
  32024. * _.inRange(3, 2, 4);
  32025. * // => true
  32026. *
  32027. * _.inRange(4, 8);
  32028. * // => true
  32029. *
  32030. * _.inRange(4, 2);
  32031. * // => false
  32032. *
  32033. * _.inRange(2, 2);
  32034. * // => false
  32035. *
  32036. * _.inRange(1.2, 2);
  32037. * // => true
  32038. *
  32039. * _.inRange(5.2, 4);
  32040. * // => false
  32041. *
  32042. * _.inRange(-3, -2, -6);
  32043. * // => true
  32044. */
  32045. function inRange(number, start, end) {
  32046. start = toFinite(start);
  32047. if (end === undefined) {
  32048. end = start;
  32049. start = 0;
  32050. } else {
  32051. end = toFinite(end);
  32052. }
  32053. number = toNumber(number);
  32054. return baseInRange(number, start, end);
  32055. }
  32056. /**
  32057. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32058. * If only one argument is provided a number between `0` and the given number
  32059. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32060. * floats, a floating-point number is returned instead of an integer.
  32061. *
  32062. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32063. * floating-point values which can produce unexpected results.
  32064. *
  32065. * @static
  32066. * @memberOf _
  32067. * @since 0.7.0
  32068. * @category Number
  32069. * @param {number} [lower=0] The lower bound.
  32070. * @param {number} [upper=1] The upper bound.
  32071. * @param {boolean} [floating] Specify returning a floating-point number.
  32072. * @returns {number} Returns the random number.
  32073. * @example
  32074. *
  32075. * _.random(0, 5);
  32076. * // => an integer between 0 and 5
  32077. *
  32078. * _.random(5);
  32079. * // => also an integer between 0 and 5
  32080. *
  32081. * _.random(5, true);
  32082. * // => a floating-point number between 0 and 5
  32083. *
  32084. * _.random(1.2, 5.2);
  32085. * // => a floating-point number between 1.2 and 5.2
  32086. */
  32087. function random(lower, upper, floating) {
  32088. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32089. upper = floating = undefined;
  32090. }
  32091. if (floating === undefined) {
  32092. if (typeof upper == 'boolean') {
  32093. floating = upper;
  32094. upper = undefined;
  32095. }
  32096. else if (typeof lower == 'boolean') {
  32097. floating = lower;
  32098. lower = undefined;
  32099. }
  32100. }
  32101. if (lower === undefined && upper === undefined) {
  32102. lower = 0;
  32103. upper = 1;
  32104. }
  32105. else {
  32106. lower = toFinite(lower);
  32107. if (upper === undefined) {
  32108. upper = lower;
  32109. lower = 0;
  32110. } else {
  32111. upper = toFinite(upper);
  32112. }
  32113. }
  32114. if (lower > upper) {
  32115. var temp = lower;
  32116. lower = upper;
  32117. upper = temp;
  32118. }
  32119. if (floating || lower % 1 || upper % 1) {
  32120. var rand = nativeRandom();
  32121. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32122. }
  32123. return baseRandom(lower, upper);
  32124. }
  32125. /*------------------------------------------------------------------------*/
  32126. /**
  32127. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32128. *
  32129. * @static
  32130. * @memberOf _
  32131. * @since 3.0.0
  32132. * @category String
  32133. * @param {string} [string=''] The string to convert.
  32134. * @returns {string} Returns the camel cased string.
  32135. * @example
  32136. *
  32137. * _.camelCase('Foo Bar');
  32138. * // => 'fooBar'
  32139. *
  32140. * _.camelCase('--foo-bar--');
  32141. * // => 'fooBar'
  32142. *
  32143. * _.camelCase('__FOO_BAR__');
  32144. * // => 'fooBar'
  32145. */
  32146. var camelCase = createCompounder(function(result, word, index) {
  32147. word = word.toLowerCase();
  32148. return result + (index ? capitalize(word) : word);
  32149. });
  32150. /**
  32151. * Converts the first character of `string` to upper case and the remaining
  32152. * to lower case.
  32153. *
  32154. * @static
  32155. * @memberOf _
  32156. * @since 3.0.0
  32157. * @category String
  32158. * @param {string} [string=''] The string to capitalize.
  32159. * @returns {string} Returns the capitalized string.
  32160. * @example
  32161. *
  32162. * _.capitalize('FRED');
  32163. * // => 'Fred'
  32164. */
  32165. function capitalize(string) {
  32166. return upperFirst(toString(string).toLowerCase());
  32167. }
  32168. /**
  32169. * Deburrs `string` by converting
  32170. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32171. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32172. * letters to basic Latin letters and removing
  32173. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32174. *
  32175. * @static
  32176. * @memberOf _
  32177. * @since 3.0.0
  32178. * @category String
  32179. * @param {string} [string=''] The string to deburr.
  32180. * @returns {string} Returns the deburred string.
  32181. * @example
  32182. *
  32183. * _.deburr('déjà vu');
  32184. * // => 'deja vu'
  32185. */
  32186. function deburr(string) {
  32187. string = toString(string);
  32188. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32189. }
  32190. /**
  32191. * Checks if `string` ends with the given target string.
  32192. *
  32193. * @static
  32194. * @memberOf _
  32195. * @since 3.0.0
  32196. * @category String
  32197. * @param {string} [string=''] The string to inspect.
  32198. * @param {string} [target] The string to search for.
  32199. * @param {number} [position=string.length] The position to search up to.
  32200. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32201. * else `false`.
  32202. * @example
  32203. *
  32204. * _.endsWith('abc', 'c');
  32205. * // => true
  32206. *
  32207. * _.endsWith('abc', 'b');
  32208. * // => false
  32209. *
  32210. * _.endsWith('abc', 'b', 2);
  32211. * // => true
  32212. */
  32213. function endsWith(string, target, position) {
  32214. string = toString(string);
  32215. target = baseToString(target);
  32216. var length = string.length;
  32217. position = position === undefined
  32218. ? length
  32219. : baseClamp(toInteger(position), 0, length);
  32220. var end = position;
  32221. position -= target.length;
  32222. return position >= 0 && string.slice(position, end) == target;
  32223. }
  32224. /**
  32225. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32226. * corresponding HTML entities.
  32227. *
  32228. * **Note:** No other characters are escaped. To escape additional
  32229. * characters use a third-party library like [_he_](https://mths.be/he).
  32230. *
  32231. * Though the ">" character is escaped for symmetry, characters like
  32232. * ">" and "/" don't need escaping in HTML and have no special meaning
  32233. * unless they're part of a tag or unquoted attribute value. See
  32234. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32235. * (under "semi-related fun fact") for more details.
  32236. *
  32237. * When working with HTML you should always
  32238. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32239. * XSS vectors.
  32240. *
  32241. * @static
  32242. * @since 0.1.0
  32243. * @memberOf _
  32244. * @category String
  32245. * @param {string} [string=''] The string to escape.
  32246. * @returns {string} Returns the escaped string.
  32247. * @example
  32248. *
  32249. * _.escape('fred, barney, & pebbles');
  32250. * // => 'fred, barney, &amp; pebbles'
  32251. */
  32252. function escape(string) {
  32253. string = toString(string);
  32254. return (string && reHasUnescapedHtml.test(string))
  32255. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32256. : string;
  32257. }
  32258. /**
  32259. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32260. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32261. *
  32262. * @static
  32263. * @memberOf _
  32264. * @since 3.0.0
  32265. * @category String
  32266. * @param {string} [string=''] The string to escape.
  32267. * @returns {string} Returns the escaped string.
  32268. * @example
  32269. *
  32270. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32271. * // => '\[lodash\]\(https://lodash\.com/\)'
  32272. */
  32273. function escapeRegExp(string) {
  32274. string = toString(string);
  32275. return (string && reHasRegExpChar.test(string))
  32276. ? string.replace(reRegExpChar, '\\$&')
  32277. : string;
  32278. }
  32279. /**
  32280. * Converts `string` to
  32281. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32282. *
  32283. * @static
  32284. * @memberOf _
  32285. * @since 3.0.0
  32286. * @category String
  32287. * @param {string} [string=''] The string to convert.
  32288. * @returns {string} Returns the kebab cased string.
  32289. * @example
  32290. *
  32291. * _.kebabCase('Foo Bar');
  32292. * // => 'foo-bar'
  32293. *
  32294. * _.kebabCase('fooBar');
  32295. * // => 'foo-bar'
  32296. *
  32297. * _.kebabCase('__FOO_BAR__');
  32298. * // => 'foo-bar'
  32299. */
  32300. var kebabCase = createCompounder(function(result, word, index) {
  32301. return result + (index ? '-' : '') + word.toLowerCase();
  32302. });
  32303. /**
  32304. * Converts `string`, as space separated words, to lower case.
  32305. *
  32306. * @static
  32307. * @memberOf _
  32308. * @since 4.0.0
  32309. * @category String
  32310. * @param {string} [string=''] The string to convert.
  32311. * @returns {string} Returns the lower cased string.
  32312. * @example
  32313. *
  32314. * _.lowerCase('--Foo-Bar--');
  32315. * // => 'foo bar'
  32316. *
  32317. * _.lowerCase('fooBar');
  32318. * // => 'foo bar'
  32319. *
  32320. * _.lowerCase('__FOO_BAR__');
  32321. * // => 'foo bar'
  32322. */
  32323. var lowerCase = createCompounder(function(result, word, index) {
  32324. return result + (index ? ' ' : '') + word.toLowerCase();
  32325. });
  32326. /**
  32327. * Converts the first character of `string` to lower case.
  32328. *
  32329. * @static
  32330. * @memberOf _
  32331. * @since 4.0.0
  32332. * @category String
  32333. * @param {string} [string=''] The string to convert.
  32334. * @returns {string} Returns the converted string.
  32335. * @example
  32336. *
  32337. * _.lowerFirst('Fred');
  32338. * // => 'fred'
  32339. *
  32340. * _.lowerFirst('FRED');
  32341. * // => 'fRED'
  32342. */
  32343. var lowerFirst = createCaseFirst('toLowerCase');
  32344. /**
  32345. * Pads `string` on the left and right sides if it's shorter than `length`.
  32346. * Padding characters are truncated if they can't be evenly divided by `length`.
  32347. *
  32348. * @static
  32349. * @memberOf _
  32350. * @since 3.0.0
  32351. * @category String
  32352. * @param {string} [string=''] The string to pad.
  32353. * @param {number} [length=0] The padding length.
  32354. * @param {string} [chars=' '] The string used as padding.
  32355. * @returns {string} Returns the padded string.
  32356. * @example
  32357. *
  32358. * _.pad('abc', 8);
  32359. * // => ' abc '
  32360. *
  32361. * _.pad('abc', 8, '_-');
  32362. * // => '_-abc_-_'
  32363. *
  32364. * _.pad('abc', 3);
  32365. * // => 'abc'
  32366. */
  32367. function pad(string, length, chars) {
  32368. string = toString(string);
  32369. length = toInteger(length);
  32370. var strLength = length ? stringSize(string) : 0;
  32371. if (!length || strLength >= length) {
  32372. return string;
  32373. }
  32374. var mid = (length - strLength) / 2;
  32375. return (
  32376. createPadding(nativeFloor(mid), chars) +
  32377. string +
  32378. createPadding(nativeCeil(mid), chars)
  32379. );
  32380. }
  32381. /**
  32382. * Pads `string` on the right side if it's shorter than `length`. Padding
  32383. * characters are truncated if they exceed `length`.
  32384. *
  32385. * @static
  32386. * @memberOf _
  32387. * @since 4.0.0
  32388. * @category String
  32389. * @param {string} [string=''] The string to pad.
  32390. * @param {number} [length=0] The padding length.
  32391. * @param {string} [chars=' '] The string used as padding.
  32392. * @returns {string} Returns the padded string.
  32393. * @example
  32394. *
  32395. * _.padEnd('abc', 6);
  32396. * // => 'abc '
  32397. *
  32398. * _.padEnd('abc', 6, '_-');
  32399. * // => 'abc_-_'
  32400. *
  32401. * _.padEnd('abc', 3);
  32402. * // => 'abc'
  32403. */
  32404. function padEnd(string, length, chars) {
  32405. string = toString(string);
  32406. length = toInteger(length);
  32407. var strLength = length ? stringSize(string) : 0;
  32408. return (length && strLength < length)
  32409. ? (string + createPadding(length - strLength, chars))
  32410. : string;
  32411. }
  32412. /**
  32413. * Pads `string` on the left side if it's shorter than `length`. Padding
  32414. * characters are truncated if they exceed `length`.
  32415. *
  32416. * @static
  32417. * @memberOf _
  32418. * @since 4.0.0
  32419. * @category String
  32420. * @param {string} [string=''] The string to pad.
  32421. * @param {number} [length=0] The padding length.
  32422. * @param {string} [chars=' '] The string used as padding.
  32423. * @returns {string} Returns the padded string.
  32424. * @example
  32425. *
  32426. * _.padStart('abc', 6);
  32427. * // => ' abc'
  32428. *
  32429. * _.padStart('abc', 6, '_-');
  32430. * // => '_-_abc'
  32431. *
  32432. * _.padStart('abc', 3);
  32433. * // => 'abc'
  32434. */
  32435. function padStart(string, length, chars) {
  32436. string = toString(string);
  32437. length = toInteger(length);
  32438. var strLength = length ? stringSize(string) : 0;
  32439. return (length && strLength < length)
  32440. ? (createPadding(length - strLength, chars) + string)
  32441. : string;
  32442. }
  32443. /**
  32444. * Converts `string` to an integer of the specified radix. If `radix` is
  32445. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32446. * hexadecimal, in which case a `radix` of `16` is used.
  32447. *
  32448. * **Note:** This method aligns with the
  32449. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32450. *
  32451. * @static
  32452. * @memberOf _
  32453. * @since 1.1.0
  32454. * @category String
  32455. * @param {string} string The string to convert.
  32456. * @param {number} [radix=10] The radix to interpret `value` by.
  32457. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32458. * @returns {number} Returns the converted integer.
  32459. * @example
  32460. *
  32461. * _.parseInt('08');
  32462. * // => 8
  32463. *
  32464. * _.map(['6', '08', '10'], _.parseInt);
  32465. * // => [6, 8, 10]
  32466. */
  32467. function parseInt(string, radix, guard) {
  32468. if (guard || radix == null) {
  32469. radix = 0;
  32470. } else if (radix) {
  32471. radix = +radix;
  32472. }
  32473. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32474. }
  32475. /**
  32476. * Repeats the given string `n` times.
  32477. *
  32478. * @static
  32479. * @memberOf _
  32480. * @since 3.0.0
  32481. * @category String
  32482. * @param {string} [string=''] The string to repeat.
  32483. * @param {number} [n=1] The number of times to repeat the string.
  32484. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32485. * @returns {string} Returns the repeated string.
  32486. * @example
  32487. *
  32488. * _.repeat('*', 3);
  32489. * // => '***'
  32490. *
  32491. * _.repeat('abc', 2);
  32492. * // => 'abcabc'
  32493. *
  32494. * _.repeat('abc', 0);
  32495. * // => ''
  32496. */
  32497. function repeat(string, n, guard) {
  32498. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32499. n = 1;
  32500. } else {
  32501. n = toInteger(n);
  32502. }
  32503. return baseRepeat(toString(string), n);
  32504. }
  32505. /**
  32506. * Replaces matches for `pattern` in `string` with `replacement`.
  32507. *
  32508. * **Note:** This method is based on
  32509. * [`String#replace`](https://mdn.io/String/replace).
  32510. *
  32511. * @static
  32512. * @memberOf _
  32513. * @since 4.0.0
  32514. * @category String
  32515. * @param {string} [string=''] The string to modify.
  32516. * @param {RegExp|string} pattern The pattern to replace.
  32517. * @param {Function|string} replacement The match replacement.
  32518. * @returns {string} Returns the modified string.
  32519. * @example
  32520. *
  32521. * _.replace('Hi Fred', 'Fred', 'Barney');
  32522. * // => 'Hi Barney'
  32523. */
  32524. function replace() {
  32525. var args = arguments,
  32526. string = toString(args[0]);
  32527. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32528. }
  32529. /**
  32530. * Converts `string` to
  32531. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32532. *
  32533. * @static
  32534. * @memberOf _
  32535. * @since 3.0.0
  32536. * @category String
  32537. * @param {string} [string=''] The string to convert.
  32538. * @returns {string} Returns the snake cased string.
  32539. * @example
  32540. *
  32541. * _.snakeCase('Foo Bar');
  32542. * // => 'foo_bar'
  32543. *
  32544. * _.snakeCase('fooBar');
  32545. * // => 'foo_bar'
  32546. *
  32547. * _.snakeCase('--FOO-BAR--');
  32548. * // => 'foo_bar'
  32549. */
  32550. var snakeCase = createCompounder(function(result, word, index) {
  32551. return result + (index ? '_' : '') + word.toLowerCase();
  32552. });
  32553. /**
  32554. * Splits `string` by `separator`.
  32555. *
  32556. * **Note:** This method is based on
  32557. * [`String#split`](https://mdn.io/String/split).
  32558. *
  32559. * @static
  32560. * @memberOf _
  32561. * @since 4.0.0
  32562. * @category String
  32563. * @param {string} [string=''] The string to split.
  32564. * @param {RegExp|string} separator The separator pattern to split by.
  32565. * @param {number} [limit] The length to truncate results to.
  32566. * @returns {Array} Returns the string segments.
  32567. * @example
  32568. *
  32569. * _.split('a-b-c', '-', 2);
  32570. * // => ['a', 'b']
  32571. */
  32572. function split(string, separator, limit) {
  32573. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32574. separator = limit = undefined;
  32575. }
  32576. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32577. if (!limit) {
  32578. return [];
  32579. }
  32580. string = toString(string);
  32581. if (string && (
  32582. typeof separator == 'string' ||
  32583. (separator != null && !isRegExp(separator))
  32584. )) {
  32585. separator = baseToString(separator);
  32586. if (!separator && hasUnicode(string)) {
  32587. return castSlice(stringToArray(string), 0, limit);
  32588. }
  32589. }
  32590. return string.split(separator, limit);
  32591. }
  32592. /**
  32593. * Converts `string` to
  32594. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32595. *
  32596. * @static
  32597. * @memberOf _
  32598. * @since 3.1.0
  32599. * @category String
  32600. * @param {string} [string=''] The string to convert.
  32601. * @returns {string} Returns the start cased string.
  32602. * @example
  32603. *
  32604. * _.startCase('--foo-bar--');
  32605. * // => 'Foo Bar'
  32606. *
  32607. * _.startCase('fooBar');
  32608. * // => 'Foo Bar'
  32609. *
  32610. * _.startCase('__FOO_BAR__');
  32611. * // => 'FOO BAR'
  32612. */
  32613. var startCase = createCompounder(function(result, word, index) {
  32614. return result + (index ? ' ' : '') + upperFirst(word);
  32615. });
  32616. /**
  32617. * Checks if `string` starts with the given target string.
  32618. *
  32619. * @static
  32620. * @memberOf _
  32621. * @since 3.0.0
  32622. * @category String
  32623. * @param {string} [string=''] The string to inspect.
  32624. * @param {string} [target] The string to search for.
  32625. * @param {number} [position=0] The position to search from.
  32626. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32627. * else `false`.
  32628. * @example
  32629. *
  32630. * _.startsWith('abc', 'a');
  32631. * // => true
  32632. *
  32633. * _.startsWith('abc', 'b');
  32634. * // => false
  32635. *
  32636. * _.startsWith('abc', 'b', 1);
  32637. * // => true
  32638. */
  32639. function startsWith(string, target, position) {
  32640. string = toString(string);
  32641. position = position == null
  32642. ? 0
  32643. : baseClamp(toInteger(position), 0, string.length);
  32644. target = baseToString(target);
  32645. return string.slice(position, position + target.length) == target;
  32646. }
  32647. /**
  32648. * Creates a compiled template function that can interpolate data properties
  32649. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32650. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32651. * properties may be accessed as free variables in the template. If a setting
  32652. * object is given, it takes precedence over `_.templateSettings` values.
  32653. *
  32654. * **Note:** In the development build `_.template` utilizes
  32655. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32656. * for easier debugging.
  32657. *
  32658. * For more information on precompiling templates see
  32659. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32660. *
  32661. * For more information on Chrome extension sandboxes see
  32662. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32663. *
  32664. * @static
  32665. * @since 0.1.0
  32666. * @memberOf _
  32667. * @category String
  32668. * @param {string} [string=''] The template string.
  32669. * @param {Object} [options={}] The options object.
  32670. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32671. * The HTML "escape" delimiter.
  32672. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32673. * The "evaluate" delimiter.
  32674. * @param {Object} [options.imports=_.templateSettings.imports]
  32675. * An object to import into the template as free variables.
  32676. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32677. * The "interpolate" delimiter.
  32678. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32679. * The sourceURL of the compiled template.
  32680. * @param {string} [options.variable='obj']
  32681. * The data object variable name.
  32682. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32683. * @returns {Function} Returns the compiled template function.
  32684. * @example
  32685. *
  32686. * // Use the "interpolate" delimiter to create a compiled template.
  32687. * var compiled = _.template('hello <%= user %>!');
  32688. * compiled({ 'user': 'fred' });
  32689. * // => 'hello fred!'
  32690. *
  32691. * // Use the HTML "escape" delimiter to escape data property values.
  32692. * var compiled = _.template('<b><%- value %></b>');
  32693. * compiled({ 'value': '<script>' });
  32694. * // => '<b>&lt;script&gt;</b>'
  32695. *
  32696. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32697. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32698. * compiled({ 'users': ['fred', 'barney'] });
  32699. * // => '<li>fred</li><li>barney</li>'
  32700. *
  32701. * // Use the internal `print` function in "evaluate" delimiters.
  32702. * var compiled = _.template('<% print("hello " + user); %>!');
  32703. * compiled({ 'user': 'barney' });
  32704. * // => 'hello barney!'
  32705. *
  32706. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32707. * // Disable support by replacing the "interpolate" delimiter.
  32708. * var compiled = _.template('hello ${ user }!');
  32709. * compiled({ 'user': 'pebbles' });
  32710. * // => 'hello pebbles!'
  32711. *
  32712. * // Use backslashes to treat delimiters as plain text.
  32713. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32714. * compiled({ 'value': 'ignored' });
  32715. * // => '<%- value %>'
  32716. *
  32717. * // Use the `imports` option to import `jQuery` as `jq`.
  32718. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32719. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32720. * compiled({ 'users': ['fred', 'barney'] });
  32721. * // => '<li>fred</li><li>barney</li>'
  32722. *
  32723. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32724. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32725. * compiled(data);
  32726. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32727. *
  32728. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32729. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32730. * compiled.source;
  32731. * // => function(data) {
  32732. * // var __t, __p = '';
  32733. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32734. * // return __p;
  32735. * // }
  32736. *
  32737. * // Use custom template delimiters.
  32738. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32739. * var compiled = _.template('hello {{ user }}!');
  32740. * compiled({ 'user': 'mustache' });
  32741. * // => 'hello mustache!'
  32742. *
  32743. * // Use the `source` property to inline compiled templates for meaningful
  32744. * // line numbers in error messages and stack traces.
  32745. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32746. * var JST = {\
  32747. * "main": ' + _.template(mainText).source + '\
  32748. * };\
  32749. * ');
  32750. */
  32751. function template(string, options, guard) {
  32752. // Based on John Resig's `tmpl` implementation
  32753. // (http://ejohn.org/blog/javascript-micro-templating/)
  32754. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32755. var settings = lodash.templateSettings;
  32756. if (guard && isIterateeCall(string, options, guard)) {
  32757. options = undefined;
  32758. }
  32759. string = toString(string);
  32760. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32761. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32762. importsKeys = keys(imports),
  32763. importsValues = baseValues(imports, importsKeys);
  32764. var isEscaping,
  32765. isEvaluating,
  32766. index = 0,
  32767. interpolate = options.interpolate || reNoMatch,
  32768. source = "__p += '";
  32769. // Compile the regexp to match each delimiter.
  32770. var reDelimiters = RegExp(
  32771. (options.escape || reNoMatch).source + '|' +
  32772. interpolate.source + '|' +
  32773. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32774. (options.evaluate || reNoMatch).source + '|$'
  32775. , 'g');
  32776. // Use a sourceURL for easier debugging.
  32777. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32778. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32779. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32780. var sourceURL = '//# sourceURL=' +
  32781. (hasOwnProperty.call(options, 'sourceURL')
  32782. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32783. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32784. ) + '\n';
  32785. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32786. interpolateValue || (interpolateValue = esTemplateValue);
  32787. // Escape characters that can't be included in string literals.
  32788. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32789. // Replace delimiters with snippets.
  32790. if (escapeValue) {
  32791. isEscaping = true;
  32792. source += "' +\n__e(" + escapeValue + ") +\n'";
  32793. }
  32794. if (evaluateValue) {
  32795. isEvaluating = true;
  32796. source += "';\n" + evaluateValue + ";\n__p += '";
  32797. }
  32798. if (interpolateValue) {
  32799. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32800. }
  32801. index = offset + match.length;
  32802. // The JS engine embedded in Adobe products needs `match` returned in
  32803. // order to produce the correct `offset` value.
  32804. return match;
  32805. });
  32806. source += "';\n";
  32807. // If `variable` is not specified wrap a with-statement around the generated
  32808. // code to add the data object to the top of the scope chain.
  32809. // Like with sourceURL, we take care to not check the option's prototype,
  32810. // as this configuration is a code injection vector.
  32811. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32812. if (!variable) {
  32813. source = 'with (obj) {\n' + source + '\n}\n';
  32814. }
  32815. // Cleanup code by stripping empty strings.
  32816. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32817. .replace(reEmptyStringMiddle, '$1')
  32818. .replace(reEmptyStringTrailing, '$1;');
  32819. // Frame code as the function body.
  32820. source = 'function(' + (variable || 'obj') + ') {\n' +
  32821. (variable
  32822. ? ''
  32823. : 'obj || (obj = {});\n'
  32824. ) +
  32825. "var __t, __p = ''" +
  32826. (isEscaping
  32827. ? ', __e = _.escape'
  32828. : ''
  32829. ) +
  32830. (isEvaluating
  32831. ? ', __j = Array.prototype.join;\n' +
  32832. "function print() { __p += __j.call(arguments, '') }\n"
  32833. : ';\n'
  32834. ) +
  32835. source +
  32836. 'return __p\n}';
  32837. var result = attempt(function() {
  32838. return Function(importsKeys, sourceURL + 'return ' + source)
  32839. .apply(undefined, importsValues);
  32840. });
  32841. // Provide the compiled function's source by its `toString` method or
  32842. // the `source` property as a convenience for inlining compiled templates.
  32843. result.source = source;
  32844. if (isError(result)) {
  32845. throw result;
  32846. }
  32847. return result;
  32848. }
  32849. /**
  32850. * Converts `string`, as a whole, to lower case just like
  32851. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32852. *
  32853. * @static
  32854. * @memberOf _
  32855. * @since 4.0.0
  32856. * @category String
  32857. * @param {string} [string=''] The string to convert.
  32858. * @returns {string} Returns the lower cased string.
  32859. * @example
  32860. *
  32861. * _.toLower('--Foo-Bar--');
  32862. * // => '--foo-bar--'
  32863. *
  32864. * _.toLower('fooBar');
  32865. * // => 'foobar'
  32866. *
  32867. * _.toLower('__FOO_BAR__');
  32868. * // => '__foo_bar__'
  32869. */
  32870. function toLower(value) {
  32871. return toString(value).toLowerCase();
  32872. }
  32873. /**
  32874. * Converts `string`, as a whole, to upper case just like
  32875. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32876. *
  32877. * @static
  32878. * @memberOf _
  32879. * @since 4.0.0
  32880. * @category String
  32881. * @param {string} [string=''] The string to convert.
  32882. * @returns {string} Returns the upper cased string.
  32883. * @example
  32884. *
  32885. * _.toUpper('--foo-bar--');
  32886. * // => '--FOO-BAR--'
  32887. *
  32888. * _.toUpper('fooBar');
  32889. * // => 'FOOBAR'
  32890. *
  32891. * _.toUpper('__foo_bar__');
  32892. * // => '__FOO_BAR__'
  32893. */
  32894. function toUpper(value) {
  32895. return toString(value).toUpperCase();
  32896. }
  32897. /**
  32898. * Removes leading and trailing whitespace or specified characters from `string`.
  32899. *
  32900. * @static
  32901. * @memberOf _
  32902. * @since 3.0.0
  32903. * @category String
  32904. * @param {string} [string=''] The string to trim.
  32905. * @param {string} [chars=whitespace] The characters to trim.
  32906. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32907. * @returns {string} Returns the trimmed string.
  32908. * @example
  32909. *
  32910. * _.trim(' abc ');
  32911. * // => 'abc'
  32912. *
  32913. * _.trim('-_-abc-_-', '_-');
  32914. * // => 'abc'
  32915. *
  32916. * _.map([' foo ', ' bar '], _.trim);
  32917. * // => ['foo', 'bar']
  32918. */
  32919. function trim(string, chars, guard) {
  32920. string = toString(string);
  32921. if (string && (guard || chars === undefined)) {
  32922. return string.replace(reTrim, '');
  32923. }
  32924. if (!string || !(chars = baseToString(chars))) {
  32925. return string;
  32926. }
  32927. var strSymbols = stringToArray(string),
  32928. chrSymbols = stringToArray(chars),
  32929. start = charsStartIndex(strSymbols, chrSymbols),
  32930. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32931. return castSlice(strSymbols, start, end).join('');
  32932. }
  32933. /**
  32934. * Removes trailing whitespace or specified characters from `string`.
  32935. *
  32936. * @static
  32937. * @memberOf _
  32938. * @since 4.0.0
  32939. * @category String
  32940. * @param {string} [string=''] The string to trim.
  32941. * @param {string} [chars=whitespace] The characters to trim.
  32942. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32943. * @returns {string} Returns the trimmed string.
  32944. * @example
  32945. *
  32946. * _.trimEnd(' abc ');
  32947. * // => ' abc'
  32948. *
  32949. * _.trimEnd('-_-abc-_-', '_-');
  32950. * // => '-_-abc'
  32951. */
  32952. function trimEnd(string, chars, guard) {
  32953. string = toString(string);
  32954. if (string && (guard || chars === undefined)) {
  32955. return string.replace(reTrimEnd, '');
  32956. }
  32957. if (!string || !(chars = baseToString(chars))) {
  32958. return string;
  32959. }
  32960. var strSymbols = stringToArray(string),
  32961. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32962. return castSlice(strSymbols, 0, end).join('');
  32963. }
  32964. /**
  32965. * Removes leading whitespace or specified characters from `string`.
  32966. *
  32967. * @static
  32968. * @memberOf _
  32969. * @since 4.0.0
  32970. * @category String
  32971. * @param {string} [string=''] The string to trim.
  32972. * @param {string} [chars=whitespace] The characters to trim.
  32973. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32974. * @returns {string} Returns the trimmed string.
  32975. * @example
  32976. *
  32977. * _.trimStart(' abc ');
  32978. * // => 'abc '
  32979. *
  32980. * _.trimStart('-_-abc-_-', '_-');
  32981. * // => 'abc-_-'
  32982. */
  32983. function trimStart(string, chars, guard) {
  32984. string = toString(string);
  32985. if (string && (guard || chars === undefined)) {
  32986. return string.replace(reTrimStart, '');
  32987. }
  32988. if (!string || !(chars = baseToString(chars))) {
  32989. return string;
  32990. }
  32991. var strSymbols = stringToArray(string),
  32992. start = charsStartIndex(strSymbols, stringToArray(chars));
  32993. return castSlice(strSymbols, start).join('');
  32994. }
  32995. /**
  32996. * Truncates `string` if it's longer than the given maximum string length.
  32997. * The last characters of the truncated string are replaced with the omission
  32998. * string which defaults to "...".
  32999. *
  33000. * @static
  33001. * @memberOf _
  33002. * @since 4.0.0
  33003. * @category String
  33004. * @param {string} [string=''] The string to truncate.
  33005. * @param {Object} [options={}] The options object.
  33006. * @param {number} [options.length=30] The maximum string length.
  33007. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33008. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33009. * @returns {string} Returns the truncated string.
  33010. * @example
  33011. *
  33012. * _.truncate('hi-diddly-ho there, neighborino');
  33013. * // => 'hi-diddly-ho there, neighbo...'
  33014. *
  33015. * _.truncate('hi-diddly-ho there, neighborino', {
  33016. * 'length': 24,
  33017. * 'separator': ' '
  33018. * });
  33019. * // => 'hi-diddly-ho there,...'
  33020. *
  33021. * _.truncate('hi-diddly-ho there, neighborino', {
  33022. * 'length': 24,
  33023. * 'separator': /,? +/
  33024. * });
  33025. * // => 'hi-diddly-ho there...'
  33026. *
  33027. * _.truncate('hi-diddly-ho there, neighborino', {
  33028. * 'omission': ' [...]'
  33029. * });
  33030. * // => 'hi-diddly-ho there, neig [...]'
  33031. */
  33032. function truncate(string, options) {
  33033. var length = DEFAULT_TRUNC_LENGTH,
  33034. omission = DEFAULT_TRUNC_OMISSION;
  33035. if (isObject(options)) {
  33036. var separator = 'separator' in options ? options.separator : separator;
  33037. length = 'length' in options ? toInteger(options.length) : length;
  33038. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33039. }
  33040. string = toString(string);
  33041. var strLength = string.length;
  33042. if (hasUnicode(string)) {
  33043. var strSymbols = stringToArray(string);
  33044. strLength = strSymbols.length;
  33045. }
  33046. if (length >= strLength) {
  33047. return string;
  33048. }
  33049. var end = length - stringSize(omission);
  33050. if (end < 1) {
  33051. return omission;
  33052. }
  33053. var result = strSymbols
  33054. ? castSlice(strSymbols, 0, end).join('')
  33055. : string.slice(0, end);
  33056. if (separator === undefined) {
  33057. return result + omission;
  33058. }
  33059. if (strSymbols) {
  33060. end += (result.length - end);
  33061. }
  33062. if (isRegExp(separator)) {
  33063. if (string.slice(end).search(separator)) {
  33064. var match,
  33065. substring = result;
  33066. if (!separator.global) {
  33067. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33068. }
  33069. separator.lastIndex = 0;
  33070. while ((match = separator.exec(substring))) {
  33071. var newEnd = match.index;
  33072. }
  33073. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33074. }
  33075. } else if (string.indexOf(baseToString(separator), end) != end) {
  33076. var index = result.lastIndexOf(separator);
  33077. if (index > -1) {
  33078. result = result.slice(0, index);
  33079. }
  33080. }
  33081. return result + omission;
  33082. }
  33083. /**
  33084. * The inverse of `_.escape`; this method converts the HTML entities
  33085. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33086. * their corresponding characters.
  33087. *
  33088. * **Note:** No other HTML entities are unescaped. To unescape additional
  33089. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33090. *
  33091. * @static
  33092. * @memberOf _
  33093. * @since 0.6.0
  33094. * @category String
  33095. * @param {string} [string=''] The string to unescape.
  33096. * @returns {string} Returns the unescaped string.
  33097. * @example
  33098. *
  33099. * _.unescape('fred, barney, &amp; pebbles');
  33100. * // => 'fred, barney, & pebbles'
  33101. */
  33102. function unescape(string) {
  33103. string = toString(string);
  33104. return (string && reHasEscapedHtml.test(string))
  33105. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33106. : string;
  33107. }
  33108. /**
  33109. * Converts `string`, as space separated words, to upper case.
  33110. *
  33111. * @static
  33112. * @memberOf _
  33113. * @since 4.0.0
  33114. * @category String
  33115. * @param {string} [string=''] The string to convert.
  33116. * @returns {string} Returns the upper cased string.
  33117. * @example
  33118. *
  33119. * _.upperCase('--foo-bar');
  33120. * // => 'FOO BAR'
  33121. *
  33122. * _.upperCase('fooBar');
  33123. * // => 'FOO BAR'
  33124. *
  33125. * _.upperCase('__foo_bar__');
  33126. * // => 'FOO BAR'
  33127. */
  33128. var upperCase = createCompounder(function(result, word, index) {
  33129. return result + (index ? ' ' : '') + word.toUpperCase();
  33130. });
  33131. /**
  33132. * Converts the first character of `string` to upper case.
  33133. *
  33134. * @static
  33135. * @memberOf _
  33136. * @since 4.0.0
  33137. * @category String
  33138. * @param {string} [string=''] The string to convert.
  33139. * @returns {string} Returns the converted string.
  33140. * @example
  33141. *
  33142. * _.upperFirst('fred');
  33143. * // => 'Fred'
  33144. *
  33145. * _.upperFirst('FRED');
  33146. * // => 'FRED'
  33147. */
  33148. var upperFirst = createCaseFirst('toUpperCase');
  33149. /**
  33150. * Splits `string` into an array of its words.
  33151. *
  33152. * @static
  33153. * @memberOf _
  33154. * @since 3.0.0
  33155. * @category String
  33156. * @param {string} [string=''] The string to inspect.
  33157. * @param {RegExp|string} [pattern] The pattern to match words.
  33158. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33159. * @returns {Array} Returns the words of `string`.
  33160. * @example
  33161. *
  33162. * _.words('fred, barney, & pebbles');
  33163. * // => ['fred', 'barney', 'pebbles']
  33164. *
  33165. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33166. * // => ['fred', 'barney', '&', 'pebbles']
  33167. */
  33168. function words(string, pattern, guard) {
  33169. string = toString(string);
  33170. pattern = guard ? undefined : pattern;
  33171. if (pattern === undefined) {
  33172. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33173. }
  33174. return string.match(pattern) || [];
  33175. }
  33176. /*------------------------------------------------------------------------*/
  33177. /**
  33178. * Attempts to invoke `func`, returning either the result or the caught error
  33179. * object. Any additional arguments are provided to `func` when it's invoked.
  33180. *
  33181. * @static
  33182. * @memberOf _
  33183. * @since 3.0.0
  33184. * @category Util
  33185. * @param {Function} func The function to attempt.
  33186. * @param {...*} [args] The arguments to invoke `func` with.
  33187. * @returns {*} Returns the `func` result or error object.
  33188. * @example
  33189. *
  33190. * // Avoid throwing errors for invalid selectors.
  33191. * var elements = _.attempt(function(selector) {
  33192. * return document.querySelectorAll(selector);
  33193. * }, '>_>');
  33194. *
  33195. * if (_.isError(elements)) {
  33196. * elements = [];
  33197. * }
  33198. */
  33199. var attempt = baseRest(function(func, args) {
  33200. try {
  33201. return apply(func, undefined, args);
  33202. } catch (e) {
  33203. return isError(e) ? e : new Error(e);
  33204. }
  33205. });
  33206. /**
  33207. * Binds methods of an object to the object itself, overwriting the existing
  33208. * method.
  33209. *
  33210. * **Note:** This method doesn't set the "length" property of bound functions.
  33211. *
  33212. * @static
  33213. * @since 0.1.0
  33214. * @memberOf _
  33215. * @category Util
  33216. * @param {Object} object The object to bind and assign the bound methods to.
  33217. * @param {...(string|string[])} methodNames The object method names to bind.
  33218. * @returns {Object} Returns `object`.
  33219. * @example
  33220. *
  33221. * var view = {
  33222. * 'label': 'docs',
  33223. * 'click': function() {
  33224. * console.log('clicked ' + this.label);
  33225. * }
  33226. * };
  33227. *
  33228. * _.bindAll(view, ['click']);
  33229. * jQuery(element).on('click', view.click);
  33230. * // => Logs 'clicked docs' when clicked.
  33231. */
  33232. var bindAll = flatRest(function(object, methodNames) {
  33233. arrayEach(methodNames, function(key) {
  33234. key = toKey(key);
  33235. baseAssignValue(object, key, bind(object[key], object));
  33236. });
  33237. return object;
  33238. });
  33239. /**
  33240. * Creates a function that iterates over `pairs` and invokes the corresponding
  33241. * function of the first predicate to return truthy. The predicate-function
  33242. * pairs are invoked with the `this` binding and arguments of the created
  33243. * function.
  33244. *
  33245. * @static
  33246. * @memberOf _
  33247. * @since 4.0.0
  33248. * @category Util
  33249. * @param {Array} pairs The predicate-function pairs.
  33250. * @returns {Function} Returns the new composite function.
  33251. * @example
  33252. *
  33253. * var func = _.cond([
  33254. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33255. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33256. * [_.stubTrue, _.constant('no match')]
  33257. * ]);
  33258. *
  33259. * func({ 'a': 1, 'b': 2 });
  33260. * // => 'matches A'
  33261. *
  33262. * func({ 'a': 0, 'b': 1 });
  33263. * // => 'matches B'
  33264. *
  33265. * func({ 'a': '1', 'b': '2' });
  33266. * // => 'no match'
  33267. */
  33268. function cond(pairs) {
  33269. var length = pairs == null ? 0 : pairs.length,
  33270. toIteratee = getIteratee();
  33271. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33272. if (typeof pair[1] != 'function') {
  33273. throw new TypeError(FUNC_ERROR_TEXT);
  33274. }
  33275. return [toIteratee(pair[0]), pair[1]];
  33276. });
  33277. return baseRest(function(args) {
  33278. var index = -1;
  33279. while (++index < length) {
  33280. var pair = pairs[index];
  33281. if (apply(pair[0], this, args)) {
  33282. return apply(pair[1], this, args);
  33283. }
  33284. }
  33285. });
  33286. }
  33287. /**
  33288. * Creates a function that invokes the predicate properties of `source` with
  33289. * the corresponding property values of a given object, returning `true` if
  33290. * all predicates return truthy, else `false`.
  33291. *
  33292. * **Note:** The created function is equivalent to `_.conformsTo` with
  33293. * `source` partially applied.
  33294. *
  33295. * @static
  33296. * @memberOf _
  33297. * @since 4.0.0
  33298. * @category Util
  33299. * @param {Object} source The object of property predicates to conform to.
  33300. * @returns {Function} Returns the new spec function.
  33301. * @example
  33302. *
  33303. * var objects = [
  33304. * { 'a': 2, 'b': 1 },
  33305. * { 'a': 1, 'b': 2 }
  33306. * ];
  33307. *
  33308. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33309. * // => [{ 'a': 1, 'b': 2 }]
  33310. */
  33311. function conforms(source) {
  33312. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33313. }
  33314. /**
  33315. * Creates a function that returns `value`.
  33316. *
  33317. * @static
  33318. * @memberOf _
  33319. * @since 2.4.0
  33320. * @category Util
  33321. * @param {*} value The value to return from the new function.
  33322. * @returns {Function} Returns the new constant function.
  33323. * @example
  33324. *
  33325. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33326. *
  33327. * console.log(objects);
  33328. * // => [{ 'a': 1 }, { 'a': 1 }]
  33329. *
  33330. * console.log(objects[0] === objects[1]);
  33331. * // => true
  33332. */
  33333. function constant(value) {
  33334. return function() {
  33335. return value;
  33336. };
  33337. }
  33338. /**
  33339. * Checks `value` to determine whether a default value should be returned in
  33340. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33341. * or `undefined`.
  33342. *
  33343. * @static
  33344. * @memberOf _
  33345. * @since 4.14.0
  33346. * @category Util
  33347. * @param {*} value The value to check.
  33348. * @param {*} defaultValue The default value.
  33349. * @returns {*} Returns the resolved value.
  33350. * @example
  33351. *
  33352. * _.defaultTo(1, 10);
  33353. * // => 1
  33354. *
  33355. * _.defaultTo(undefined, 10);
  33356. * // => 10
  33357. */
  33358. function defaultTo(value, defaultValue) {
  33359. return (value == null || value !== value) ? defaultValue : value;
  33360. }
  33361. /**
  33362. * Creates a function that returns the result of invoking the given functions
  33363. * with the `this` binding of the created function, where each successive
  33364. * invocation is supplied the return value of the previous.
  33365. *
  33366. * @static
  33367. * @memberOf _
  33368. * @since 3.0.0
  33369. * @category Util
  33370. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33371. * @returns {Function} Returns the new composite function.
  33372. * @see _.flowRight
  33373. * @example
  33374. *
  33375. * function square(n) {
  33376. * return n * n;
  33377. * }
  33378. *
  33379. * var addSquare = _.flow([_.add, square]);
  33380. * addSquare(1, 2);
  33381. * // => 9
  33382. */
  33383. var flow = createFlow();
  33384. /**
  33385. * This method is like `_.flow` except that it creates a function that
  33386. * invokes the given functions from right to left.
  33387. *
  33388. * @static
  33389. * @since 3.0.0
  33390. * @memberOf _
  33391. * @category Util
  33392. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33393. * @returns {Function} Returns the new composite function.
  33394. * @see _.flow
  33395. * @example
  33396. *
  33397. * function square(n) {
  33398. * return n * n;
  33399. * }
  33400. *
  33401. * var addSquare = _.flowRight([square, _.add]);
  33402. * addSquare(1, 2);
  33403. * // => 9
  33404. */
  33405. var flowRight = createFlow(true);
  33406. /**
  33407. * This method returns the first argument it receives.
  33408. *
  33409. * @static
  33410. * @since 0.1.0
  33411. * @memberOf _
  33412. * @category Util
  33413. * @param {*} value Any value.
  33414. * @returns {*} Returns `value`.
  33415. * @example
  33416. *
  33417. * var object = { 'a': 1 };
  33418. *
  33419. * console.log(_.identity(object) === object);
  33420. * // => true
  33421. */
  33422. function identity(value) {
  33423. return value;
  33424. }
  33425. /**
  33426. * Creates a function that invokes `func` with the arguments of the created
  33427. * function. If `func` is a property name, the created function returns the
  33428. * property value for a given element. If `func` is an array or object, the
  33429. * created function returns `true` for elements that contain the equivalent
  33430. * source properties, otherwise it returns `false`.
  33431. *
  33432. * @static
  33433. * @since 4.0.0
  33434. * @memberOf _
  33435. * @category Util
  33436. * @param {*} [func=_.identity] The value to convert to a callback.
  33437. * @returns {Function} Returns the callback.
  33438. * @example
  33439. *
  33440. * var users = [
  33441. * { 'user': 'barney', 'age': 36, 'active': true },
  33442. * { 'user': 'fred', 'age': 40, 'active': false }
  33443. * ];
  33444. *
  33445. * // The `_.matches` iteratee shorthand.
  33446. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33447. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33448. *
  33449. * // The `_.matchesProperty` iteratee shorthand.
  33450. * _.filter(users, _.iteratee(['user', 'fred']));
  33451. * // => [{ 'user': 'fred', 'age': 40 }]
  33452. *
  33453. * // The `_.property` iteratee shorthand.
  33454. * _.map(users, _.iteratee('user'));
  33455. * // => ['barney', 'fred']
  33456. *
  33457. * // Create custom iteratee shorthands.
  33458. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33459. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33460. * return func.test(string);
  33461. * };
  33462. * });
  33463. *
  33464. * _.filter(['abc', 'def'], /ef/);
  33465. * // => ['def']
  33466. */
  33467. function iteratee(func) {
  33468. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33469. }
  33470. /**
  33471. * Creates a function that performs a partial deep comparison between a given
  33472. * object and `source`, returning `true` if the given object has equivalent
  33473. * property values, else `false`.
  33474. *
  33475. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33476. * partially applied.
  33477. *
  33478. * Partial comparisons will match empty array and empty object `source`
  33479. * values against any array or object value, respectively. See `_.isEqual`
  33480. * for a list of supported value comparisons.
  33481. *
  33482. * @static
  33483. * @memberOf _
  33484. * @since 3.0.0
  33485. * @category Util
  33486. * @param {Object} source The object of property values to match.
  33487. * @returns {Function} Returns the new spec function.
  33488. * @example
  33489. *
  33490. * var objects = [
  33491. * { 'a': 1, 'b': 2, 'c': 3 },
  33492. * { 'a': 4, 'b': 5, 'c': 6 }
  33493. * ];
  33494. *
  33495. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33496. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33497. */
  33498. function matches(source) {
  33499. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33500. }
  33501. /**
  33502. * Creates a function that performs a partial deep comparison between the
  33503. * value at `path` of a given object to `srcValue`, returning `true` if the
  33504. * object value is equivalent, else `false`.
  33505. *
  33506. * **Note:** Partial comparisons will match empty array and empty object
  33507. * `srcValue` values against any array or object value, respectively. See
  33508. * `_.isEqual` for a list of supported value comparisons.
  33509. *
  33510. * @static
  33511. * @memberOf _
  33512. * @since 3.2.0
  33513. * @category Util
  33514. * @param {Array|string} path The path of the property to get.
  33515. * @param {*} srcValue The value to match.
  33516. * @returns {Function} Returns the new spec function.
  33517. * @example
  33518. *
  33519. * var objects = [
  33520. * { 'a': 1, 'b': 2, 'c': 3 },
  33521. * { 'a': 4, 'b': 5, 'c': 6 }
  33522. * ];
  33523. *
  33524. * _.find(objects, _.matchesProperty('a', 4));
  33525. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33526. */
  33527. function matchesProperty(path, srcValue) {
  33528. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33529. }
  33530. /**
  33531. * Creates a function that invokes the method at `path` of a given object.
  33532. * Any additional arguments are provided to the invoked method.
  33533. *
  33534. * @static
  33535. * @memberOf _
  33536. * @since 3.7.0
  33537. * @category Util
  33538. * @param {Array|string} path The path of the method to invoke.
  33539. * @param {...*} [args] The arguments to invoke the method with.
  33540. * @returns {Function} Returns the new invoker function.
  33541. * @example
  33542. *
  33543. * var objects = [
  33544. * { 'a': { 'b': _.constant(2) } },
  33545. * { 'a': { 'b': _.constant(1) } }
  33546. * ];
  33547. *
  33548. * _.map(objects, _.method('a.b'));
  33549. * // => [2, 1]
  33550. *
  33551. * _.map(objects, _.method(['a', 'b']));
  33552. * // => [2, 1]
  33553. */
  33554. var method = baseRest(function(path, args) {
  33555. return function(object) {
  33556. return baseInvoke(object, path, args);
  33557. };
  33558. });
  33559. /**
  33560. * The opposite of `_.method`; this method creates a function that invokes
  33561. * the method at a given path of `object`. Any additional arguments are
  33562. * provided to the invoked method.
  33563. *
  33564. * @static
  33565. * @memberOf _
  33566. * @since 3.7.0
  33567. * @category Util
  33568. * @param {Object} object The object to query.
  33569. * @param {...*} [args] The arguments to invoke the method with.
  33570. * @returns {Function} Returns the new invoker function.
  33571. * @example
  33572. *
  33573. * var array = _.times(3, _.constant),
  33574. * object = { 'a': array, 'b': array, 'c': array };
  33575. *
  33576. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33577. * // => [2, 0]
  33578. *
  33579. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33580. * // => [2, 0]
  33581. */
  33582. var methodOf = baseRest(function(object, args) {
  33583. return function(path) {
  33584. return baseInvoke(object, path, args);
  33585. };
  33586. });
  33587. /**
  33588. * Adds all own enumerable string keyed function properties of a source
  33589. * object to the destination object. If `object` is a function, then methods
  33590. * are added to its prototype as well.
  33591. *
  33592. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33593. * avoid conflicts caused by modifying the original.
  33594. *
  33595. * @static
  33596. * @since 0.1.0
  33597. * @memberOf _
  33598. * @category Util
  33599. * @param {Function|Object} [object=lodash] The destination object.
  33600. * @param {Object} source The object of functions to add.
  33601. * @param {Object} [options={}] The options object.
  33602. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33603. * @returns {Function|Object} Returns `object`.
  33604. * @example
  33605. *
  33606. * function vowels(string) {
  33607. * return _.filter(string, function(v) {
  33608. * return /[aeiou]/i.test(v);
  33609. * });
  33610. * }
  33611. *
  33612. * _.mixin({ 'vowels': vowels });
  33613. * _.vowels('fred');
  33614. * // => ['e']
  33615. *
  33616. * _('fred').vowels().value();
  33617. * // => ['e']
  33618. *
  33619. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33620. * _('fred').vowels();
  33621. * // => ['e']
  33622. */
  33623. function mixin(object, source, options) {
  33624. var props = keys(source),
  33625. methodNames = baseFunctions(source, props);
  33626. if (options == null &&
  33627. !(isObject(source) && (methodNames.length || !props.length))) {
  33628. options = source;
  33629. source = object;
  33630. object = this;
  33631. methodNames = baseFunctions(source, keys(source));
  33632. }
  33633. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33634. isFunc = isFunction(object);
  33635. arrayEach(methodNames, function(methodName) {
  33636. var func = source[methodName];
  33637. object[methodName] = func;
  33638. if (isFunc) {
  33639. object.prototype[methodName] = function() {
  33640. var chainAll = this.__chain__;
  33641. if (chain || chainAll) {
  33642. var result = object(this.__wrapped__),
  33643. actions = result.__actions__ = copyArray(this.__actions__);
  33644. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33645. result.__chain__ = chainAll;
  33646. return result;
  33647. }
  33648. return func.apply(object, arrayPush([this.value()], arguments));
  33649. };
  33650. }
  33651. });
  33652. return object;
  33653. }
  33654. /**
  33655. * Reverts the `_` variable to its previous value and returns a reference to
  33656. * the `lodash` function.
  33657. *
  33658. * @static
  33659. * @since 0.1.0
  33660. * @memberOf _
  33661. * @category Util
  33662. * @returns {Function} Returns the `lodash` function.
  33663. * @example
  33664. *
  33665. * var lodash = _.noConflict();
  33666. */
  33667. function noConflict() {
  33668. if (root._ === this) {
  33669. root._ = oldDash;
  33670. }
  33671. return this;
  33672. }
  33673. /**
  33674. * This method returns `undefined`.
  33675. *
  33676. * @static
  33677. * @memberOf _
  33678. * @since 2.3.0
  33679. * @category Util
  33680. * @example
  33681. *
  33682. * _.times(2, _.noop);
  33683. * // => [undefined, undefined]
  33684. */
  33685. function noop() {
  33686. // No operation performed.
  33687. }
  33688. /**
  33689. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33690. * the nth argument from the end is returned.
  33691. *
  33692. * @static
  33693. * @memberOf _
  33694. * @since 4.0.0
  33695. * @category Util
  33696. * @param {number} [n=0] The index of the argument to return.
  33697. * @returns {Function} Returns the new pass-thru function.
  33698. * @example
  33699. *
  33700. * var func = _.nthArg(1);
  33701. * func('a', 'b', 'c', 'd');
  33702. * // => 'b'
  33703. *
  33704. * var func = _.nthArg(-2);
  33705. * func('a', 'b', 'c', 'd');
  33706. * // => 'c'
  33707. */
  33708. function nthArg(n) {
  33709. n = toInteger(n);
  33710. return baseRest(function(args) {
  33711. return baseNth(args, n);
  33712. });
  33713. }
  33714. /**
  33715. * Creates a function that invokes `iteratees` with the arguments it receives
  33716. * and returns their results.
  33717. *
  33718. * @static
  33719. * @memberOf _
  33720. * @since 4.0.0
  33721. * @category Util
  33722. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33723. * The iteratees to invoke.
  33724. * @returns {Function} Returns the new function.
  33725. * @example
  33726. *
  33727. * var func = _.over([Math.max, Math.min]);
  33728. *
  33729. * func(1, 2, 3, 4);
  33730. * // => [4, 1]
  33731. */
  33732. var over = createOver(arrayMap);
  33733. /**
  33734. * Creates a function that checks if **all** of the `predicates` return
  33735. * truthy when invoked with the arguments it receives.
  33736. *
  33737. * @static
  33738. * @memberOf _
  33739. * @since 4.0.0
  33740. * @category Util
  33741. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33742. * The predicates to check.
  33743. * @returns {Function} Returns the new function.
  33744. * @example
  33745. *
  33746. * var func = _.overEvery([Boolean, isFinite]);
  33747. *
  33748. * func('1');
  33749. * // => true
  33750. *
  33751. * func(null);
  33752. * // => false
  33753. *
  33754. * func(NaN);
  33755. * // => false
  33756. */
  33757. var overEvery = createOver(arrayEvery);
  33758. /**
  33759. * Creates a function that checks if **any** of the `predicates` return
  33760. * truthy when invoked with the arguments it receives.
  33761. *
  33762. * @static
  33763. * @memberOf _
  33764. * @since 4.0.0
  33765. * @category Util
  33766. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33767. * The predicates to check.
  33768. * @returns {Function} Returns the new function.
  33769. * @example
  33770. *
  33771. * var func = _.overSome([Boolean, isFinite]);
  33772. *
  33773. * func('1');
  33774. * // => true
  33775. *
  33776. * func(null);
  33777. * // => true
  33778. *
  33779. * func(NaN);
  33780. * // => false
  33781. */
  33782. var overSome = createOver(arraySome);
  33783. /**
  33784. * Creates a function that returns the value at `path` of a given object.
  33785. *
  33786. * @static
  33787. * @memberOf _
  33788. * @since 2.4.0
  33789. * @category Util
  33790. * @param {Array|string} path The path of the property to get.
  33791. * @returns {Function} Returns the new accessor function.
  33792. * @example
  33793. *
  33794. * var objects = [
  33795. * { 'a': { 'b': 2 } },
  33796. * { 'a': { 'b': 1 } }
  33797. * ];
  33798. *
  33799. * _.map(objects, _.property('a.b'));
  33800. * // => [2, 1]
  33801. *
  33802. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33803. * // => [1, 2]
  33804. */
  33805. function property(path) {
  33806. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33807. }
  33808. /**
  33809. * The opposite of `_.property`; this method creates a function that returns
  33810. * the value at a given path of `object`.
  33811. *
  33812. * @static
  33813. * @memberOf _
  33814. * @since 3.0.0
  33815. * @category Util
  33816. * @param {Object} object The object to query.
  33817. * @returns {Function} Returns the new accessor function.
  33818. * @example
  33819. *
  33820. * var array = [0, 1, 2],
  33821. * object = { 'a': array, 'b': array, 'c': array };
  33822. *
  33823. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33824. * // => [2, 0]
  33825. *
  33826. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33827. * // => [2, 0]
  33828. */
  33829. function propertyOf(object) {
  33830. return function(path) {
  33831. return object == null ? undefined : baseGet(object, path);
  33832. };
  33833. }
  33834. /**
  33835. * Creates an array of numbers (positive and/or negative) progressing from
  33836. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33837. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33838. * it's set to `start` with `start` then set to `0`.
  33839. *
  33840. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33841. * floating-point values which can produce unexpected results.
  33842. *
  33843. * @static
  33844. * @since 0.1.0
  33845. * @memberOf _
  33846. * @category Util
  33847. * @param {number} [start=0] The start of the range.
  33848. * @param {number} end The end of the range.
  33849. * @param {number} [step=1] The value to increment or decrement by.
  33850. * @returns {Array} Returns the range of numbers.
  33851. * @see _.inRange, _.rangeRight
  33852. * @example
  33853. *
  33854. * _.range(4);
  33855. * // => [0, 1, 2, 3]
  33856. *
  33857. * _.range(-4);
  33858. * // => [0, -1, -2, -3]
  33859. *
  33860. * _.range(1, 5);
  33861. * // => [1, 2, 3, 4]
  33862. *
  33863. * _.range(0, 20, 5);
  33864. * // => [0, 5, 10, 15]
  33865. *
  33866. * _.range(0, -4, -1);
  33867. * // => [0, -1, -2, -3]
  33868. *
  33869. * _.range(1, 4, 0);
  33870. * // => [1, 1, 1]
  33871. *
  33872. * _.range(0);
  33873. * // => []
  33874. */
  33875. var range = createRange();
  33876. /**
  33877. * This method is like `_.range` except that it populates values in
  33878. * descending order.
  33879. *
  33880. * @static
  33881. * @memberOf _
  33882. * @since 4.0.0
  33883. * @category Util
  33884. * @param {number} [start=0] The start of the range.
  33885. * @param {number} end The end of the range.
  33886. * @param {number} [step=1] The value to increment or decrement by.
  33887. * @returns {Array} Returns the range of numbers.
  33888. * @see _.inRange, _.range
  33889. * @example
  33890. *
  33891. * _.rangeRight(4);
  33892. * // => [3, 2, 1, 0]
  33893. *
  33894. * _.rangeRight(-4);
  33895. * // => [-3, -2, -1, 0]
  33896. *
  33897. * _.rangeRight(1, 5);
  33898. * // => [4, 3, 2, 1]
  33899. *
  33900. * _.rangeRight(0, 20, 5);
  33901. * // => [15, 10, 5, 0]
  33902. *
  33903. * _.rangeRight(0, -4, -1);
  33904. * // => [-3, -2, -1, 0]
  33905. *
  33906. * _.rangeRight(1, 4, 0);
  33907. * // => [1, 1, 1]
  33908. *
  33909. * _.rangeRight(0);
  33910. * // => []
  33911. */
  33912. var rangeRight = createRange(true);
  33913. /**
  33914. * This method returns a new empty array.
  33915. *
  33916. * @static
  33917. * @memberOf _
  33918. * @since 4.13.0
  33919. * @category Util
  33920. * @returns {Array} Returns the new empty array.
  33921. * @example
  33922. *
  33923. * var arrays = _.times(2, _.stubArray);
  33924. *
  33925. * console.log(arrays);
  33926. * // => [[], []]
  33927. *
  33928. * console.log(arrays[0] === arrays[1]);
  33929. * // => false
  33930. */
  33931. function stubArray() {
  33932. return [];
  33933. }
  33934. /**
  33935. * This method returns `false`.
  33936. *
  33937. * @static
  33938. * @memberOf _
  33939. * @since 4.13.0
  33940. * @category Util
  33941. * @returns {boolean} Returns `false`.
  33942. * @example
  33943. *
  33944. * _.times(2, _.stubFalse);
  33945. * // => [false, false]
  33946. */
  33947. function stubFalse() {
  33948. return false;
  33949. }
  33950. /**
  33951. * This method returns a new empty object.
  33952. *
  33953. * @static
  33954. * @memberOf _
  33955. * @since 4.13.0
  33956. * @category Util
  33957. * @returns {Object} Returns the new empty object.
  33958. * @example
  33959. *
  33960. * var objects = _.times(2, _.stubObject);
  33961. *
  33962. * console.log(objects);
  33963. * // => [{}, {}]
  33964. *
  33965. * console.log(objects[0] === objects[1]);
  33966. * // => false
  33967. */
  33968. function stubObject() {
  33969. return {};
  33970. }
  33971. /**
  33972. * This method returns an empty string.
  33973. *
  33974. * @static
  33975. * @memberOf _
  33976. * @since 4.13.0
  33977. * @category Util
  33978. * @returns {string} Returns the empty string.
  33979. * @example
  33980. *
  33981. * _.times(2, _.stubString);
  33982. * // => ['', '']
  33983. */
  33984. function stubString() {
  33985. return '';
  33986. }
  33987. /**
  33988. * This method returns `true`.
  33989. *
  33990. * @static
  33991. * @memberOf _
  33992. * @since 4.13.0
  33993. * @category Util
  33994. * @returns {boolean} Returns `true`.
  33995. * @example
  33996. *
  33997. * _.times(2, _.stubTrue);
  33998. * // => [true, true]
  33999. */
  34000. function stubTrue() {
  34001. return true;
  34002. }
  34003. /**
  34004. * Invokes the iteratee `n` times, returning an array of the results of
  34005. * each invocation. The iteratee is invoked with one argument; (index).
  34006. *
  34007. * @static
  34008. * @since 0.1.0
  34009. * @memberOf _
  34010. * @category Util
  34011. * @param {number} n The number of times to invoke `iteratee`.
  34012. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34013. * @returns {Array} Returns the array of results.
  34014. * @example
  34015. *
  34016. * _.times(3, String);
  34017. * // => ['0', '1', '2']
  34018. *
  34019. * _.times(4, _.constant(0));
  34020. * // => [0, 0, 0, 0]
  34021. */
  34022. function times(n, iteratee) {
  34023. n = toInteger(n);
  34024. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34025. return [];
  34026. }
  34027. var index = MAX_ARRAY_LENGTH,
  34028. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34029. iteratee = getIteratee(iteratee);
  34030. n -= MAX_ARRAY_LENGTH;
  34031. var result = baseTimes(length, iteratee);
  34032. while (++index < n) {
  34033. iteratee(index);
  34034. }
  34035. return result;
  34036. }
  34037. /**
  34038. * Converts `value` to a property path array.
  34039. *
  34040. * @static
  34041. * @memberOf _
  34042. * @since 4.0.0
  34043. * @category Util
  34044. * @param {*} value The value to convert.
  34045. * @returns {Array} Returns the new property path array.
  34046. * @example
  34047. *
  34048. * _.toPath('a.b.c');
  34049. * // => ['a', 'b', 'c']
  34050. *
  34051. * _.toPath('a[0].b.c');
  34052. * // => ['a', '0', 'b', 'c']
  34053. */
  34054. function toPath(value) {
  34055. if (isArray(value)) {
  34056. return arrayMap(value, toKey);
  34057. }
  34058. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34059. }
  34060. /**
  34061. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34062. *
  34063. * @static
  34064. * @since 0.1.0
  34065. * @memberOf _
  34066. * @category Util
  34067. * @param {string} [prefix=''] The value to prefix the ID with.
  34068. * @returns {string} Returns the unique ID.
  34069. * @example
  34070. *
  34071. * _.uniqueId('contact_');
  34072. * // => 'contact_104'
  34073. *
  34074. * _.uniqueId();
  34075. * // => '105'
  34076. */
  34077. function uniqueId(prefix) {
  34078. var id = ++idCounter;
  34079. return toString(prefix) + id;
  34080. }
  34081. /*------------------------------------------------------------------------*/
  34082. /**
  34083. * Adds two numbers.
  34084. *
  34085. * @static
  34086. * @memberOf _
  34087. * @since 3.4.0
  34088. * @category Math
  34089. * @param {number} augend The first number in an addition.
  34090. * @param {number} addend The second number in an addition.
  34091. * @returns {number} Returns the total.
  34092. * @example
  34093. *
  34094. * _.add(6, 4);
  34095. * // => 10
  34096. */
  34097. var add = createMathOperation(function(augend, addend) {
  34098. return augend + addend;
  34099. }, 0);
  34100. /**
  34101. * Computes `number` rounded up to `precision`.
  34102. *
  34103. * @static
  34104. * @memberOf _
  34105. * @since 3.10.0
  34106. * @category Math
  34107. * @param {number} number The number to round up.
  34108. * @param {number} [precision=0] The precision to round up to.
  34109. * @returns {number} Returns the rounded up number.
  34110. * @example
  34111. *
  34112. * _.ceil(4.006);
  34113. * // => 5
  34114. *
  34115. * _.ceil(6.004, 2);
  34116. * // => 6.01
  34117. *
  34118. * _.ceil(6040, -2);
  34119. * // => 6100
  34120. */
  34121. var ceil = createRound('ceil');
  34122. /**
  34123. * Divide two numbers.
  34124. *
  34125. * @static
  34126. * @memberOf _
  34127. * @since 4.7.0
  34128. * @category Math
  34129. * @param {number} dividend The first number in a division.
  34130. * @param {number} divisor The second number in a division.
  34131. * @returns {number} Returns the quotient.
  34132. * @example
  34133. *
  34134. * _.divide(6, 4);
  34135. * // => 1.5
  34136. */
  34137. var divide = createMathOperation(function(dividend, divisor) {
  34138. return dividend / divisor;
  34139. }, 1);
  34140. /**
  34141. * Computes `number` rounded down to `precision`.
  34142. *
  34143. * @static
  34144. * @memberOf _
  34145. * @since 3.10.0
  34146. * @category Math
  34147. * @param {number} number The number to round down.
  34148. * @param {number} [precision=0] The precision to round down to.
  34149. * @returns {number} Returns the rounded down number.
  34150. * @example
  34151. *
  34152. * _.floor(4.006);
  34153. * // => 4
  34154. *
  34155. * _.floor(0.046, 2);
  34156. * // => 0.04
  34157. *
  34158. * _.floor(4060, -2);
  34159. * // => 4000
  34160. */
  34161. var floor = createRound('floor');
  34162. /**
  34163. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34164. * `undefined` is returned.
  34165. *
  34166. * @static
  34167. * @since 0.1.0
  34168. * @memberOf _
  34169. * @category Math
  34170. * @param {Array} array The array to iterate over.
  34171. * @returns {*} Returns the maximum value.
  34172. * @example
  34173. *
  34174. * _.max([4, 2, 8, 6]);
  34175. * // => 8
  34176. *
  34177. * _.max([]);
  34178. * // => undefined
  34179. */
  34180. function max(array) {
  34181. return (array && array.length)
  34182. ? baseExtremum(array, identity, baseGt)
  34183. : undefined;
  34184. }
  34185. /**
  34186. * This method is like `_.max` except that it accepts `iteratee` which is
  34187. * invoked for each element in `array` to generate the criterion by which
  34188. * the value is ranked. The iteratee is invoked with one argument: (value).
  34189. *
  34190. * @static
  34191. * @memberOf _
  34192. * @since 4.0.0
  34193. * @category Math
  34194. * @param {Array} array The array to iterate over.
  34195. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34196. * @returns {*} Returns the maximum value.
  34197. * @example
  34198. *
  34199. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34200. *
  34201. * _.maxBy(objects, function(o) { return o.n; });
  34202. * // => { 'n': 2 }
  34203. *
  34204. * // The `_.property` iteratee shorthand.
  34205. * _.maxBy(objects, 'n');
  34206. * // => { 'n': 2 }
  34207. */
  34208. function maxBy(array, iteratee) {
  34209. return (array && array.length)
  34210. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34211. : undefined;
  34212. }
  34213. /**
  34214. * Computes the mean of the values in `array`.
  34215. *
  34216. * @static
  34217. * @memberOf _
  34218. * @since 4.0.0
  34219. * @category Math
  34220. * @param {Array} array The array to iterate over.
  34221. * @returns {number} Returns the mean.
  34222. * @example
  34223. *
  34224. * _.mean([4, 2, 8, 6]);
  34225. * // => 5
  34226. */
  34227. function mean(array) {
  34228. return baseMean(array, identity);
  34229. }
  34230. /**
  34231. * This method is like `_.mean` except that it accepts `iteratee` which is
  34232. * invoked for each element in `array` to generate the value to be averaged.
  34233. * The iteratee is invoked with one argument: (value).
  34234. *
  34235. * @static
  34236. * @memberOf _
  34237. * @since 4.7.0
  34238. * @category Math
  34239. * @param {Array} array The array to iterate over.
  34240. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34241. * @returns {number} Returns the mean.
  34242. * @example
  34243. *
  34244. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34245. *
  34246. * _.meanBy(objects, function(o) { return o.n; });
  34247. * // => 5
  34248. *
  34249. * // The `_.property` iteratee shorthand.
  34250. * _.meanBy(objects, 'n');
  34251. * // => 5
  34252. */
  34253. function meanBy(array, iteratee) {
  34254. return baseMean(array, getIteratee(iteratee, 2));
  34255. }
  34256. /**
  34257. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34258. * `undefined` is returned.
  34259. *
  34260. * @static
  34261. * @since 0.1.0
  34262. * @memberOf _
  34263. * @category Math
  34264. * @param {Array} array The array to iterate over.
  34265. * @returns {*} Returns the minimum value.
  34266. * @example
  34267. *
  34268. * _.min([4, 2, 8, 6]);
  34269. * // => 2
  34270. *
  34271. * _.min([]);
  34272. * // => undefined
  34273. */
  34274. function min(array) {
  34275. return (array && array.length)
  34276. ? baseExtremum(array, identity, baseLt)
  34277. : undefined;
  34278. }
  34279. /**
  34280. * This method is like `_.min` except that it accepts `iteratee` which is
  34281. * invoked for each element in `array` to generate the criterion by which
  34282. * the value is ranked. The iteratee is invoked with one argument: (value).
  34283. *
  34284. * @static
  34285. * @memberOf _
  34286. * @since 4.0.0
  34287. * @category Math
  34288. * @param {Array} array The array to iterate over.
  34289. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34290. * @returns {*} Returns the minimum value.
  34291. * @example
  34292. *
  34293. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34294. *
  34295. * _.minBy(objects, function(o) { return o.n; });
  34296. * // => { 'n': 1 }
  34297. *
  34298. * // The `_.property` iteratee shorthand.
  34299. * _.minBy(objects, 'n');
  34300. * // => { 'n': 1 }
  34301. */
  34302. function minBy(array, iteratee) {
  34303. return (array && array.length)
  34304. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34305. : undefined;
  34306. }
  34307. /**
  34308. * Multiply two numbers.
  34309. *
  34310. * @static
  34311. * @memberOf _
  34312. * @since 4.7.0
  34313. * @category Math
  34314. * @param {number} multiplier The first number in a multiplication.
  34315. * @param {number} multiplicand The second number in a multiplication.
  34316. * @returns {number} Returns the product.
  34317. * @example
  34318. *
  34319. * _.multiply(6, 4);
  34320. * // => 24
  34321. */
  34322. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34323. return multiplier * multiplicand;
  34324. }, 1);
  34325. /**
  34326. * Computes `number` rounded to `precision`.
  34327. *
  34328. * @static
  34329. * @memberOf _
  34330. * @since 3.10.0
  34331. * @category Math
  34332. * @param {number} number The number to round.
  34333. * @param {number} [precision=0] The precision to round to.
  34334. * @returns {number} Returns the rounded number.
  34335. * @example
  34336. *
  34337. * _.round(4.006);
  34338. * // => 4
  34339. *
  34340. * _.round(4.006, 2);
  34341. * // => 4.01
  34342. *
  34343. * _.round(4060, -2);
  34344. * // => 4100
  34345. */
  34346. var round = createRound('round');
  34347. /**
  34348. * Subtract two numbers.
  34349. *
  34350. * @static
  34351. * @memberOf _
  34352. * @since 4.0.0
  34353. * @category Math
  34354. * @param {number} minuend The first number in a subtraction.
  34355. * @param {number} subtrahend The second number in a subtraction.
  34356. * @returns {number} Returns the difference.
  34357. * @example
  34358. *
  34359. * _.subtract(6, 4);
  34360. * // => 2
  34361. */
  34362. var subtract = createMathOperation(function(minuend, subtrahend) {
  34363. return minuend - subtrahend;
  34364. }, 0);
  34365. /**
  34366. * Computes the sum of the values in `array`.
  34367. *
  34368. * @static
  34369. * @memberOf _
  34370. * @since 3.4.0
  34371. * @category Math
  34372. * @param {Array} array The array to iterate over.
  34373. * @returns {number} Returns the sum.
  34374. * @example
  34375. *
  34376. * _.sum([4, 2, 8, 6]);
  34377. * // => 20
  34378. */
  34379. function sum(array) {
  34380. return (array && array.length)
  34381. ? baseSum(array, identity)
  34382. : 0;
  34383. }
  34384. /**
  34385. * This method is like `_.sum` except that it accepts `iteratee` which is
  34386. * invoked for each element in `array` to generate the value to be summed.
  34387. * The iteratee is invoked with one argument: (value).
  34388. *
  34389. * @static
  34390. * @memberOf _
  34391. * @since 4.0.0
  34392. * @category Math
  34393. * @param {Array} array The array to iterate over.
  34394. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34395. * @returns {number} Returns the sum.
  34396. * @example
  34397. *
  34398. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34399. *
  34400. * _.sumBy(objects, function(o) { return o.n; });
  34401. * // => 20
  34402. *
  34403. * // The `_.property` iteratee shorthand.
  34404. * _.sumBy(objects, 'n');
  34405. * // => 20
  34406. */
  34407. function sumBy(array, iteratee) {
  34408. return (array && array.length)
  34409. ? baseSum(array, getIteratee(iteratee, 2))
  34410. : 0;
  34411. }
  34412. /*------------------------------------------------------------------------*/
  34413. // Add methods that return wrapped values in chain sequences.
  34414. lodash.after = after;
  34415. lodash.ary = ary;
  34416. lodash.assign = assign;
  34417. lodash.assignIn = assignIn;
  34418. lodash.assignInWith = assignInWith;
  34419. lodash.assignWith = assignWith;
  34420. lodash.at = at;
  34421. lodash.before = before;
  34422. lodash.bind = bind;
  34423. lodash.bindAll = bindAll;
  34424. lodash.bindKey = bindKey;
  34425. lodash.castArray = castArray;
  34426. lodash.chain = chain;
  34427. lodash.chunk = chunk;
  34428. lodash.compact = compact;
  34429. lodash.concat = concat;
  34430. lodash.cond = cond;
  34431. lodash.conforms = conforms;
  34432. lodash.constant = constant;
  34433. lodash.countBy = countBy;
  34434. lodash.create = create;
  34435. lodash.curry = curry;
  34436. lodash.curryRight = curryRight;
  34437. lodash.debounce = debounce;
  34438. lodash.defaults = defaults;
  34439. lodash.defaultsDeep = defaultsDeep;
  34440. lodash.defer = defer;
  34441. lodash.delay = delay;
  34442. lodash.difference = difference;
  34443. lodash.differenceBy = differenceBy;
  34444. lodash.differenceWith = differenceWith;
  34445. lodash.drop = drop;
  34446. lodash.dropRight = dropRight;
  34447. lodash.dropRightWhile = dropRightWhile;
  34448. lodash.dropWhile = dropWhile;
  34449. lodash.fill = fill;
  34450. lodash.filter = filter;
  34451. lodash.flatMap = flatMap;
  34452. lodash.flatMapDeep = flatMapDeep;
  34453. lodash.flatMapDepth = flatMapDepth;
  34454. lodash.flatten = flatten;
  34455. lodash.flattenDeep = flattenDeep;
  34456. lodash.flattenDepth = flattenDepth;
  34457. lodash.flip = flip;
  34458. lodash.flow = flow;
  34459. lodash.flowRight = flowRight;
  34460. lodash.fromPairs = fromPairs;
  34461. lodash.functions = functions;
  34462. lodash.functionsIn = functionsIn;
  34463. lodash.groupBy = groupBy;
  34464. lodash.initial = initial;
  34465. lodash.intersection = intersection;
  34466. lodash.intersectionBy = intersectionBy;
  34467. lodash.intersectionWith = intersectionWith;
  34468. lodash.invert = invert;
  34469. lodash.invertBy = invertBy;
  34470. lodash.invokeMap = invokeMap;
  34471. lodash.iteratee = iteratee;
  34472. lodash.keyBy = keyBy;
  34473. lodash.keys = keys;
  34474. lodash.keysIn = keysIn;
  34475. lodash.map = map;
  34476. lodash.mapKeys = mapKeys;
  34477. lodash.mapValues = mapValues;
  34478. lodash.matches = matches;
  34479. lodash.matchesProperty = matchesProperty;
  34480. lodash.memoize = memoize;
  34481. lodash.merge = merge;
  34482. lodash.mergeWith = mergeWith;
  34483. lodash.method = method;
  34484. lodash.methodOf = methodOf;
  34485. lodash.mixin = mixin;
  34486. lodash.negate = negate;
  34487. lodash.nthArg = nthArg;
  34488. lodash.omit = omit;
  34489. lodash.omitBy = omitBy;
  34490. lodash.once = once;
  34491. lodash.orderBy = orderBy;
  34492. lodash.over = over;
  34493. lodash.overArgs = overArgs;
  34494. lodash.overEvery = overEvery;
  34495. lodash.overSome = overSome;
  34496. lodash.partial = partial;
  34497. lodash.partialRight = partialRight;
  34498. lodash.partition = partition;
  34499. lodash.pick = pick;
  34500. lodash.pickBy = pickBy;
  34501. lodash.property = property;
  34502. lodash.propertyOf = propertyOf;
  34503. lodash.pull = pull;
  34504. lodash.pullAll = pullAll;
  34505. lodash.pullAllBy = pullAllBy;
  34506. lodash.pullAllWith = pullAllWith;
  34507. lodash.pullAt = pullAt;
  34508. lodash.range = range;
  34509. lodash.rangeRight = rangeRight;
  34510. lodash.rearg = rearg;
  34511. lodash.reject = reject;
  34512. lodash.remove = remove;
  34513. lodash.rest = rest;
  34514. lodash.reverse = reverse;
  34515. lodash.sampleSize = sampleSize;
  34516. lodash.set = set;
  34517. lodash.setWith = setWith;
  34518. lodash.shuffle = shuffle;
  34519. lodash.slice = slice;
  34520. lodash.sortBy = sortBy;
  34521. lodash.sortedUniq = sortedUniq;
  34522. lodash.sortedUniqBy = sortedUniqBy;
  34523. lodash.split = split;
  34524. lodash.spread = spread;
  34525. lodash.tail = tail;
  34526. lodash.take = take;
  34527. lodash.takeRight = takeRight;
  34528. lodash.takeRightWhile = takeRightWhile;
  34529. lodash.takeWhile = takeWhile;
  34530. lodash.tap = tap;
  34531. lodash.throttle = throttle;
  34532. lodash.thru = thru;
  34533. lodash.toArray = toArray;
  34534. lodash.toPairs = toPairs;
  34535. lodash.toPairsIn = toPairsIn;
  34536. lodash.toPath = toPath;
  34537. lodash.toPlainObject = toPlainObject;
  34538. lodash.transform = transform;
  34539. lodash.unary = unary;
  34540. lodash.union = union;
  34541. lodash.unionBy = unionBy;
  34542. lodash.unionWith = unionWith;
  34543. lodash.uniq = uniq;
  34544. lodash.uniqBy = uniqBy;
  34545. lodash.uniqWith = uniqWith;
  34546. lodash.unset = unset;
  34547. lodash.unzip = unzip;
  34548. lodash.unzipWith = unzipWith;
  34549. lodash.update = update;
  34550. lodash.updateWith = updateWith;
  34551. lodash.values = values;
  34552. lodash.valuesIn = valuesIn;
  34553. lodash.without = without;
  34554. lodash.words = words;
  34555. lodash.wrap = wrap;
  34556. lodash.xor = xor;
  34557. lodash.xorBy = xorBy;
  34558. lodash.xorWith = xorWith;
  34559. lodash.zip = zip;
  34560. lodash.zipObject = zipObject;
  34561. lodash.zipObjectDeep = zipObjectDeep;
  34562. lodash.zipWith = zipWith;
  34563. // Add aliases.
  34564. lodash.entries = toPairs;
  34565. lodash.entriesIn = toPairsIn;
  34566. lodash.extend = assignIn;
  34567. lodash.extendWith = assignInWith;
  34568. // Add methods to `lodash.prototype`.
  34569. mixin(lodash, lodash);
  34570. /*------------------------------------------------------------------------*/
  34571. // Add methods that return unwrapped values in chain sequences.
  34572. lodash.add = add;
  34573. lodash.attempt = attempt;
  34574. lodash.camelCase = camelCase;
  34575. lodash.capitalize = capitalize;
  34576. lodash.ceil = ceil;
  34577. lodash.clamp = clamp;
  34578. lodash.clone = clone;
  34579. lodash.cloneDeep = cloneDeep;
  34580. lodash.cloneDeepWith = cloneDeepWith;
  34581. lodash.cloneWith = cloneWith;
  34582. lodash.conformsTo = conformsTo;
  34583. lodash.deburr = deburr;
  34584. lodash.defaultTo = defaultTo;
  34585. lodash.divide = divide;
  34586. lodash.endsWith = endsWith;
  34587. lodash.eq = eq;
  34588. lodash.escape = escape;
  34589. lodash.escapeRegExp = escapeRegExp;
  34590. lodash.every = every;
  34591. lodash.find = find;
  34592. lodash.findIndex = findIndex;
  34593. lodash.findKey = findKey;
  34594. lodash.findLast = findLast;
  34595. lodash.findLastIndex = findLastIndex;
  34596. lodash.findLastKey = findLastKey;
  34597. lodash.floor = floor;
  34598. lodash.forEach = forEach;
  34599. lodash.forEachRight = forEachRight;
  34600. lodash.forIn = forIn;
  34601. lodash.forInRight = forInRight;
  34602. lodash.forOwn = forOwn;
  34603. lodash.forOwnRight = forOwnRight;
  34604. lodash.get = get;
  34605. lodash.gt = gt;
  34606. lodash.gte = gte;
  34607. lodash.has = has;
  34608. lodash.hasIn = hasIn;
  34609. lodash.head = head;
  34610. lodash.identity = identity;
  34611. lodash.includes = includes;
  34612. lodash.indexOf = indexOf;
  34613. lodash.inRange = inRange;
  34614. lodash.invoke = invoke;
  34615. lodash.isArguments = isArguments;
  34616. lodash.isArray = isArray;
  34617. lodash.isArrayBuffer = isArrayBuffer;
  34618. lodash.isArrayLike = isArrayLike;
  34619. lodash.isArrayLikeObject = isArrayLikeObject;
  34620. lodash.isBoolean = isBoolean;
  34621. lodash.isBuffer = isBuffer;
  34622. lodash.isDate = isDate;
  34623. lodash.isElement = isElement;
  34624. lodash.isEmpty = isEmpty;
  34625. lodash.isEqual = isEqual;
  34626. lodash.isEqualWith = isEqualWith;
  34627. lodash.isError = isError;
  34628. lodash.isFinite = isFinite;
  34629. lodash.isFunction = isFunction;
  34630. lodash.isInteger = isInteger;
  34631. lodash.isLength = isLength;
  34632. lodash.isMap = isMap;
  34633. lodash.isMatch = isMatch;
  34634. lodash.isMatchWith = isMatchWith;
  34635. lodash.isNaN = isNaN;
  34636. lodash.isNative = isNative;
  34637. lodash.isNil = isNil;
  34638. lodash.isNull = isNull;
  34639. lodash.isNumber = isNumber;
  34640. lodash.isObject = isObject;
  34641. lodash.isObjectLike = isObjectLike;
  34642. lodash.isPlainObject = isPlainObject;
  34643. lodash.isRegExp = isRegExp;
  34644. lodash.isSafeInteger = isSafeInteger;
  34645. lodash.isSet = isSet;
  34646. lodash.isString = isString;
  34647. lodash.isSymbol = isSymbol;
  34648. lodash.isTypedArray = isTypedArray;
  34649. lodash.isUndefined = isUndefined;
  34650. lodash.isWeakMap = isWeakMap;
  34651. lodash.isWeakSet = isWeakSet;
  34652. lodash.join = join;
  34653. lodash.kebabCase = kebabCase;
  34654. lodash.last = last;
  34655. lodash.lastIndexOf = lastIndexOf;
  34656. lodash.lowerCase = lowerCase;
  34657. lodash.lowerFirst = lowerFirst;
  34658. lodash.lt = lt;
  34659. lodash.lte = lte;
  34660. lodash.max = max;
  34661. lodash.maxBy = maxBy;
  34662. lodash.mean = mean;
  34663. lodash.meanBy = meanBy;
  34664. lodash.min = min;
  34665. lodash.minBy = minBy;
  34666. lodash.stubArray = stubArray;
  34667. lodash.stubFalse = stubFalse;
  34668. lodash.stubObject = stubObject;
  34669. lodash.stubString = stubString;
  34670. lodash.stubTrue = stubTrue;
  34671. lodash.multiply = multiply;
  34672. lodash.nth = nth;
  34673. lodash.noConflict = noConflict;
  34674. lodash.noop = noop;
  34675. lodash.now = now;
  34676. lodash.pad = pad;
  34677. lodash.padEnd = padEnd;
  34678. lodash.padStart = padStart;
  34679. lodash.parseInt = parseInt;
  34680. lodash.random = random;
  34681. lodash.reduce = reduce;
  34682. lodash.reduceRight = reduceRight;
  34683. lodash.repeat = repeat;
  34684. lodash.replace = replace;
  34685. lodash.result = result;
  34686. lodash.round = round;
  34687. lodash.runInContext = runInContext;
  34688. lodash.sample = sample;
  34689. lodash.size = size;
  34690. lodash.snakeCase = snakeCase;
  34691. lodash.some = some;
  34692. lodash.sortedIndex = sortedIndex;
  34693. lodash.sortedIndexBy = sortedIndexBy;
  34694. lodash.sortedIndexOf = sortedIndexOf;
  34695. lodash.sortedLastIndex = sortedLastIndex;
  34696. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34697. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34698. lodash.startCase = startCase;
  34699. lodash.startsWith = startsWith;
  34700. lodash.subtract = subtract;
  34701. lodash.sum = sum;
  34702. lodash.sumBy = sumBy;
  34703. lodash.template = template;
  34704. lodash.times = times;
  34705. lodash.toFinite = toFinite;
  34706. lodash.toInteger = toInteger;
  34707. lodash.toLength = toLength;
  34708. lodash.toLower = toLower;
  34709. lodash.toNumber = toNumber;
  34710. lodash.toSafeInteger = toSafeInteger;
  34711. lodash.toString = toString;
  34712. lodash.toUpper = toUpper;
  34713. lodash.trim = trim;
  34714. lodash.trimEnd = trimEnd;
  34715. lodash.trimStart = trimStart;
  34716. lodash.truncate = truncate;
  34717. lodash.unescape = unescape;
  34718. lodash.uniqueId = uniqueId;
  34719. lodash.upperCase = upperCase;
  34720. lodash.upperFirst = upperFirst;
  34721. // Add aliases.
  34722. lodash.each = forEach;
  34723. lodash.eachRight = forEachRight;
  34724. lodash.first = head;
  34725. mixin(lodash, (function() {
  34726. var source = {};
  34727. baseForOwn(lodash, function(func, methodName) {
  34728. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34729. source[methodName] = func;
  34730. }
  34731. });
  34732. return source;
  34733. }()), { 'chain': false });
  34734. /*------------------------------------------------------------------------*/
  34735. /**
  34736. * The semantic version number.
  34737. *
  34738. * @static
  34739. * @memberOf _
  34740. * @type {string}
  34741. */
  34742. lodash.VERSION = VERSION;
  34743. // Assign default placeholders.
  34744. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34745. lodash[methodName].placeholder = lodash;
  34746. });
  34747. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34748. arrayEach(['drop', 'take'], function(methodName, index) {
  34749. LazyWrapper.prototype[methodName] = function(n) {
  34750. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34751. var result = (this.__filtered__ && !index)
  34752. ? new LazyWrapper(this)
  34753. : this.clone();
  34754. if (result.__filtered__) {
  34755. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34756. } else {
  34757. result.__views__.push({
  34758. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34759. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34760. });
  34761. }
  34762. return result;
  34763. };
  34764. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34765. return this.reverse()[methodName](n).reverse();
  34766. };
  34767. });
  34768. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34769. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34770. var type = index + 1,
  34771. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34772. LazyWrapper.prototype[methodName] = function(iteratee) {
  34773. var result = this.clone();
  34774. result.__iteratees__.push({
  34775. 'iteratee': getIteratee(iteratee, 3),
  34776. 'type': type
  34777. });
  34778. result.__filtered__ = result.__filtered__ || isFilter;
  34779. return result;
  34780. };
  34781. });
  34782. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34783. arrayEach(['head', 'last'], function(methodName, index) {
  34784. var takeName = 'take' + (index ? 'Right' : '');
  34785. LazyWrapper.prototype[methodName] = function() {
  34786. return this[takeName](1).value()[0];
  34787. };
  34788. });
  34789. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34790. arrayEach(['initial', 'tail'], function(methodName, index) {
  34791. var dropName = 'drop' + (index ? '' : 'Right');
  34792. LazyWrapper.prototype[methodName] = function() {
  34793. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34794. };
  34795. });
  34796. LazyWrapper.prototype.compact = function() {
  34797. return this.filter(identity);
  34798. };
  34799. LazyWrapper.prototype.find = function(predicate) {
  34800. return this.filter(predicate).head();
  34801. };
  34802. LazyWrapper.prototype.findLast = function(predicate) {
  34803. return this.reverse().find(predicate);
  34804. };
  34805. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34806. if (typeof path == 'function') {
  34807. return new LazyWrapper(this);
  34808. }
  34809. return this.map(function(value) {
  34810. return baseInvoke(value, path, args);
  34811. });
  34812. });
  34813. LazyWrapper.prototype.reject = function(predicate) {
  34814. return this.filter(negate(getIteratee(predicate)));
  34815. };
  34816. LazyWrapper.prototype.slice = function(start, end) {
  34817. start = toInteger(start);
  34818. var result = this;
  34819. if (result.__filtered__ && (start > 0 || end < 0)) {
  34820. return new LazyWrapper(result);
  34821. }
  34822. if (start < 0) {
  34823. result = result.takeRight(-start);
  34824. } else if (start) {
  34825. result = result.drop(start);
  34826. }
  34827. if (end !== undefined) {
  34828. end = toInteger(end);
  34829. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34830. }
  34831. return result;
  34832. };
  34833. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34834. return this.reverse().takeWhile(predicate).reverse();
  34835. };
  34836. LazyWrapper.prototype.toArray = function() {
  34837. return this.take(MAX_ARRAY_LENGTH);
  34838. };
  34839. // Add `LazyWrapper` methods to `lodash.prototype`.
  34840. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34841. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34842. isTaker = /^(?:head|last)$/.test(methodName),
  34843. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34844. retUnwrapped = isTaker || /^find/.test(methodName);
  34845. if (!lodashFunc) {
  34846. return;
  34847. }
  34848. lodash.prototype[methodName] = function() {
  34849. var value = this.__wrapped__,
  34850. args = isTaker ? [1] : arguments,
  34851. isLazy = value instanceof LazyWrapper,
  34852. iteratee = args[0],
  34853. useLazy = isLazy || isArray(value);
  34854. var interceptor = function(value) {
  34855. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34856. return (isTaker && chainAll) ? result[0] : result;
  34857. };
  34858. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34859. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34860. isLazy = useLazy = false;
  34861. }
  34862. var chainAll = this.__chain__,
  34863. isHybrid = !!this.__actions__.length,
  34864. isUnwrapped = retUnwrapped && !chainAll,
  34865. onlyLazy = isLazy && !isHybrid;
  34866. if (!retUnwrapped && useLazy) {
  34867. value = onlyLazy ? value : new LazyWrapper(this);
  34868. var result = func.apply(value, args);
  34869. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34870. return new LodashWrapper(result, chainAll);
  34871. }
  34872. if (isUnwrapped && onlyLazy) {
  34873. return func.apply(this, args);
  34874. }
  34875. result = this.thru(interceptor);
  34876. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34877. };
  34878. });
  34879. // Add `Array` methods to `lodash.prototype`.
  34880. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34881. var func = arrayProto[methodName],
  34882. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34883. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34884. lodash.prototype[methodName] = function() {
  34885. var args = arguments;
  34886. if (retUnwrapped && !this.__chain__) {
  34887. var value = this.value();
  34888. return func.apply(isArray(value) ? value : [], args);
  34889. }
  34890. return this[chainName](function(value) {
  34891. return func.apply(isArray(value) ? value : [], args);
  34892. });
  34893. };
  34894. });
  34895. // Map minified method names to their real names.
  34896. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34897. var lodashFunc = lodash[methodName];
  34898. if (lodashFunc) {
  34899. var key = lodashFunc.name + '';
  34900. if (!hasOwnProperty.call(realNames, key)) {
  34901. realNames[key] = [];
  34902. }
  34903. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34904. }
  34905. });
  34906. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34907. 'name': 'wrapper',
  34908. 'func': undefined
  34909. }];
  34910. // Add methods to `LazyWrapper`.
  34911. LazyWrapper.prototype.clone = lazyClone;
  34912. LazyWrapper.prototype.reverse = lazyReverse;
  34913. LazyWrapper.prototype.value = lazyValue;
  34914. // Add chain sequence methods to the `lodash` wrapper.
  34915. lodash.prototype.at = wrapperAt;
  34916. lodash.prototype.chain = wrapperChain;
  34917. lodash.prototype.commit = wrapperCommit;
  34918. lodash.prototype.next = wrapperNext;
  34919. lodash.prototype.plant = wrapperPlant;
  34920. lodash.prototype.reverse = wrapperReverse;
  34921. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34922. // Add lazy aliases.
  34923. lodash.prototype.first = lodash.prototype.head;
  34924. if (symIterator) {
  34925. lodash.prototype[symIterator] = wrapperToIterator;
  34926. }
  34927. return lodash;
  34928. });
  34929. /*--------------------------------------------------------------------------*/
  34930. // Export lodash.
  34931. var _ = runInContext();
  34932. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34933. if (true) {
  34934. // Expose Lodash on the global object to prevent errors when Lodash is
  34935. // loaded by a script tag in the presence of an AMD loader.
  34936. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34937. // Use `_.noConflict` to remove Lodash from the global object.
  34938. root._ = _;
  34939. // Define as an anonymous module so, through path mapping, it can be
  34940. // referenced as the "underscore" module.
  34941. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34942. return _;
  34943. }).call(exports, __webpack_require__, exports, module),
  34944. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34945. }
  34946. // Check for `exports` after `define` in case a build optimizer adds it.
  34947. else {}
  34948. }.call(this));
  34949. /* 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)))
  34950. /***/ }),
  34951. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34952. /*!***************************************************!*\
  34953. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34954. \***************************************************/
  34955. /*! exports provided: default */
  34956. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34957. "use strict";
  34958. __webpack_require__.r(__webpack_exports__);
  34959. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34960. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34961. * @version 1.16.1
  34962. * @license
  34963. * Copyright (c) 2016 Federico Zivolo and contributors
  34964. *
  34965. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34966. * of this software and associated documentation files (the "Software"), to deal
  34967. * in the Software without restriction, including without limitation the rights
  34968. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34969. * copies of the Software, and to permit persons to whom the Software is
  34970. * furnished to do so, subject to the following conditions:
  34971. *
  34972. * The above copyright notice and this permission notice shall be included in all
  34973. * copies or substantial portions of the Software.
  34974. *
  34975. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34976. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34977. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34978. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34979. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34980. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34981. * SOFTWARE.
  34982. */
  34983. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34984. var timeoutDuration = function () {
  34985. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34986. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34987. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34988. return 1;
  34989. }
  34990. }
  34991. return 0;
  34992. }();
  34993. function microtaskDebounce(fn) {
  34994. var called = false;
  34995. return function () {
  34996. if (called) {
  34997. return;
  34998. }
  34999. called = true;
  35000. window.Promise.resolve().then(function () {
  35001. called = false;
  35002. fn();
  35003. });
  35004. };
  35005. }
  35006. function taskDebounce(fn) {
  35007. var scheduled = false;
  35008. return function () {
  35009. if (!scheduled) {
  35010. scheduled = true;
  35011. setTimeout(function () {
  35012. scheduled = false;
  35013. fn();
  35014. }, timeoutDuration);
  35015. }
  35016. };
  35017. }
  35018. var supportsMicroTasks = isBrowser && window.Promise;
  35019. /**
  35020. * Create a debounced version of a method, that's asynchronously deferred
  35021. * but called in the minimum time possible.
  35022. *
  35023. * @method
  35024. * @memberof Popper.Utils
  35025. * @argument {Function} fn
  35026. * @returns {Function}
  35027. */
  35028. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35029. /**
  35030. * Check if the given variable is a function
  35031. * @method
  35032. * @memberof Popper.Utils
  35033. * @argument {Any} functionToCheck - variable to check
  35034. * @returns {Boolean} answer to: is a function?
  35035. */
  35036. function isFunction(functionToCheck) {
  35037. var getType = {};
  35038. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35039. }
  35040. /**
  35041. * Get CSS computed property of the given element
  35042. * @method
  35043. * @memberof Popper.Utils
  35044. * @argument {Eement} element
  35045. * @argument {String} property
  35046. */
  35047. function getStyleComputedProperty(element, property) {
  35048. if (element.nodeType !== 1) {
  35049. return [];
  35050. }
  35051. // NOTE: 1 DOM access here
  35052. var window = element.ownerDocument.defaultView;
  35053. var css = window.getComputedStyle(element, null);
  35054. return property ? css[property] : css;
  35055. }
  35056. /**
  35057. * Returns the parentNode or the host of the element
  35058. * @method
  35059. * @memberof Popper.Utils
  35060. * @argument {Element} element
  35061. * @returns {Element} parent
  35062. */
  35063. function getParentNode(element) {
  35064. if (element.nodeName === 'HTML') {
  35065. return element;
  35066. }
  35067. return element.parentNode || element.host;
  35068. }
  35069. /**
  35070. * Returns the scrolling parent of the given element
  35071. * @method
  35072. * @memberof Popper.Utils
  35073. * @argument {Element} element
  35074. * @returns {Element} scroll parent
  35075. */
  35076. function getScrollParent(element) {
  35077. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35078. if (!element) {
  35079. return document.body;
  35080. }
  35081. switch (element.nodeName) {
  35082. case 'HTML':
  35083. case 'BODY':
  35084. return element.ownerDocument.body;
  35085. case '#document':
  35086. return element.body;
  35087. }
  35088. // Firefox want us to check `-x` and `-y` variations as well
  35089. var _getStyleComputedProp = getStyleComputedProperty(element),
  35090. overflow = _getStyleComputedProp.overflow,
  35091. overflowX = _getStyleComputedProp.overflowX,
  35092. overflowY = _getStyleComputedProp.overflowY;
  35093. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35094. return element;
  35095. }
  35096. return getScrollParent(getParentNode(element));
  35097. }
  35098. /**
  35099. * Returns the reference node of the reference object, or the reference object itself.
  35100. * @method
  35101. * @memberof Popper.Utils
  35102. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35103. * @returns {Element} parent
  35104. */
  35105. function getReferenceNode(reference) {
  35106. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35107. }
  35108. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35109. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35110. /**
  35111. * Determines if the browser is Internet Explorer
  35112. * @method
  35113. * @memberof Popper.Utils
  35114. * @param {Number} version to check
  35115. * @returns {Boolean} isIE
  35116. */
  35117. function isIE(version) {
  35118. if (version === 11) {
  35119. return isIE11;
  35120. }
  35121. if (version === 10) {
  35122. return isIE10;
  35123. }
  35124. return isIE11 || isIE10;
  35125. }
  35126. /**
  35127. * Returns the offset parent of the given element
  35128. * @method
  35129. * @memberof Popper.Utils
  35130. * @argument {Element} element
  35131. * @returns {Element} offset parent
  35132. */
  35133. function getOffsetParent(element) {
  35134. if (!element) {
  35135. return document.documentElement;
  35136. }
  35137. var noOffsetParent = isIE(10) ? document.body : null;
  35138. // NOTE: 1 DOM access here
  35139. var offsetParent = element.offsetParent || null;
  35140. // Skip hidden elements which don't have an offsetParent
  35141. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35142. offsetParent = (element = element.nextElementSibling).offsetParent;
  35143. }
  35144. var nodeName = offsetParent && offsetParent.nodeName;
  35145. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35146. return element ? element.ownerDocument.documentElement : document.documentElement;
  35147. }
  35148. // .offsetParent will return the closest TH, TD or TABLE in case
  35149. // no offsetParent is present, I hate this job...
  35150. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35151. return getOffsetParent(offsetParent);
  35152. }
  35153. return offsetParent;
  35154. }
  35155. function isOffsetContainer(element) {
  35156. var nodeName = element.nodeName;
  35157. if (nodeName === 'BODY') {
  35158. return false;
  35159. }
  35160. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35161. }
  35162. /**
  35163. * Finds the root node (document, shadowDOM root) of the given element
  35164. * @method
  35165. * @memberof Popper.Utils
  35166. * @argument {Element} node
  35167. * @returns {Element} root node
  35168. */
  35169. function getRoot(node) {
  35170. if (node.parentNode !== null) {
  35171. return getRoot(node.parentNode);
  35172. }
  35173. return node;
  35174. }
  35175. /**
  35176. * Finds the offset parent common to the two provided nodes
  35177. * @method
  35178. * @memberof Popper.Utils
  35179. * @argument {Element} element1
  35180. * @argument {Element} element2
  35181. * @returns {Element} common offset parent
  35182. */
  35183. function findCommonOffsetParent(element1, element2) {
  35184. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35185. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35186. return document.documentElement;
  35187. }
  35188. // Here we make sure to give as "start" the element that comes first in the DOM
  35189. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35190. var start = order ? element1 : element2;
  35191. var end = order ? element2 : element1;
  35192. // Get common ancestor container
  35193. var range = document.createRange();
  35194. range.setStart(start, 0);
  35195. range.setEnd(end, 0);
  35196. var commonAncestorContainer = range.commonAncestorContainer;
  35197. // Both nodes are inside #document
  35198. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35199. if (isOffsetContainer(commonAncestorContainer)) {
  35200. return commonAncestorContainer;
  35201. }
  35202. return getOffsetParent(commonAncestorContainer);
  35203. }
  35204. // one of the nodes is inside shadowDOM, find which one
  35205. var element1root = getRoot(element1);
  35206. if (element1root.host) {
  35207. return findCommonOffsetParent(element1root.host, element2);
  35208. } else {
  35209. return findCommonOffsetParent(element1, getRoot(element2).host);
  35210. }
  35211. }
  35212. /**
  35213. * Gets the scroll value of the given element in the given side (top and left)
  35214. * @method
  35215. * @memberof Popper.Utils
  35216. * @argument {Element} element
  35217. * @argument {String} side `top` or `left`
  35218. * @returns {number} amount of scrolled pixels
  35219. */
  35220. function getScroll(element) {
  35221. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35222. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35223. var nodeName = element.nodeName;
  35224. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35225. var html = element.ownerDocument.documentElement;
  35226. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35227. return scrollingElement[upperSide];
  35228. }
  35229. return element[upperSide];
  35230. }
  35231. /*
  35232. * Sum or subtract the element scroll values (left and top) from a given rect object
  35233. * @method
  35234. * @memberof Popper.Utils
  35235. * @param {Object} rect - Rect object you want to change
  35236. * @param {HTMLElement} element - The element from the function reads the scroll values
  35237. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35238. * @return {Object} rect - The modifier rect object
  35239. */
  35240. function includeScroll(rect, element) {
  35241. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35242. var scrollTop = getScroll(element, 'top');
  35243. var scrollLeft = getScroll(element, 'left');
  35244. var modifier = subtract ? -1 : 1;
  35245. rect.top += scrollTop * modifier;
  35246. rect.bottom += scrollTop * modifier;
  35247. rect.left += scrollLeft * modifier;
  35248. rect.right += scrollLeft * modifier;
  35249. return rect;
  35250. }
  35251. /*
  35252. * Helper to detect borders of a given element
  35253. * @method
  35254. * @memberof Popper.Utils
  35255. * @param {CSSStyleDeclaration} styles
  35256. * Result of `getStyleComputedProperty` on the given element
  35257. * @param {String} axis - `x` or `y`
  35258. * @return {number} borders - The borders size of the given axis
  35259. */
  35260. function getBordersSize(styles, axis) {
  35261. var sideA = axis === 'x' ? 'Left' : 'Top';
  35262. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35263. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35264. }
  35265. function getSize(axis, body, html, computedStyle) {
  35266. 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);
  35267. }
  35268. function getWindowSizes(document) {
  35269. var body = document.body;
  35270. var html = document.documentElement;
  35271. var computedStyle = isIE(10) && getComputedStyle(html);
  35272. return {
  35273. height: getSize('Height', body, html, computedStyle),
  35274. width: getSize('Width', body, html, computedStyle)
  35275. };
  35276. }
  35277. var classCallCheck = function (instance, Constructor) {
  35278. if (!(instance instanceof Constructor)) {
  35279. throw new TypeError("Cannot call a class as a function");
  35280. }
  35281. };
  35282. var createClass = function () {
  35283. function defineProperties(target, props) {
  35284. for (var i = 0; i < props.length; i++) {
  35285. var descriptor = props[i];
  35286. descriptor.enumerable = descriptor.enumerable || false;
  35287. descriptor.configurable = true;
  35288. if ("value" in descriptor) descriptor.writable = true;
  35289. Object.defineProperty(target, descriptor.key, descriptor);
  35290. }
  35291. }
  35292. return function (Constructor, protoProps, staticProps) {
  35293. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35294. if (staticProps) defineProperties(Constructor, staticProps);
  35295. return Constructor;
  35296. };
  35297. }();
  35298. var defineProperty = function (obj, key, value) {
  35299. if (key in obj) {
  35300. Object.defineProperty(obj, key, {
  35301. value: value,
  35302. enumerable: true,
  35303. configurable: true,
  35304. writable: true
  35305. });
  35306. } else {
  35307. obj[key] = value;
  35308. }
  35309. return obj;
  35310. };
  35311. var _extends = Object.assign || function (target) {
  35312. for (var i = 1; i < arguments.length; i++) {
  35313. var source = arguments[i];
  35314. for (var key in source) {
  35315. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35316. target[key] = source[key];
  35317. }
  35318. }
  35319. }
  35320. return target;
  35321. };
  35322. /**
  35323. * Given element offsets, generate an output similar to getBoundingClientRect
  35324. * @method
  35325. * @memberof Popper.Utils
  35326. * @argument {Object} offsets
  35327. * @returns {Object} ClientRect like output
  35328. */
  35329. function getClientRect(offsets) {
  35330. return _extends({}, offsets, {
  35331. right: offsets.left + offsets.width,
  35332. bottom: offsets.top + offsets.height
  35333. });
  35334. }
  35335. /**
  35336. * Get bounding client rect of given element
  35337. * @method
  35338. * @memberof Popper.Utils
  35339. * @param {HTMLElement} element
  35340. * @return {Object} client rect
  35341. */
  35342. function getBoundingClientRect(element) {
  35343. var rect = {};
  35344. // IE10 10 FIX: Please, don't ask, the element isn't
  35345. // considered in DOM in some circumstances...
  35346. // This isn't reproducible in IE10 compatibility mode of IE11
  35347. try {
  35348. if (isIE(10)) {
  35349. rect = element.getBoundingClientRect();
  35350. var scrollTop = getScroll(element, 'top');
  35351. var scrollLeft = getScroll(element, 'left');
  35352. rect.top += scrollTop;
  35353. rect.left += scrollLeft;
  35354. rect.bottom += scrollTop;
  35355. rect.right += scrollLeft;
  35356. } else {
  35357. rect = element.getBoundingClientRect();
  35358. }
  35359. } catch (e) {}
  35360. var result = {
  35361. left: rect.left,
  35362. top: rect.top,
  35363. width: rect.right - rect.left,
  35364. height: rect.bottom - rect.top
  35365. };
  35366. // subtract scrollbar size from sizes
  35367. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35368. var width = sizes.width || element.clientWidth || result.width;
  35369. var height = sizes.height || element.clientHeight || result.height;
  35370. var horizScrollbar = element.offsetWidth - width;
  35371. var vertScrollbar = element.offsetHeight - height;
  35372. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35373. // we make this check conditional for performance reasons
  35374. if (horizScrollbar || vertScrollbar) {
  35375. var styles = getStyleComputedProperty(element);
  35376. horizScrollbar -= getBordersSize(styles, 'x');
  35377. vertScrollbar -= getBordersSize(styles, 'y');
  35378. result.width -= horizScrollbar;
  35379. result.height -= vertScrollbar;
  35380. }
  35381. return getClientRect(result);
  35382. }
  35383. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35384. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35385. var isIE10 = isIE(10);
  35386. var isHTML = parent.nodeName === 'HTML';
  35387. var childrenRect = getBoundingClientRect(children);
  35388. var parentRect = getBoundingClientRect(parent);
  35389. var scrollParent = getScrollParent(children);
  35390. var styles = getStyleComputedProperty(parent);
  35391. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35392. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35393. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35394. if (fixedPosition && isHTML) {
  35395. parentRect.top = Math.max(parentRect.top, 0);
  35396. parentRect.left = Math.max(parentRect.left, 0);
  35397. }
  35398. var offsets = getClientRect({
  35399. top: childrenRect.top - parentRect.top - borderTopWidth,
  35400. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35401. width: childrenRect.width,
  35402. height: childrenRect.height
  35403. });
  35404. offsets.marginTop = 0;
  35405. offsets.marginLeft = 0;
  35406. // Subtract margins of documentElement in case it's being used as parent
  35407. // we do this only on HTML because it's the only element that behaves
  35408. // differently when margins are applied to it. The margins are included in
  35409. // the box of the documentElement, in the other cases not.
  35410. if (!isIE10 && isHTML) {
  35411. var marginTop = parseFloat(styles.marginTop);
  35412. var marginLeft = parseFloat(styles.marginLeft);
  35413. offsets.top -= borderTopWidth - marginTop;
  35414. offsets.bottom -= borderTopWidth - marginTop;
  35415. offsets.left -= borderLeftWidth - marginLeft;
  35416. offsets.right -= borderLeftWidth - marginLeft;
  35417. // Attach marginTop and marginLeft because in some circumstances we may need them
  35418. offsets.marginTop = marginTop;
  35419. offsets.marginLeft = marginLeft;
  35420. }
  35421. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35422. offsets = includeScroll(offsets, parent);
  35423. }
  35424. return offsets;
  35425. }
  35426. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35427. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35428. var html = element.ownerDocument.documentElement;
  35429. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35430. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35431. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35432. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35433. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35434. var offset = {
  35435. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35436. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35437. width: width,
  35438. height: height
  35439. };
  35440. return getClientRect(offset);
  35441. }
  35442. /**
  35443. * Check if the given element is fixed or is inside a fixed parent
  35444. * @method
  35445. * @memberof Popper.Utils
  35446. * @argument {Element} element
  35447. * @argument {Element} customContainer
  35448. * @returns {Boolean} answer to "isFixed?"
  35449. */
  35450. function isFixed(element) {
  35451. var nodeName = element.nodeName;
  35452. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35453. return false;
  35454. }
  35455. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35456. return true;
  35457. }
  35458. var parentNode = getParentNode(element);
  35459. if (!parentNode) {
  35460. return false;
  35461. }
  35462. return isFixed(parentNode);
  35463. }
  35464. /**
  35465. * Finds the first parent of an element that has a transformed property defined
  35466. * @method
  35467. * @memberof Popper.Utils
  35468. * @argument {Element} element
  35469. * @returns {Element} first transformed parent or documentElement
  35470. */
  35471. function getFixedPositionOffsetParent(element) {
  35472. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35473. if (!element || !element.parentElement || isIE()) {
  35474. return document.documentElement;
  35475. }
  35476. var el = element.parentElement;
  35477. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35478. el = el.parentElement;
  35479. }
  35480. return el || document.documentElement;
  35481. }
  35482. /**
  35483. * Computed the boundaries limits and return them
  35484. * @method
  35485. * @memberof Popper.Utils
  35486. * @param {HTMLElement} popper
  35487. * @param {HTMLElement} reference
  35488. * @param {number} padding
  35489. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35490. * @param {Boolean} fixedPosition - Is in fixed position mode
  35491. * @returns {Object} Coordinates of the boundaries
  35492. */
  35493. function getBoundaries(popper, reference, padding, boundariesElement) {
  35494. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35495. // NOTE: 1 DOM access here
  35496. var boundaries = { top: 0, left: 0 };
  35497. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35498. // Handle viewport case
  35499. if (boundariesElement === 'viewport') {
  35500. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35501. } else {
  35502. // Handle other cases based on DOM element used as boundaries
  35503. var boundariesNode = void 0;
  35504. if (boundariesElement === 'scrollParent') {
  35505. boundariesNode = getScrollParent(getParentNode(reference));
  35506. if (boundariesNode.nodeName === 'BODY') {
  35507. boundariesNode = popper.ownerDocument.documentElement;
  35508. }
  35509. } else if (boundariesElement === 'window') {
  35510. boundariesNode = popper.ownerDocument.documentElement;
  35511. } else {
  35512. boundariesNode = boundariesElement;
  35513. }
  35514. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35515. // In case of HTML, we need a different computation
  35516. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35517. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35518. height = _getWindowSizes.height,
  35519. width = _getWindowSizes.width;
  35520. boundaries.top += offsets.top - offsets.marginTop;
  35521. boundaries.bottom = height + offsets.top;
  35522. boundaries.left += offsets.left - offsets.marginLeft;
  35523. boundaries.right = width + offsets.left;
  35524. } else {
  35525. // for all the other DOM elements, this one is good
  35526. boundaries = offsets;
  35527. }
  35528. }
  35529. // Add paddings
  35530. padding = padding || 0;
  35531. var isPaddingNumber = typeof padding === 'number';
  35532. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35533. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35534. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35535. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35536. return boundaries;
  35537. }
  35538. function getArea(_ref) {
  35539. var width = _ref.width,
  35540. height = _ref.height;
  35541. return width * height;
  35542. }
  35543. /**
  35544. * Utility used to transform the `auto` placement to the placement with more
  35545. * available space.
  35546. * @method
  35547. * @memberof Popper.Utils
  35548. * @argument {Object} data - The data object generated by update method
  35549. * @argument {Object} options - Modifiers configuration and options
  35550. * @returns {Object} The data object, properly modified
  35551. */
  35552. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35553. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35554. if (placement.indexOf('auto') === -1) {
  35555. return placement;
  35556. }
  35557. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35558. var rects = {
  35559. top: {
  35560. width: boundaries.width,
  35561. height: refRect.top - boundaries.top
  35562. },
  35563. right: {
  35564. width: boundaries.right - refRect.right,
  35565. height: boundaries.height
  35566. },
  35567. bottom: {
  35568. width: boundaries.width,
  35569. height: boundaries.bottom - refRect.bottom
  35570. },
  35571. left: {
  35572. width: refRect.left - boundaries.left,
  35573. height: boundaries.height
  35574. }
  35575. };
  35576. var sortedAreas = Object.keys(rects).map(function (key) {
  35577. return _extends({
  35578. key: key
  35579. }, rects[key], {
  35580. area: getArea(rects[key])
  35581. });
  35582. }).sort(function (a, b) {
  35583. return b.area - a.area;
  35584. });
  35585. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35586. var width = _ref2.width,
  35587. height = _ref2.height;
  35588. return width >= popper.clientWidth && height >= popper.clientHeight;
  35589. });
  35590. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35591. var variation = placement.split('-')[1];
  35592. return computedPlacement + (variation ? '-' + variation : '');
  35593. }
  35594. /**
  35595. * Get offsets to the reference element
  35596. * @method
  35597. * @memberof Popper.Utils
  35598. * @param {Object} state
  35599. * @param {Element} popper - the popper element
  35600. * @param {Element} reference - the reference element (the popper will be relative to this)
  35601. * @param {Element} fixedPosition - is in fixed position mode
  35602. * @returns {Object} An object containing the offsets which will be applied to the popper
  35603. */
  35604. function getReferenceOffsets(state, popper, reference) {
  35605. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35606. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35607. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35608. }
  35609. /**
  35610. * Get the outer sizes of the given element (offset size + margins)
  35611. * @method
  35612. * @memberof Popper.Utils
  35613. * @argument {Element} element
  35614. * @returns {Object} object containing width and height properties
  35615. */
  35616. function getOuterSizes(element) {
  35617. var window = element.ownerDocument.defaultView;
  35618. var styles = window.getComputedStyle(element);
  35619. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35620. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35621. var result = {
  35622. width: element.offsetWidth + y,
  35623. height: element.offsetHeight + x
  35624. };
  35625. return result;
  35626. }
  35627. /**
  35628. * Get the opposite placement of the given one
  35629. * @method
  35630. * @memberof Popper.Utils
  35631. * @argument {String} placement
  35632. * @returns {String} flipped placement
  35633. */
  35634. function getOppositePlacement(placement) {
  35635. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35636. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35637. return hash[matched];
  35638. });
  35639. }
  35640. /**
  35641. * Get offsets to the popper
  35642. * @method
  35643. * @memberof Popper.Utils
  35644. * @param {Object} position - CSS position the Popper will get applied
  35645. * @param {HTMLElement} popper - the popper element
  35646. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35647. * @param {String} placement - one of the valid placement options
  35648. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35649. */
  35650. function getPopperOffsets(popper, referenceOffsets, placement) {
  35651. placement = placement.split('-')[0];
  35652. // Get popper node sizes
  35653. var popperRect = getOuterSizes(popper);
  35654. // Add position, width and height to our offsets object
  35655. var popperOffsets = {
  35656. width: popperRect.width,
  35657. height: popperRect.height
  35658. };
  35659. // depending by the popper placement we have to compute its offsets slightly differently
  35660. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35661. var mainSide = isHoriz ? 'top' : 'left';
  35662. var secondarySide = isHoriz ? 'left' : 'top';
  35663. var measurement = isHoriz ? 'height' : 'width';
  35664. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35665. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35666. if (placement === secondarySide) {
  35667. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35668. } else {
  35669. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35670. }
  35671. return popperOffsets;
  35672. }
  35673. /**
  35674. * Mimics the `find` method of Array
  35675. * @method
  35676. * @memberof Popper.Utils
  35677. * @argument {Array} arr
  35678. * @argument prop
  35679. * @argument value
  35680. * @returns index or -1
  35681. */
  35682. function find(arr, check) {
  35683. // use native find if supported
  35684. if (Array.prototype.find) {
  35685. return arr.find(check);
  35686. }
  35687. // use `filter` to obtain the same behavior of `find`
  35688. return arr.filter(check)[0];
  35689. }
  35690. /**
  35691. * Return the index of the matching object
  35692. * @method
  35693. * @memberof Popper.Utils
  35694. * @argument {Array} arr
  35695. * @argument prop
  35696. * @argument value
  35697. * @returns index or -1
  35698. */
  35699. function findIndex(arr, prop, value) {
  35700. // use native findIndex if supported
  35701. if (Array.prototype.findIndex) {
  35702. return arr.findIndex(function (cur) {
  35703. return cur[prop] === value;
  35704. });
  35705. }
  35706. // use `find` + `indexOf` if `findIndex` isn't supported
  35707. var match = find(arr, function (obj) {
  35708. return obj[prop] === value;
  35709. });
  35710. return arr.indexOf(match);
  35711. }
  35712. /**
  35713. * Loop trough the list of modifiers and run them in order,
  35714. * each of them will then edit the data object.
  35715. * @method
  35716. * @memberof Popper.Utils
  35717. * @param {dataObject} data
  35718. * @param {Array} modifiers
  35719. * @param {String} ends - Optional modifier name used as stopper
  35720. * @returns {dataObject}
  35721. */
  35722. function runModifiers(modifiers, data, ends) {
  35723. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35724. modifiersToRun.forEach(function (modifier) {
  35725. if (modifier['function']) {
  35726. // eslint-disable-line dot-notation
  35727. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35728. }
  35729. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35730. if (modifier.enabled && isFunction(fn)) {
  35731. // Add properties to offsets to make them a complete clientRect object
  35732. // we do this before each modifier to make sure the previous one doesn't
  35733. // mess with these values
  35734. data.offsets.popper = getClientRect(data.offsets.popper);
  35735. data.offsets.reference = getClientRect(data.offsets.reference);
  35736. data = fn(data, modifier);
  35737. }
  35738. });
  35739. return data;
  35740. }
  35741. /**
  35742. * Updates the position of the popper, computing the new offsets and applying
  35743. * the new style.<br />
  35744. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35745. * @method
  35746. * @memberof Popper
  35747. */
  35748. function update() {
  35749. // if popper is destroyed, don't perform any further update
  35750. if (this.state.isDestroyed) {
  35751. return;
  35752. }
  35753. var data = {
  35754. instance: this,
  35755. styles: {},
  35756. arrowStyles: {},
  35757. attributes: {},
  35758. flipped: false,
  35759. offsets: {}
  35760. };
  35761. // compute reference element offsets
  35762. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35763. // compute auto placement, store placement inside the data object,
  35764. // modifiers will be able to edit `placement` if needed
  35765. // and refer to originalPlacement to know the original value
  35766. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35767. // store the computed placement inside `originalPlacement`
  35768. data.originalPlacement = data.placement;
  35769. data.positionFixed = this.options.positionFixed;
  35770. // compute the popper offsets
  35771. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35772. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35773. // run the modifiers
  35774. data = runModifiers(this.modifiers, data);
  35775. // the first `update` will call `onCreate` callback
  35776. // the other ones will call `onUpdate` callback
  35777. if (!this.state.isCreated) {
  35778. this.state.isCreated = true;
  35779. this.options.onCreate(data);
  35780. } else {
  35781. this.options.onUpdate(data);
  35782. }
  35783. }
  35784. /**
  35785. * Helper used to know if the given modifier is enabled.
  35786. * @method
  35787. * @memberof Popper.Utils
  35788. * @returns {Boolean}
  35789. */
  35790. function isModifierEnabled(modifiers, modifierName) {
  35791. return modifiers.some(function (_ref) {
  35792. var name = _ref.name,
  35793. enabled = _ref.enabled;
  35794. return enabled && name === modifierName;
  35795. });
  35796. }
  35797. /**
  35798. * Get the prefixed supported property name
  35799. * @method
  35800. * @memberof Popper.Utils
  35801. * @argument {String} property (camelCase)
  35802. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35803. */
  35804. function getSupportedPropertyName(property) {
  35805. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35806. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35807. for (var i = 0; i < prefixes.length; i++) {
  35808. var prefix = prefixes[i];
  35809. var toCheck = prefix ? '' + prefix + upperProp : property;
  35810. if (typeof document.body.style[toCheck] !== 'undefined') {
  35811. return toCheck;
  35812. }
  35813. }
  35814. return null;
  35815. }
  35816. /**
  35817. * Destroys the popper.
  35818. * @method
  35819. * @memberof Popper
  35820. */
  35821. function destroy() {
  35822. this.state.isDestroyed = true;
  35823. // touch DOM only if `applyStyle` modifier is enabled
  35824. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35825. this.popper.removeAttribute('x-placement');
  35826. this.popper.style.position = '';
  35827. this.popper.style.top = '';
  35828. this.popper.style.left = '';
  35829. this.popper.style.right = '';
  35830. this.popper.style.bottom = '';
  35831. this.popper.style.willChange = '';
  35832. this.popper.style[getSupportedPropertyName('transform')] = '';
  35833. }
  35834. this.disableEventListeners();
  35835. // remove the popper if user explicitly asked for the deletion on destroy
  35836. // do not use `remove` because IE11 doesn't support it
  35837. if (this.options.removeOnDestroy) {
  35838. this.popper.parentNode.removeChild(this.popper);
  35839. }
  35840. return this;
  35841. }
  35842. /**
  35843. * Get the window associated with the element
  35844. * @argument {Element} element
  35845. * @returns {Window}
  35846. */
  35847. function getWindow(element) {
  35848. var ownerDocument = element.ownerDocument;
  35849. return ownerDocument ? ownerDocument.defaultView : window;
  35850. }
  35851. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35852. var isBody = scrollParent.nodeName === 'BODY';
  35853. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35854. target.addEventListener(event, callback, { passive: true });
  35855. if (!isBody) {
  35856. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35857. }
  35858. scrollParents.push(target);
  35859. }
  35860. /**
  35861. * Setup needed event listeners used to update the popper position
  35862. * @method
  35863. * @memberof Popper.Utils
  35864. * @private
  35865. */
  35866. function setupEventListeners(reference, options, state, updateBound) {
  35867. // Resize event listener on window
  35868. state.updateBound = updateBound;
  35869. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35870. // Scroll event listener on scroll parents
  35871. var scrollElement = getScrollParent(reference);
  35872. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35873. state.scrollElement = scrollElement;
  35874. state.eventsEnabled = true;
  35875. return state;
  35876. }
  35877. /**
  35878. * It will add resize/scroll events and start recalculating
  35879. * position of the popper element when they are triggered.
  35880. * @method
  35881. * @memberof Popper
  35882. */
  35883. function enableEventListeners() {
  35884. if (!this.state.eventsEnabled) {
  35885. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35886. }
  35887. }
  35888. /**
  35889. * Remove event listeners used to update the popper position
  35890. * @method
  35891. * @memberof Popper.Utils
  35892. * @private
  35893. */
  35894. function removeEventListeners(reference, state) {
  35895. // Remove resize event listener on window
  35896. getWindow(reference).removeEventListener('resize', state.updateBound);
  35897. // Remove scroll event listener on scroll parents
  35898. state.scrollParents.forEach(function (target) {
  35899. target.removeEventListener('scroll', state.updateBound);
  35900. });
  35901. // Reset state
  35902. state.updateBound = null;
  35903. state.scrollParents = [];
  35904. state.scrollElement = null;
  35905. state.eventsEnabled = false;
  35906. return state;
  35907. }
  35908. /**
  35909. * It will remove resize/scroll events and won't recalculate popper position
  35910. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35911. * unless you call `update` method manually.
  35912. * @method
  35913. * @memberof Popper
  35914. */
  35915. function disableEventListeners() {
  35916. if (this.state.eventsEnabled) {
  35917. cancelAnimationFrame(this.scheduleUpdate);
  35918. this.state = removeEventListeners(this.reference, this.state);
  35919. }
  35920. }
  35921. /**
  35922. * Tells if a given input is a number
  35923. * @method
  35924. * @memberof Popper.Utils
  35925. * @param {*} input to check
  35926. * @return {Boolean}
  35927. */
  35928. function isNumeric(n) {
  35929. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35930. }
  35931. /**
  35932. * Set the style to the given popper
  35933. * @method
  35934. * @memberof Popper.Utils
  35935. * @argument {Element} element - Element to apply the style to
  35936. * @argument {Object} styles
  35937. * Object with a list of properties and values which will be applied to the element
  35938. */
  35939. function setStyles(element, styles) {
  35940. Object.keys(styles).forEach(function (prop) {
  35941. var unit = '';
  35942. // add unit if the value is numeric and is one of the following
  35943. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35944. unit = 'px';
  35945. }
  35946. element.style[prop] = styles[prop] + unit;
  35947. });
  35948. }
  35949. /**
  35950. * Set the attributes to the given popper
  35951. * @method
  35952. * @memberof Popper.Utils
  35953. * @argument {Element} element - Element to apply the attributes to
  35954. * @argument {Object} styles
  35955. * Object with a list of properties and values which will be applied to the element
  35956. */
  35957. function setAttributes(element, attributes) {
  35958. Object.keys(attributes).forEach(function (prop) {
  35959. var value = attributes[prop];
  35960. if (value !== false) {
  35961. element.setAttribute(prop, attributes[prop]);
  35962. } else {
  35963. element.removeAttribute(prop);
  35964. }
  35965. });
  35966. }
  35967. /**
  35968. * @function
  35969. * @memberof Modifiers
  35970. * @argument {Object} data - The data object generated by `update` method
  35971. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35972. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35973. * @argument {Object} options - Modifiers configuration and options
  35974. * @returns {Object} The same data object
  35975. */
  35976. function applyStyle(data) {
  35977. // any property present in `data.styles` will be applied to the popper,
  35978. // in this way we can make the 3rd party modifiers add custom styles to it
  35979. // Be aware, modifiers could override the properties defined in the previous
  35980. // lines of this modifier!
  35981. setStyles(data.instance.popper, data.styles);
  35982. // any property present in `data.attributes` will be applied to the popper,
  35983. // they will be set as HTML attributes of the element
  35984. setAttributes(data.instance.popper, data.attributes);
  35985. // if arrowElement is defined and arrowStyles has some properties
  35986. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35987. setStyles(data.arrowElement, data.arrowStyles);
  35988. }
  35989. return data;
  35990. }
  35991. /**
  35992. * Set the x-placement attribute before everything else because it could be used
  35993. * to add margins to the popper margins needs to be calculated to get the
  35994. * correct popper offsets.
  35995. * @method
  35996. * @memberof Popper.modifiers
  35997. * @param {HTMLElement} reference - The reference element used to position the popper
  35998. * @param {HTMLElement} popper - The HTML element used as popper
  35999. * @param {Object} options - Popper.js options
  36000. */
  36001. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36002. // compute reference element offsets
  36003. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36004. // compute auto placement, store placement inside the data object,
  36005. // modifiers will be able to edit `placement` if needed
  36006. // and refer to originalPlacement to know the original value
  36007. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36008. popper.setAttribute('x-placement', placement);
  36009. // Apply `position` to popper before anything else because
  36010. // without the position applied we can't guarantee correct computations
  36011. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36012. return options;
  36013. }
  36014. /**
  36015. * @function
  36016. * @memberof Popper.Utils
  36017. * @argument {Object} data - The data object generated by `update` method
  36018. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36019. * @returns {Object} The popper's position offsets rounded
  36020. *
  36021. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36022. * good as it can be within reason.
  36023. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36024. *
  36025. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36026. * as well on High DPI screens).
  36027. *
  36028. * Firefox prefers no rounding for positioning and does not have blurriness on
  36029. * high DPI screens.
  36030. *
  36031. * Only horizontal placement and left/right values need to be considered.
  36032. */
  36033. function getRoundedOffsets(data, shouldRound) {
  36034. var _data$offsets = data.offsets,
  36035. popper = _data$offsets.popper,
  36036. reference = _data$offsets.reference;
  36037. var round = Math.round,
  36038. floor = Math.floor;
  36039. var noRound = function noRound(v) {
  36040. return v;
  36041. };
  36042. var referenceWidth = round(reference.width);
  36043. var popperWidth = round(popper.width);
  36044. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36045. var isVariation = data.placement.indexOf('-') !== -1;
  36046. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36047. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36048. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36049. var verticalToInteger = !shouldRound ? noRound : round;
  36050. return {
  36051. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36052. top: verticalToInteger(popper.top),
  36053. bottom: verticalToInteger(popper.bottom),
  36054. right: horizontalToInteger(popper.right)
  36055. };
  36056. }
  36057. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36058. /**
  36059. * @function
  36060. * @memberof Modifiers
  36061. * @argument {Object} data - The data object generated by `update` method
  36062. * @argument {Object} options - Modifiers configuration and options
  36063. * @returns {Object} The data object, properly modified
  36064. */
  36065. function computeStyle(data, options) {
  36066. var x = options.x,
  36067. y = options.y;
  36068. var popper = data.offsets.popper;
  36069. // Remove this legacy support in Popper.js v2
  36070. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36071. return modifier.name === 'applyStyle';
  36072. }).gpuAcceleration;
  36073. if (legacyGpuAccelerationOption !== undefined) {
  36074. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36075. }
  36076. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36077. var offsetParent = getOffsetParent(data.instance.popper);
  36078. var offsetParentRect = getBoundingClientRect(offsetParent);
  36079. // Styles
  36080. var styles = {
  36081. position: popper.position
  36082. };
  36083. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36084. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36085. var sideB = y === 'right' ? 'left' : 'right';
  36086. // if gpuAcceleration is set to `true` and transform is supported,
  36087. // we use `translate3d` to apply the position to the popper we
  36088. // automatically use the supported prefixed version if needed
  36089. var prefixedProperty = getSupportedPropertyName('transform');
  36090. // now, let's make a step back and look at this code closely (wtf?)
  36091. // If the content of the popper grows once it's been positioned, it
  36092. // may happen that the popper gets misplaced because of the new content
  36093. // overflowing its reference element
  36094. // To avoid this problem, we provide two options (x and y), which allow
  36095. // the consumer to define the offset origin.
  36096. // If we position a popper on top of a reference element, we can set
  36097. // `x` to `top` to make the popper grow towards its top instead of
  36098. // its bottom.
  36099. var left = void 0,
  36100. top = void 0;
  36101. if (sideA === 'bottom') {
  36102. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36103. // and not the bottom of the html element
  36104. if (offsetParent.nodeName === 'HTML') {
  36105. top = -offsetParent.clientHeight + offsets.bottom;
  36106. } else {
  36107. top = -offsetParentRect.height + offsets.bottom;
  36108. }
  36109. } else {
  36110. top = offsets.top;
  36111. }
  36112. if (sideB === 'right') {
  36113. if (offsetParent.nodeName === 'HTML') {
  36114. left = -offsetParent.clientWidth + offsets.right;
  36115. } else {
  36116. left = -offsetParentRect.width + offsets.right;
  36117. }
  36118. } else {
  36119. left = offsets.left;
  36120. }
  36121. if (gpuAcceleration && prefixedProperty) {
  36122. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36123. styles[sideA] = 0;
  36124. styles[sideB] = 0;
  36125. styles.willChange = 'transform';
  36126. } else {
  36127. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36128. var invertTop = sideA === 'bottom' ? -1 : 1;
  36129. var invertLeft = sideB === 'right' ? -1 : 1;
  36130. styles[sideA] = top * invertTop;
  36131. styles[sideB] = left * invertLeft;
  36132. styles.willChange = sideA + ', ' + sideB;
  36133. }
  36134. // Attributes
  36135. var attributes = {
  36136. 'x-placement': data.placement
  36137. };
  36138. // Update `data` attributes, styles and arrowStyles
  36139. data.attributes = _extends({}, attributes, data.attributes);
  36140. data.styles = _extends({}, styles, data.styles);
  36141. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36142. return data;
  36143. }
  36144. /**
  36145. * Helper used to know if the given modifier depends from another one.<br />
  36146. * It checks if the needed modifier is listed and enabled.
  36147. * @method
  36148. * @memberof Popper.Utils
  36149. * @param {Array} modifiers - list of modifiers
  36150. * @param {String} requestingName - name of requesting modifier
  36151. * @param {String} requestedName - name of requested modifier
  36152. * @returns {Boolean}
  36153. */
  36154. function isModifierRequired(modifiers, requestingName, requestedName) {
  36155. var requesting = find(modifiers, function (_ref) {
  36156. var name = _ref.name;
  36157. return name === requestingName;
  36158. });
  36159. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36160. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36161. });
  36162. if (!isRequired) {
  36163. var _requesting = '`' + requestingName + '`';
  36164. var requested = '`' + requestedName + '`';
  36165. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36166. }
  36167. return isRequired;
  36168. }
  36169. /**
  36170. * @function
  36171. * @memberof Modifiers
  36172. * @argument {Object} data - The data object generated by update method
  36173. * @argument {Object} options - Modifiers configuration and options
  36174. * @returns {Object} The data object, properly modified
  36175. */
  36176. function arrow(data, options) {
  36177. var _data$offsets$arrow;
  36178. // arrow depends on keepTogether in order to work
  36179. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36180. return data;
  36181. }
  36182. var arrowElement = options.element;
  36183. // if arrowElement is a string, suppose it's a CSS selector
  36184. if (typeof arrowElement === 'string') {
  36185. arrowElement = data.instance.popper.querySelector(arrowElement);
  36186. // if arrowElement is not found, don't run the modifier
  36187. if (!arrowElement) {
  36188. return data;
  36189. }
  36190. } else {
  36191. // if the arrowElement isn't a query selector we must check that the
  36192. // provided DOM node is child of its popper node
  36193. if (!data.instance.popper.contains(arrowElement)) {
  36194. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36195. return data;
  36196. }
  36197. }
  36198. var placement = data.placement.split('-')[0];
  36199. var _data$offsets = data.offsets,
  36200. popper = _data$offsets.popper,
  36201. reference = _data$offsets.reference;
  36202. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36203. var len = isVertical ? 'height' : 'width';
  36204. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36205. var side = sideCapitalized.toLowerCase();
  36206. var altSide = isVertical ? 'left' : 'top';
  36207. var opSide = isVertical ? 'bottom' : 'right';
  36208. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36209. //
  36210. // extends keepTogether behavior making sure the popper and its
  36211. // reference have enough pixels in conjunction
  36212. //
  36213. // top/left side
  36214. if (reference[opSide] - arrowElementSize < popper[side]) {
  36215. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36216. }
  36217. // bottom/right side
  36218. if (reference[side] + arrowElementSize > popper[opSide]) {
  36219. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36220. }
  36221. data.offsets.popper = getClientRect(data.offsets.popper);
  36222. // compute center of the popper
  36223. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36224. // Compute the sideValue using the updated popper offsets
  36225. // take popper margin in account because we don't have this info available
  36226. var css = getStyleComputedProperty(data.instance.popper);
  36227. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36228. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36229. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36230. // prevent arrowElement from being placed not contiguously to its popper
  36231. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36232. data.arrowElement = arrowElement;
  36233. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36234. return data;
  36235. }
  36236. /**
  36237. * Get the opposite placement variation of the given one
  36238. * @method
  36239. * @memberof Popper.Utils
  36240. * @argument {String} placement variation
  36241. * @returns {String} flipped placement variation
  36242. */
  36243. function getOppositeVariation(variation) {
  36244. if (variation === 'end') {
  36245. return 'start';
  36246. } else if (variation === 'start') {
  36247. return 'end';
  36248. }
  36249. return variation;
  36250. }
  36251. /**
  36252. * List of accepted placements to use as values of the `placement` option.<br />
  36253. * Valid placements are:
  36254. * - `auto`
  36255. * - `top`
  36256. * - `right`
  36257. * - `bottom`
  36258. * - `left`
  36259. *
  36260. * Each placement can have a variation from this list:
  36261. * - `-start`
  36262. * - `-end`
  36263. *
  36264. * Variations are interpreted easily if you think of them as the left to right
  36265. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36266. * is right.<br />
  36267. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36268. *
  36269. * Some valid examples are:
  36270. * - `top-end` (on top of reference, right aligned)
  36271. * - `right-start` (on right of reference, top aligned)
  36272. * - `bottom` (on bottom, centered)
  36273. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36274. *
  36275. * @static
  36276. * @type {Array}
  36277. * @enum {String}
  36278. * @readonly
  36279. * @method placements
  36280. * @memberof Popper
  36281. */
  36282. 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'];
  36283. // Get rid of `auto` `auto-start` and `auto-end`
  36284. var validPlacements = placements.slice(3);
  36285. /**
  36286. * Given an initial placement, returns all the subsequent placements
  36287. * clockwise (or counter-clockwise).
  36288. *
  36289. * @method
  36290. * @memberof Popper.Utils
  36291. * @argument {String} placement - A valid placement (it accepts variations)
  36292. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36293. * @returns {Array} placements including their variations
  36294. */
  36295. function clockwise(placement) {
  36296. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36297. var index = validPlacements.indexOf(placement);
  36298. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36299. return counter ? arr.reverse() : arr;
  36300. }
  36301. var BEHAVIORS = {
  36302. FLIP: 'flip',
  36303. CLOCKWISE: 'clockwise',
  36304. COUNTERCLOCKWISE: 'counterclockwise'
  36305. };
  36306. /**
  36307. * @function
  36308. * @memberof Modifiers
  36309. * @argument {Object} data - The data object generated by update method
  36310. * @argument {Object} options - Modifiers configuration and options
  36311. * @returns {Object} The data object, properly modified
  36312. */
  36313. function flip(data, options) {
  36314. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36315. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36316. return data;
  36317. }
  36318. if (data.flipped && data.placement === data.originalPlacement) {
  36319. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36320. return data;
  36321. }
  36322. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36323. var placement = data.placement.split('-')[0];
  36324. var placementOpposite = getOppositePlacement(placement);
  36325. var variation = data.placement.split('-')[1] || '';
  36326. var flipOrder = [];
  36327. switch (options.behavior) {
  36328. case BEHAVIORS.FLIP:
  36329. flipOrder = [placement, placementOpposite];
  36330. break;
  36331. case BEHAVIORS.CLOCKWISE:
  36332. flipOrder = clockwise(placement);
  36333. break;
  36334. case BEHAVIORS.COUNTERCLOCKWISE:
  36335. flipOrder = clockwise(placement, true);
  36336. break;
  36337. default:
  36338. flipOrder = options.behavior;
  36339. }
  36340. flipOrder.forEach(function (step, index) {
  36341. if (placement !== step || flipOrder.length === index + 1) {
  36342. return data;
  36343. }
  36344. placement = data.placement.split('-')[0];
  36345. placementOpposite = getOppositePlacement(placement);
  36346. var popperOffsets = data.offsets.popper;
  36347. var refOffsets = data.offsets.reference;
  36348. // using floor because the reference offsets may contain decimals we are not going to consider here
  36349. var floor = Math.floor;
  36350. 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);
  36351. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36352. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36353. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36354. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36355. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36356. // flip the variation if required
  36357. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36358. // flips variation if reference element overflows boundaries
  36359. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36360. // flips variation if popper content overflows boundaries
  36361. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36362. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36363. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36364. // this boolean to detect any flip loop
  36365. data.flipped = true;
  36366. if (overlapsRef || overflowsBoundaries) {
  36367. placement = flipOrder[index + 1];
  36368. }
  36369. if (flippedVariation) {
  36370. variation = getOppositeVariation(variation);
  36371. }
  36372. data.placement = placement + (variation ? '-' + variation : '');
  36373. // this object contains `position`, we want to preserve it along with
  36374. // any additional property we may add in the future
  36375. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36376. data = runModifiers(data.instance.modifiers, data, 'flip');
  36377. }
  36378. });
  36379. return data;
  36380. }
  36381. /**
  36382. * @function
  36383. * @memberof Modifiers
  36384. * @argument {Object} data - The data object generated by update method
  36385. * @argument {Object} options - Modifiers configuration and options
  36386. * @returns {Object} The data object, properly modified
  36387. */
  36388. function keepTogether(data) {
  36389. var _data$offsets = data.offsets,
  36390. popper = _data$offsets.popper,
  36391. reference = _data$offsets.reference;
  36392. var placement = data.placement.split('-')[0];
  36393. var floor = Math.floor;
  36394. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36395. var side = isVertical ? 'right' : 'bottom';
  36396. var opSide = isVertical ? 'left' : 'top';
  36397. var measurement = isVertical ? 'width' : 'height';
  36398. if (popper[side] < floor(reference[opSide])) {
  36399. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36400. }
  36401. if (popper[opSide] > floor(reference[side])) {
  36402. data.offsets.popper[opSide] = floor(reference[side]);
  36403. }
  36404. return data;
  36405. }
  36406. /**
  36407. * Converts a string containing value + unit into a px value number
  36408. * @function
  36409. * @memberof {modifiers~offset}
  36410. * @private
  36411. * @argument {String} str - Value + unit string
  36412. * @argument {String} measurement - `height` or `width`
  36413. * @argument {Object} popperOffsets
  36414. * @argument {Object} referenceOffsets
  36415. * @returns {Number|String}
  36416. * Value in pixels, or original string if no values were extracted
  36417. */
  36418. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36419. // separate value from unit
  36420. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36421. var value = +split[1];
  36422. var unit = split[2];
  36423. // If it's not a number it's an operator, I guess
  36424. if (!value) {
  36425. return str;
  36426. }
  36427. if (unit.indexOf('%') === 0) {
  36428. var element = void 0;
  36429. switch (unit) {
  36430. case '%p':
  36431. element = popperOffsets;
  36432. break;
  36433. case '%':
  36434. case '%r':
  36435. default:
  36436. element = referenceOffsets;
  36437. }
  36438. var rect = getClientRect(element);
  36439. return rect[measurement] / 100 * value;
  36440. } else if (unit === 'vh' || unit === 'vw') {
  36441. // if is a vh or vw, we calculate the size based on the viewport
  36442. var size = void 0;
  36443. if (unit === 'vh') {
  36444. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36445. } else {
  36446. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36447. }
  36448. return size / 100 * value;
  36449. } else {
  36450. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36451. // if is an implicit unit, it's px, and we return just the value
  36452. return value;
  36453. }
  36454. }
  36455. /**
  36456. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36457. * @function
  36458. * @memberof {modifiers~offset}
  36459. * @private
  36460. * @argument {String} offset
  36461. * @argument {Object} popperOffsets
  36462. * @argument {Object} referenceOffsets
  36463. * @argument {String} basePlacement
  36464. * @returns {Array} a two cells array with x and y offsets in numbers
  36465. */
  36466. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36467. var offsets = [0, 0];
  36468. // Use height if placement is left or right and index is 0 otherwise use width
  36469. // in this way the first offset will use an axis and the second one
  36470. // will use the other one
  36471. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36472. // Split the offset string to obtain a list of values and operands
  36473. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36474. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36475. return frag.trim();
  36476. });
  36477. // Detect if the offset string contains a pair of values or a single one
  36478. // they could be separated by comma or space
  36479. var divider = fragments.indexOf(find(fragments, function (frag) {
  36480. return frag.search(/,|\s/) !== -1;
  36481. }));
  36482. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36483. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36484. }
  36485. // If divider is found, we divide the list of values and operands to divide
  36486. // them by ofset X and Y.
  36487. var splitRegex = /\s*,\s*|\s+/;
  36488. 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];
  36489. // Convert the values with units to absolute pixels to allow our computations
  36490. ops = ops.map(function (op, index) {
  36491. // Most of the units rely on the orientation of the popper
  36492. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36493. var mergeWithPrevious = false;
  36494. return op
  36495. // This aggregates any `+` or `-` sign that aren't considered operators
  36496. // e.g.: 10 + +5 => [10, +, +5]
  36497. .reduce(function (a, b) {
  36498. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36499. a[a.length - 1] = b;
  36500. mergeWithPrevious = true;
  36501. return a;
  36502. } else if (mergeWithPrevious) {
  36503. a[a.length - 1] += b;
  36504. mergeWithPrevious = false;
  36505. return a;
  36506. } else {
  36507. return a.concat(b);
  36508. }
  36509. }, [])
  36510. // Here we convert the string values into number values (in px)
  36511. .map(function (str) {
  36512. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36513. });
  36514. });
  36515. // Loop trough the offsets arrays and execute the operations
  36516. ops.forEach(function (op, index) {
  36517. op.forEach(function (frag, index2) {
  36518. if (isNumeric(frag)) {
  36519. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36520. }
  36521. });
  36522. });
  36523. return offsets;
  36524. }
  36525. /**
  36526. * @function
  36527. * @memberof Modifiers
  36528. * @argument {Object} data - The data object generated by update method
  36529. * @argument {Object} options - Modifiers configuration and options
  36530. * @argument {Number|String} options.offset=0
  36531. * The offset value as described in the modifier description
  36532. * @returns {Object} The data object, properly modified
  36533. */
  36534. function offset(data, _ref) {
  36535. var offset = _ref.offset;
  36536. var placement = data.placement,
  36537. _data$offsets = data.offsets,
  36538. popper = _data$offsets.popper,
  36539. reference = _data$offsets.reference;
  36540. var basePlacement = placement.split('-')[0];
  36541. var offsets = void 0;
  36542. if (isNumeric(+offset)) {
  36543. offsets = [+offset, 0];
  36544. } else {
  36545. offsets = parseOffset(offset, popper, reference, basePlacement);
  36546. }
  36547. if (basePlacement === 'left') {
  36548. popper.top += offsets[0];
  36549. popper.left -= offsets[1];
  36550. } else if (basePlacement === 'right') {
  36551. popper.top += offsets[0];
  36552. popper.left += offsets[1];
  36553. } else if (basePlacement === 'top') {
  36554. popper.left += offsets[0];
  36555. popper.top -= offsets[1];
  36556. } else if (basePlacement === 'bottom') {
  36557. popper.left += offsets[0];
  36558. popper.top += offsets[1];
  36559. }
  36560. data.popper = popper;
  36561. return data;
  36562. }
  36563. /**
  36564. * @function
  36565. * @memberof Modifiers
  36566. * @argument {Object} data - The data object generated by `update` method
  36567. * @argument {Object} options - Modifiers configuration and options
  36568. * @returns {Object} The data object, properly modified
  36569. */
  36570. function preventOverflow(data, options) {
  36571. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36572. // If offsetParent is the reference element, we really want to
  36573. // go one step up and use the next offsetParent as reference to
  36574. // avoid to make this modifier completely useless and look like broken
  36575. if (data.instance.reference === boundariesElement) {
  36576. boundariesElement = getOffsetParent(boundariesElement);
  36577. }
  36578. // NOTE: DOM access here
  36579. // resets the popper's position so that the document size can be calculated excluding
  36580. // the size of the popper element itself
  36581. var transformProp = getSupportedPropertyName('transform');
  36582. var popperStyles = data.instance.popper.style; // assignment to help minification
  36583. var top = popperStyles.top,
  36584. left = popperStyles.left,
  36585. transform = popperStyles[transformProp];
  36586. popperStyles.top = '';
  36587. popperStyles.left = '';
  36588. popperStyles[transformProp] = '';
  36589. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36590. // NOTE: DOM access here
  36591. // restores the original style properties after the offsets have been computed
  36592. popperStyles.top = top;
  36593. popperStyles.left = left;
  36594. popperStyles[transformProp] = transform;
  36595. options.boundaries = boundaries;
  36596. var order = options.priority;
  36597. var popper = data.offsets.popper;
  36598. var check = {
  36599. primary: function primary(placement) {
  36600. var value = popper[placement];
  36601. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36602. value = Math.max(popper[placement], boundaries[placement]);
  36603. }
  36604. return defineProperty({}, placement, value);
  36605. },
  36606. secondary: function secondary(placement) {
  36607. var mainSide = placement === 'right' ? 'left' : 'top';
  36608. var value = popper[mainSide];
  36609. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36610. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36611. }
  36612. return defineProperty({}, mainSide, value);
  36613. }
  36614. };
  36615. order.forEach(function (placement) {
  36616. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36617. popper = _extends({}, popper, check[side](placement));
  36618. });
  36619. data.offsets.popper = popper;
  36620. return data;
  36621. }
  36622. /**
  36623. * @function
  36624. * @memberof Modifiers
  36625. * @argument {Object} data - The data object generated by `update` method
  36626. * @argument {Object} options - Modifiers configuration and options
  36627. * @returns {Object} The data object, properly modified
  36628. */
  36629. function shift(data) {
  36630. var placement = data.placement;
  36631. var basePlacement = placement.split('-')[0];
  36632. var shiftvariation = placement.split('-')[1];
  36633. // if shift shiftvariation is specified, run the modifier
  36634. if (shiftvariation) {
  36635. var _data$offsets = data.offsets,
  36636. reference = _data$offsets.reference,
  36637. popper = _data$offsets.popper;
  36638. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36639. var side = isVertical ? 'left' : 'top';
  36640. var measurement = isVertical ? 'width' : 'height';
  36641. var shiftOffsets = {
  36642. start: defineProperty({}, side, reference[side]),
  36643. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36644. };
  36645. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36646. }
  36647. return data;
  36648. }
  36649. /**
  36650. * @function
  36651. * @memberof Modifiers
  36652. * @argument {Object} data - The data object generated by update method
  36653. * @argument {Object} options - Modifiers configuration and options
  36654. * @returns {Object} The data object, properly modified
  36655. */
  36656. function hide(data) {
  36657. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36658. return data;
  36659. }
  36660. var refRect = data.offsets.reference;
  36661. var bound = find(data.instance.modifiers, function (modifier) {
  36662. return modifier.name === 'preventOverflow';
  36663. }).boundaries;
  36664. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36665. // Avoid unnecessary DOM access if visibility hasn't changed
  36666. if (data.hide === true) {
  36667. return data;
  36668. }
  36669. data.hide = true;
  36670. data.attributes['x-out-of-boundaries'] = '';
  36671. } else {
  36672. // Avoid unnecessary DOM access if visibility hasn't changed
  36673. if (data.hide === false) {
  36674. return data;
  36675. }
  36676. data.hide = false;
  36677. data.attributes['x-out-of-boundaries'] = false;
  36678. }
  36679. return data;
  36680. }
  36681. /**
  36682. * @function
  36683. * @memberof Modifiers
  36684. * @argument {Object} data - The data object generated by `update` method
  36685. * @argument {Object} options - Modifiers configuration and options
  36686. * @returns {Object} The data object, properly modified
  36687. */
  36688. function inner(data) {
  36689. var placement = data.placement;
  36690. var basePlacement = placement.split('-')[0];
  36691. var _data$offsets = data.offsets,
  36692. popper = _data$offsets.popper,
  36693. reference = _data$offsets.reference;
  36694. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36695. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36696. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36697. data.placement = getOppositePlacement(placement);
  36698. data.offsets.popper = getClientRect(popper);
  36699. return data;
  36700. }
  36701. /**
  36702. * Modifier function, each modifier can have a function of this type assigned
  36703. * to its `fn` property.<br />
  36704. * These functions will be called on each update, this means that you must
  36705. * make sure they are performant enough to avoid performance bottlenecks.
  36706. *
  36707. * @function ModifierFn
  36708. * @argument {dataObject} data - The data object generated by `update` method
  36709. * @argument {Object} options - Modifiers configuration and options
  36710. * @returns {dataObject} The data object, properly modified
  36711. */
  36712. /**
  36713. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36714. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36715. * needed by the library.
  36716. *
  36717. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36718. * All the other properties are configurations that could be tweaked.
  36719. * @namespace modifiers
  36720. */
  36721. var modifiers = {
  36722. /**
  36723. * Modifier used to shift the popper on the start or end of its reference
  36724. * element.<br />
  36725. * It will read the variation of the `placement` property.<br />
  36726. * It can be one either `-end` or `-start`.
  36727. * @memberof modifiers
  36728. * @inner
  36729. */
  36730. shift: {
  36731. /** @prop {number} order=100 - Index used to define the order of execution */
  36732. order: 100,
  36733. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36734. enabled: true,
  36735. /** @prop {ModifierFn} */
  36736. fn: shift
  36737. },
  36738. /**
  36739. * The `offset` modifier can shift your popper on both its axis.
  36740. *
  36741. * It accepts the following units:
  36742. * - `px` or unit-less, interpreted as pixels
  36743. * - `%` or `%r`, percentage relative to the length of the reference element
  36744. * - `%p`, percentage relative to the length of the popper element
  36745. * - `vw`, CSS viewport width unit
  36746. * - `vh`, CSS viewport height unit
  36747. *
  36748. * For length is intended the main axis relative to the placement of the popper.<br />
  36749. * This means that if the placement is `top` or `bottom`, the length will be the
  36750. * `width`. In case of `left` or `right`, it will be the `height`.
  36751. *
  36752. * You can provide a single value (as `Number` or `String`), or a pair of values
  36753. * as `String` divided by a comma or one (or more) white spaces.<br />
  36754. * The latter is a deprecated method because it leads to confusion and will be
  36755. * removed in v2.<br />
  36756. * Additionally, it accepts additions and subtractions between different units.
  36757. * Note that multiplications and divisions aren't supported.
  36758. *
  36759. * Valid examples are:
  36760. * ```
  36761. * 10
  36762. * '10%'
  36763. * '10, 10'
  36764. * '10%, 10'
  36765. * '10 + 10%'
  36766. * '10 - 5vh + 3%'
  36767. * '-10px + 5vh, 5px - 6%'
  36768. * ```
  36769. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36770. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36771. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36772. *
  36773. * @memberof modifiers
  36774. * @inner
  36775. */
  36776. offset: {
  36777. /** @prop {number} order=200 - Index used to define the order of execution */
  36778. order: 200,
  36779. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36780. enabled: true,
  36781. /** @prop {ModifierFn} */
  36782. fn: offset,
  36783. /** @prop {Number|String} offset=0
  36784. * The offset value as described in the modifier description
  36785. */
  36786. offset: 0
  36787. },
  36788. /**
  36789. * Modifier used to prevent the popper from being positioned outside the boundary.
  36790. *
  36791. * A scenario exists where the reference itself is not within the boundaries.<br />
  36792. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36793. * In this case we need to decide whether the popper should either:
  36794. *
  36795. * - detach from the reference and remain "trapped" in the boundaries, or
  36796. * - if it should ignore the boundary and "escape with its reference"
  36797. *
  36798. * When `escapeWithReference` is set to`true` and reference is completely
  36799. * outside its boundaries, the popper will overflow (or completely leave)
  36800. * the boundaries in order to remain attached to the edge of the reference.
  36801. *
  36802. * @memberof modifiers
  36803. * @inner
  36804. */
  36805. preventOverflow: {
  36806. /** @prop {number} order=300 - Index used to define the order of execution */
  36807. order: 300,
  36808. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36809. enabled: true,
  36810. /** @prop {ModifierFn} */
  36811. fn: preventOverflow,
  36812. /**
  36813. * @prop {Array} [priority=['left','right','top','bottom']]
  36814. * Popper will try to prevent overflow following these priorities by default,
  36815. * then, it could overflow on the left and on top of the `boundariesElement`
  36816. */
  36817. priority: ['left', 'right', 'top', 'bottom'],
  36818. /**
  36819. * @prop {number} padding=5
  36820. * Amount of pixel used to define a minimum distance between the boundaries
  36821. * and the popper. This makes sure the popper always has a little padding
  36822. * between the edges of its container
  36823. */
  36824. padding: 5,
  36825. /**
  36826. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36827. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36828. * `viewport` or any DOM element.
  36829. */
  36830. boundariesElement: 'scrollParent'
  36831. },
  36832. /**
  36833. * Modifier used to make sure the reference and its popper stay near each other
  36834. * without leaving any gap between the two. Especially useful when the arrow is
  36835. * enabled and you want to ensure that it points to its reference element.
  36836. * It cares only about the first axis. You can still have poppers with margin
  36837. * between the popper and its reference element.
  36838. * @memberof modifiers
  36839. * @inner
  36840. */
  36841. keepTogether: {
  36842. /** @prop {number} order=400 - Index used to define the order of execution */
  36843. order: 400,
  36844. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36845. enabled: true,
  36846. /** @prop {ModifierFn} */
  36847. fn: keepTogether
  36848. },
  36849. /**
  36850. * This modifier is used to move the `arrowElement` of the popper to make
  36851. * sure it is positioned between the reference element and its popper element.
  36852. * It will read the outer size of the `arrowElement` node to detect how many
  36853. * pixels of conjunction are needed.
  36854. *
  36855. * It has no effect if no `arrowElement` is provided.
  36856. * @memberof modifiers
  36857. * @inner
  36858. */
  36859. arrow: {
  36860. /** @prop {number} order=500 - Index used to define the order of execution */
  36861. order: 500,
  36862. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36863. enabled: true,
  36864. /** @prop {ModifierFn} */
  36865. fn: arrow,
  36866. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36867. element: '[x-arrow]'
  36868. },
  36869. /**
  36870. * Modifier used to flip the popper's placement when it starts to overlap its
  36871. * reference element.
  36872. *
  36873. * Requires the `preventOverflow` modifier before it in order to work.
  36874. *
  36875. * **NOTE:** this modifier will interrupt the current update cycle and will
  36876. * restart it if it detects the need to flip the placement.
  36877. * @memberof modifiers
  36878. * @inner
  36879. */
  36880. flip: {
  36881. /** @prop {number} order=600 - Index used to define the order of execution */
  36882. order: 600,
  36883. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36884. enabled: true,
  36885. /** @prop {ModifierFn} */
  36886. fn: flip,
  36887. /**
  36888. * @prop {String|Array} behavior='flip'
  36889. * The behavior used to change the popper's placement. It can be one of
  36890. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36891. * placements (with optional variations)
  36892. */
  36893. behavior: 'flip',
  36894. /**
  36895. * @prop {number} padding=5
  36896. * The popper will flip if it hits the edges of the `boundariesElement`
  36897. */
  36898. padding: 5,
  36899. /**
  36900. * @prop {String|HTMLElement} boundariesElement='viewport'
  36901. * The element which will define the boundaries of the popper position.
  36902. * The popper will never be placed outside of the defined boundaries
  36903. * (except if `keepTogether` is enabled)
  36904. */
  36905. boundariesElement: 'viewport',
  36906. /**
  36907. * @prop {Boolean} flipVariations=false
  36908. * The popper will switch placement variation between `-start` and `-end` when
  36909. * the reference element overlaps its boundaries.
  36910. *
  36911. * The original placement should have a set variation.
  36912. */
  36913. flipVariations: false,
  36914. /**
  36915. * @prop {Boolean} flipVariationsByContent=false
  36916. * The popper will switch placement variation between `-start` and `-end` when
  36917. * the popper element overlaps its reference boundaries.
  36918. *
  36919. * The original placement should have a set variation.
  36920. */
  36921. flipVariationsByContent: false
  36922. },
  36923. /**
  36924. * Modifier used to make the popper flow toward the inner of the reference element.
  36925. * By default, when this modifier is disabled, the popper will be placed outside
  36926. * the reference element.
  36927. * @memberof modifiers
  36928. * @inner
  36929. */
  36930. inner: {
  36931. /** @prop {number} order=700 - Index used to define the order of execution */
  36932. order: 700,
  36933. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36934. enabled: false,
  36935. /** @prop {ModifierFn} */
  36936. fn: inner
  36937. },
  36938. /**
  36939. * Modifier used to hide the popper when its reference element is outside of the
  36940. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36941. * be used to hide with a CSS selector the popper when its reference is
  36942. * out of boundaries.
  36943. *
  36944. * Requires the `preventOverflow` modifier before it in order to work.
  36945. * @memberof modifiers
  36946. * @inner
  36947. */
  36948. hide: {
  36949. /** @prop {number} order=800 - Index used to define the order of execution */
  36950. order: 800,
  36951. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36952. enabled: true,
  36953. /** @prop {ModifierFn} */
  36954. fn: hide
  36955. },
  36956. /**
  36957. * Computes the style that will be applied to the popper element to gets
  36958. * properly positioned.
  36959. *
  36960. * Note that this modifier will not touch the DOM, it just prepares the styles
  36961. * so that `applyStyle` modifier can apply it. This separation is useful
  36962. * in case you need to replace `applyStyle` with a custom implementation.
  36963. *
  36964. * This modifier has `850` as `order` value to maintain backward compatibility
  36965. * with previous versions of Popper.js. Expect the modifiers ordering method
  36966. * to change in future major versions of the library.
  36967. *
  36968. * @memberof modifiers
  36969. * @inner
  36970. */
  36971. computeStyle: {
  36972. /** @prop {number} order=850 - Index used to define the order of execution */
  36973. order: 850,
  36974. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36975. enabled: true,
  36976. /** @prop {ModifierFn} */
  36977. fn: computeStyle,
  36978. /**
  36979. * @prop {Boolean} gpuAcceleration=true
  36980. * If true, it uses the CSS 3D transformation to position the popper.
  36981. * Otherwise, it will use the `top` and `left` properties
  36982. */
  36983. gpuAcceleration: true,
  36984. /**
  36985. * @prop {string} [x='bottom']
  36986. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36987. * Change this if your popper should grow in a direction different from `bottom`
  36988. */
  36989. x: 'bottom',
  36990. /**
  36991. * @prop {string} [x='left']
  36992. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36993. * Change this if your popper should grow in a direction different from `right`
  36994. */
  36995. y: 'right'
  36996. },
  36997. /**
  36998. * Applies the computed styles to the popper element.
  36999. *
  37000. * All the DOM manipulations are limited to this modifier. This is useful in case
  37001. * you want to integrate Popper.js inside a framework or view library and you
  37002. * want to delegate all the DOM manipulations to it.
  37003. *
  37004. * Note that if you disable this modifier, you must make sure the popper element
  37005. * has its position set to `absolute` before Popper.js can do its work!
  37006. *
  37007. * Just disable this modifier and define your own to achieve the desired effect.
  37008. *
  37009. * @memberof modifiers
  37010. * @inner
  37011. */
  37012. applyStyle: {
  37013. /** @prop {number} order=900 - Index used to define the order of execution */
  37014. order: 900,
  37015. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37016. enabled: true,
  37017. /** @prop {ModifierFn} */
  37018. fn: applyStyle,
  37019. /** @prop {Function} */
  37020. onLoad: applyStyleOnLoad,
  37021. /**
  37022. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37023. * @prop {Boolean} gpuAcceleration=true
  37024. * If true, it uses the CSS 3D transformation to position the popper.
  37025. * Otherwise, it will use the `top` and `left` properties
  37026. */
  37027. gpuAcceleration: undefined
  37028. }
  37029. };
  37030. /**
  37031. * The `dataObject` is an object containing all the information used by Popper.js.
  37032. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37033. * @name dataObject
  37034. * @property {Object} data.instance The Popper.js instance
  37035. * @property {String} data.placement Placement applied to popper
  37036. * @property {String} data.originalPlacement Placement originally defined on init
  37037. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37038. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37039. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37040. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37041. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37042. * @property {Object} data.boundaries Offsets of the popper boundaries
  37043. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37044. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37045. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37046. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37047. */
  37048. /**
  37049. * Default options provided to Popper.js constructor.<br />
  37050. * These can be overridden using the `options` argument of Popper.js.<br />
  37051. * To override an option, simply pass an object with the same
  37052. * structure of the `options` object, as the 3rd argument. For example:
  37053. * ```
  37054. * new Popper(ref, pop, {
  37055. * modifiers: {
  37056. * preventOverflow: { enabled: false }
  37057. * }
  37058. * })
  37059. * ```
  37060. * @type {Object}
  37061. * @static
  37062. * @memberof Popper
  37063. */
  37064. var Defaults = {
  37065. /**
  37066. * Popper's placement.
  37067. * @prop {Popper.placements} placement='bottom'
  37068. */
  37069. placement: 'bottom',
  37070. /**
  37071. * Set this to true if you want popper to position it self in 'fixed' mode
  37072. * @prop {Boolean} positionFixed=false
  37073. */
  37074. positionFixed: false,
  37075. /**
  37076. * Whether events (resize, scroll) are initially enabled.
  37077. * @prop {Boolean} eventsEnabled=true
  37078. */
  37079. eventsEnabled: true,
  37080. /**
  37081. * Set to true if you want to automatically remove the popper when
  37082. * you call the `destroy` method.
  37083. * @prop {Boolean} removeOnDestroy=false
  37084. */
  37085. removeOnDestroy: false,
  37086. /**
  37087. * Callback called when the popper is created.<br />
  37088. * By default, it is set to no-op.<br />
  37089. * Access Popper.js instance with `data.instance`.
  37090. * @prop {onCreate}
  37091. */
  37092. onCreate: function onCreate() {},
  37093. /**
  37094. * Callback called when the popper is updated. This callback is not called
  37095. * on the initialization/creation of the popper, but only on subsequent
  37096. * updates.<br />
  37097. * By default, it is set to no-op.<br />
  37098. * Access Popper.js instance with `data.instance`.
  37099. * @prop {onUpdate}
  37100. */
  37101. onUpdate: function onUpdate() {},
  37102. /**
  37103. * List of modifiers used to modify the offsets before they are applied to the popper.
  37104. * They provide most of the functionalities of Popper.js.
  37105. * @prop {modifiers}
  37106. */
  37107. modifiers: modifiers
  37108. };
  37109. /**
  37110. * @callback onCreate
  37111. * @param {dataObject} data
  37112. */
  37113. /**
  37114. * @callback onUpdate
  37115. * @param {dataObject} data
  37116. */
  37117. // Utils
  37118. // Methods
  37119. var Popper = function () {
  37120. /**
  37121. * Creates a new Popper.js instance.
  37122. * @class Popper
  37123. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37124. * @param {Element} popper - The HTML / XML element used as the popper
  37125. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37126. * @return {Object} instance - The generated Popper.js instance
  37127. */
  37128. function Popper(reference, popper) {
  37129. var _this = this;
  37130. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37131. classCallCheck(this, Popper);
  37132. this.scheduleUpdate = function () {
  37133. return requestAnimationFrame(_this.update);
  37134. };
  37135. // make update() debounced, so that it only runs at most once-per-tick
  37136. this.update = debounce(this.update.bind(this));
  37137. // with {} we create a new object with the options inside it
  37138. this.options = _extends({}, Popper.Defaults, options);
  37139. // init state
  37140. this.state = {
  37141. isDestroyed: false,
  37142. isCreated: false,
  37143. scrollParents: []
  37144. };
  37145. // get reference and popper elements (allow jQuery wrappers)
  37146. this.reference = reference && reference.jquery ? reference[0] : reference;
  37147. this.popper = popper && popper.jquery ? popper[0] : popper;
  37148. // Deep merge modifiers options
  37149. this.options.modifiers = {};
  37150. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37151. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37152. });
  37153. // Refactoring modifiers' list (Object => Array)
  37154. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37155. return _extends({
  37156. name: name
  37157. }, _this.options.modifiers[name]);
  37158. })
  37159. // sort the modifiers by order
  37160. .sort(function (a, b) {
  37161. return a.order - b.order;
  37162. });
  37163. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37164. // such code is executed in the same order of its modifier
  37165. // they could add new properties to their options configuration
  37166. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37167. this.modifiers.forEach(function (modifierOptions) {
  37168. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37169. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37170. }
  37171. });
  37172. // fire the first update to position the popper in the right place
  37173. this.update();
  37174. var eventsEnabled = this.options.eventsEnabled;
  37175. if (eventsEnabled) {
  37176. // setup event listeners, they will take care of update the position in specific situations
  37177. this.enableEventListeners();
  37178. }
  37179. this.state.eventsEnabled = eventsEnabled;
  37180. }
  37181. // We can't use class properties because they don't get listed in the
  37182. // class prototype and break stuff like Sinon stubs
  37183. createClass(Popper, [{
  37184. key: 'update',
  37185. value: function update$$1() {
  37186. return update.call(this);
  37187. }
  37188. }, {
  37189. key: 'destroy',
  37190. value: function destroy$$1() {
  37191. return destroy.call(this);
  37192. }
  37193. }, {
  37194. key: 'enableEventListeners',
  37195. value: function enableEventListeners$$1() {
  37196. return enableEventListeners.call(this);
  37197. }
  37198. }, {
  37199. key: 'disableEventListeners',
  37200. value: function disableEventListeners$$1() {
  37201. return disableEventListeners.call(this);
  37202. }
  37203. /**
  37204. * Schedules an update. It will run on the next UI update available.
  37205. * @method scheduleUpdate
  37206. * @memberof Popper
  37207. */
  37208. /**
  37209. * Collection of utilities useful when writing custom modifiers.
  37210. * Starting from version 1.7, this method is available only if you
  37211. * include `popper-utils.js` before `popper.js`.
  37212. *
  37213. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37214. * and will be removed in v2! Use the PopperUtils module directly instead.
  37215. * Due to the high instability of the methods contained in Utils, we can't
  37216. * guarantee them to follow semver. Use them at your own risk!
  37217. * @static
  37218. * @private
  37219. * @type {Object}
  37220. * @deprecated since version 1.8
  37221. * @member Utils
  37222. * @memberof Popper
  37223. */
  37224. }]);
  37225. return Popper;
  37226. }();
  37227. /**
  37228. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37229. * and lets you use it as replacement of a real DOM node.<br />
  37230. * You can use this method to position a popper relatively to a set of coordinates
  37231. * in case you don't have a DOM node to use as reference.
  37232. *
  37233. * ```
  37234. * new Popper(referenceObject, popperNode);
  37235. * ```
  37236. *
  37237. * NB: This feature isn't supported in Internet Explorer 10.
  37238. * @name referenceObject
  37239. * @property {Function} data.getBoundingClientRect
  37240. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37241. * @property {number} data.clientWidth
  37242. * An ES6 getter that will return the width of the virtual reference element.
  37243. * @property {number} data.clientHeight
  37244. * An ES6 getter that will return the height of the virtual reference element.
  37245. */
  37246. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37247. Popper.placements = placements;
  37248. Popper.Defaults = Defaults;
  37249. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37250. //# sourceMappingURL=popper.js.map
  37251. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37252. /***/ }),
  37253. /***/ "./node_modules/process/browser.js":
  37254. /*!*****************************************!*\
  37255. !*** ./node_modules/process/browser.js ***!
  37256. \*****************************************/
  37257. /*! no static exports found */
  37258. /***/ (function(module, exports) {
  37259. // shim for using process in browser
  37260. var process = module.exports = {};
  37261. // cached from whatever global is present so that test runners that stub it
  37262. // don't break things. But we need to wrap it in a try catch in case it is
  37263. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37264. // function because try/catches deoptimize in certain engines.
  37265. var cachedSetTimeout;
  37266. var cachedClearTimeout;
  37267. function defaultSetTimout() {
  37268. throw new Error('setTimeout has not been defined');
  37269. }
  37270. function defaultClearTimeout () {
  37271. throw new Error('clearTimeout has not been defined');
  37272. }
  37273. (function () {
  37274. try {
  37275. if (typeof setTimeout === 'function') {
  37276. cachedSetTimeout = setTimeout;
  37277. } else {
  37278. cachedSetTimeout = defaultSetTimout;
  37279. }
  37280. } catch (e) {
  37281. cachedSetTimeout = defaultSetTimout;
  37282. }
  37283. try {
  37284. if (typeof clearTimeout === 'function') {
  37285. cachedClearTimeout = clearTimeout;
  37286. } else {
  37287. cachedClearTimeout = defaultClearTimeout;
  37288. }
  37289. } catch (e) {
  37290. cachedClearTimeout = defaultClearTimeout;
  37291. }
  37292. } ())
  37293. function runTimeout(fun) {
  37294. if (cachedSetTimeout === setTimeout) {
  37295. //normal enviroments in sane situations
  37296. return setTimeout(fun, 0);
  37297. }
  37298. // if setTimeout wasn't available but was latter defined
  37299. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37300. cachedSetTimeout = setTimeout;
  37301. return setTimeout(fun, 0);
  37302. }
  37303. try {
  37304. // when when somebody has screwed with setTimeout but no I.E. maddness
  37305. return cachedSetTimeout(fun, 0);
  37306. } catch(e){
  37307. try {
  37308. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37309. return cachedSetTimeout.call(null, fun, 0);
  37310. } catch(e){
  37311. // 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
  37312. return cachedSetTimeout.call(this, fun, 0);
  37313. }
  37314. }
  37315. }
  37316. function runClearTimeout(marker) {
  37317. if (cachedClearTimeout === clearTimeout) {
  37318. //normal enviroments in sane situations
  37319. return clearTimeout(marker);
  37320. }
  37321. // if clearTimeout wasn't available but was latter defined
  37322. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37323. cachedClearTimeout = clearTimeout;
  37324. return clearTimeout(marker);
  37325. }
  37326. try {
  37327. // when when somebody has screwed with setTimeout but no I.E. maddness
  37328. return cachedClearTimeout(marker);
  37329. } catch (e){
  37330. try {
  37331. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37332. return cachedClearTimeout.call(null, marker);
  37333. } catch (e){
  37334. // 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.
  37335. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37336. return cachedClearTimeout.call(this, marker);
  37337. }
  37338. }
  37339. }
  37340. var queue = [];
  37341. var draining = false;
  37342. var currentQueue;
  37343. var queueIndex = -1;
  37344. function cleanUpNextTick() {
  37345. if (!draining || !currentQueue) {
  37346. return;
  37347. }
  37348. draining = false;
  37349. if (currentQueue.length) {
  37350. queue = currentQueue.concat(queue);
  37351. } else {
  37352. queueIndex = -1;
  37353. }
  37354. if (queue.length) {
  37355. drainQueue();
  37356. }
  37357. }
  37358. function drainQueue() {
  37359. if (draining) {
  37360. return;
  37361. }
  37362. var timeout = runTimeout(cleanUpNextTick);
  37363. draining = true;
  37364. var len = queue.length;
  37365. while(len) {
  37366. currentQueue = queue;
  37367. queue = [];
  37368. while (++queueIndex < len) {
  37369. if (currentQueue) {
  37370. currentQueue[queueIndex].run();
  37371. }
  37372. }
  37373. queueIndex = -1;
  37374. len = queue.length;
  37375. }
  37376. currentQueue = null;
  37377. draining = false;
  37378. runClearTimeout(timeout);
  37379. }
  37380. process.nextTick = function (fun) {
  37381. var args = new Array(arguments.length - 1);
  37382. if (arguments.length > 1) {
  37383. for (var i = 1; i < arguments.length; i++) {
  37384. args[i - 1] = arguments[i];
  37385. }
  37386. }
  37387. queue.push(new Item(fun, args));
  37388. if (queue.length === 1 && !draining) {
  37389. runTimeout(drainQueue);
  37390. }
  37391. };
  37392. // v8 likes predictible objects
  37393. function Item(fun, array) {
  37394. this.fun = fun;
  37395. this.array = array;
  37396. }
  37397. Item.prototype.run = function () {
  37398. this.fun.apply(null, this.array);
  37399. };
  37400. process.title = 'browser';
  37401. process.browser = true;
  37402. process.env = {};
  37403. process.argv = [];
  37404. process.version = ''; // empty string to avoid regexp issues
  37405. process.versions = {};
  37406. function noop() {}
  37407. process.on = noop;
  37408. process.addListener = noop;
  37409. process.once = noop;
  37410. process.off = noop;
  37411. process.removeListener = noop;
  37412. process.removeAllListeners = noop;
  37413. process.emit = noop;
  37414. process.prependListener = noop;
  37415. process.prependOnceListener = noop;
  37416. process.listeners = function (name) { return [] }
  37417. process.binding = function (name) {
  37418. throw new Error('process.binding is not supported');
  37419. };
  37420. process.cwd = function () { return '/' };
  37421. process.chdir = function (dir) {
  37422. throw new Error('process.chdir is not supported');
  37423. };
  37424. process.umask = function() { return 0; };
  37425. /***/ }),
  37426. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37427. /*!***************************************************!*\
  37428. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37429. \***************************************************/
  37430. /*! no static exports found */
  37431. /***/ (function(module, exports, __webpack_require__) {
  37432. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37433. * Pusher JavaScript Library v5.0.3
  37434. * https://pusher.com/
  37435. *
  37436. * Copyright 2017, Pusher
  37437. * Released under the MIT licence.
  37438. */
  37439. (function webpackUniversalModuleDefinition(root, factory) {
  37440. if(true)
  37441. module.exports = factory();
  37442. else {}
  37443. })(window, function() {
  37444. return /******/ (function(modules) { // webpackBootstrap
  37445. /******/ // The module cache
  37446. /******/ var installedModules = {};
  37447. /******/
  37448. /******/ // The require function
  37449. /******/ function __webpack_require__(moduleId) {
  37450. /******/
  37451. /******/ // Check if module is in cache
  37452. /******/ if(installedModules[moduleId]) {
  37453. /******/ return installedModules[moduleId].exports;
  37454. /******/ }
  37455. /******/ // Create a new module (and put it into the cache)
  37456. /******/ var module = installedModules[moduleId] = {
  37457. /******/ i: moduleId,
  37458. /******/ l: false,
  37459. /******/ exports: {}
  37460. /******/ };
  37461. /******/
  37462. /******/ // Execute the module function
  37463. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37464. /******/
  37465. /******/ // Flag the module as loaded
  37466. /******/ module.l = true;
  37467. /******/
  37468. /******/ // Return the exports of the module
  37469. /******/ return module.exports;
  37470. /******/ }
  37471. /******/
  37472. /******/
  37473. /******/ // expose the modules object (__webpack_modules__)
  37474. /******/ __webpack_require__.m = modules;
  37475. /******/
  37476. /******/ // expose the module cache
  37477. /******/ __webpack_require__.c = installedModules;
  37478. /******/
  37479. /******/ // define getter function for harmony exports
  37480. /******/ __webpack_require__.d = function(exports, name, getter) {
  37481. /******/ if(!__webpack_require__.o(exports, name)) {
  37482. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37483. /******/ }
  37484. /******/ };
  37485. /******/
  37486. /******/ // define __esModule on exports
  37487. /******/ __webpack_require__.r = function(exports) {
  37488. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37489. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37490. /******/ }
  37491. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37492. /******/ };
  37493. /******/
  37494. /******/ // create a fake namespace object
  37495. /******/ // mode & 1: value is a module id, require it
  37496. /******/ // mode & 2: merge all properties of value into the ns
  37497. /******/ // mode & 4: return value when already ns object
  37498. /******/ // mode & 8|1: behave like require
  37499. /******/ __webpack_require__.t = function(value, mode) {
  37500. /******/ if(mode & 1) value = __webpack_require__(value);
  37501. /******/ if(mode & 8) return value;
  37502. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37503. /******/ var ns = Object.create(null);
  37504. /******/ __webpack_require__.r(ns);
  37505. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37506. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37507. /******/ return ns;
  37508. /******/ };
  37509. /******/
  37510. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37511. /******/ __webpack_require__.n = function(module) {
  37512. /******/ var getter = module && module.__esModule ?
  37513. /******/ function getDefault() { return module['default']; } :
  37514. /******/ function getModuleExports() { return module; };
  37515. /******/ __webpack_require__.d(getter, 'a', getter);
  37516. /******/ return getter;
  37517. /******/ };
  37518. /******/
  37519. /******/ // Object.prototype.hasOwnProperty.call
  37520. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37521. /******/
  37522. /******/ // __webpack_public_path__
  37523. /******/ __webpack_require__.p = "";
  37524. /******/
  37525. /******/
  37526. /******/ // Load entry module and return exports
  37527. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37528. /******/ })
  37529. /************************************************************************/
  37530. /******/ ([
  37531. /* 0 */
  37532. /***/ (function(module, exports, __webpack_require__) {
  37533. (function(nacl) {
  37534. 'use strict';
  37535. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37536. // Public domain.
  37537. //
  37538. // Implementation derived from TweetNaCl version 20140427.
  37539. // See for details: http://tweetnacl.cr.yp.to/
  37540. var gf = function(init) {
  37541. var i, r = new Float64Array(16);
  37542. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37543. return r;
  37544. };
  37545. // Pluggable, initialized in high-level API below.
  37546. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37547. var _0 = new Uint8Array(16);
  37548. var _9 = new Uint8Array(32); _9[0] = 9;
  37549. var gf0 = gf(),
  37550. gf1 = gf([1]),
  37551. _121665 = gf([0xdb41, 1]),
  37552. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37553. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37554. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37555. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37556. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37557. function ts64(x, i, h, l) {
  37558. x[i] = (h >> 24) & 0xff;
  37559. x[i+1] = (h >> 16) & 0xff;
  37560. x[i+2] = (h >> 8) & 0xff;
  37561. x[i+3] = h & 0xff;
  37562. x[i+4] = (l >> 24) & 0xff;
  37563. x[i+5] = (l >> 16) & 0xff;
  37564. x[i+6] = (l >> 8) & 0xff;
  37565. x[i+7] = l & 0xff;
  37566. }
  37567. function vn(x, xi, y, yi, n) {
  37568. var i,d = 0;
  37569. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37570. return (1 & ((d - 1) >>> 8)) - 1;
  37571. }
  37572. function crypto_verify_16(x, xi, y, yi) {
  37573. return vn(x,xi,y,yi,16);
  37574. }
  37575. function crypto_verify_32(x, xi, y, yi) {
  37576. return vn(x,xi,y,yi,32);
  37577. }
  37578. function core_salsa20(o, p, k, c) {
  37579. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37580. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37581. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37582. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37583. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37584. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37585. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37586. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37587. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37588. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37589. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37590. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37591. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37592. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37593. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37594. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37595. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37596. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37597. x15 = j15, u;
  37598. for (var i = 0; i < 20; i += 2) {
  37599. u = x0 + x12 | 0;
  37600. x4 ^= u<<7 | u>>>(32-7);
  37601. u = x4 + x0 | 0;
  37602. x8 ^= u<<9 | u>>>(32-9);
  37603. u = x8 + x4 | 0;
  37604. x12 ^= u<<13 | u>>>(32-13);
  37605. u = x12 + x8 | 0;
  37606. x0 ^= u<<18 | u>>>(32-18);
  37607. u = x5 + x1 | 0;
  37608. x9 ^= u<<7 | u>>>(32-7);
  37609. u = x9 + x5 | 0;
  37610. x13 ^= u<<9 | u>>>(32-9);
  37611. u = x13 + x9 | 0;
  37612. x1 ^= u<<13 | u>>>(32-13);
  37613. u = x1 + x13 | 0;
  37614. x5 ^= u<<18 | u>>>(32-18);
  37615. u = x10 + x6 | 0;
  37616. x14 ^= u<<7 | u>>>(32-7);
  37617. u = x14 + x10 | 0;
  37618. x2 ^= u<<9 | u>>>(32-9);
  37619. u = x2 + x14 | 0;
  37620. x6 ^= u<<13 | u>>>(32-13);
  37621. u = x6 + x2 | 0;
  37622. x10 ^= u<<18 | u>>>(32-18);
  37623. u = x15 + x11 | 0;
  37624. x3 ^= u<<7 | u>>>(32-7);
  37625. u = x3 + x15 | 0;
  37626. x7 ^= u<<9 | u>>>(32-9);
  37627. u = x7 + x3 | 0;
  37628. x11 ^= u<<13 | u>>>(32-13);
  37629. u = x11 + x7 | 0;
  37630. x15 ^= u<<18 | u>>>(32-18);
  37631. u = x0 + x3 | 0;
  37632. x1 ^= u<<7 | u>>>(32-7);
  37633. u = x1 + x0 | 0;
  37634. x2 ^= u<<9 | u>>>(32-9);
  37635. u = x2 + x1 | 0;
  37636. x3 ^= u<<13 | u>>>(32-13);
  37637. u = x3 + x2 | 0;
  37638. x0 ^= u<<18 | u>>>(32-18);
  37639. u = x5 + x4 | 0;
  37640. x6 ^= u<<7 | u>>>(32-7);
  37641. u = x6 + x5 | 0;
  37642. x7 ^= u<<9 | u>>>(32-9);
  37643. u = x7 + x6 | 0;
  37644. x4 ^= u<<13 | u>>>(32-13);
  37645. u = x4 + x7 | 0;
  37646. x5 ^= u<<18 | u>>>(32-18);
  37647. u = x10 + x9 | 0;
  37648. x11 ^= u<<7 | u>>>(32-7);
  37649. u = x11 + x10 | 0;
  37650. x8 ^= u<<9 | u>>>(32-9);
  37651. u = x8 + x11 | 0;
  37652. x9 ^= u<<13 | u>>>(32-13);
  37653. u = x9 + x8 | 0;
  37654. x10 ^= u<<18 | u>>>(32-18);
  37655. u = x15 + x14 | 0;
  37656. x12 ^= u<<7 | u>>>(32-7);
  37657. u = x12 + x15 | 0;
  37658. x13 ^= u<<9 | u>>>(32-9);
  37659. u = x13 + x12 | 0;
  37660. x14 ^= u<<13 | u>>>(32-13);
  37661. u = x14 + x13 | 0;
  37662. x15 ^= u<<18 | u>>>(32-18);
  37663. }
  37664. x0 = x0 + j0 | 0;
  37665. x1 = x1 + j1 | 0;
  37666. x2 = x2 + j2 | 0;
  37667. x3 = x3 + j3 | 0;
  37668. x4 = x4 + j4 | 0;
  37669. x5 = x5 + j5 | 0;
  37670. x6 = x6 + j6 | 0;
  37671. x7 = x7 + j7 | 0;
  37672. x8 = x8 + j8 | 0;
  37673. x9 = x9 + j9 | 0;
  37674. x10 = x10 + j10 | 0;
  37675. x11 = x11 + j11 | 0;
  37676. x12 = x12 + j12 | 0;
  37677. x13 = x13 + j13 | 0;
  37678. x14 = x14 + j14 | 0;
  37679. x15 = x15 + j15 | 0;
  37680. o[ 0] = x0 >>> 0 & 0xff;
  37681. o[ 1] = x0 >>> 8 & 0xff;
  37682. o[ 2] = x0 >>> 16 & 0xff;
  37683. o[ 3] = x0 >>> 24 & 0xff;
  37684. o[ 4] = x1 >>> 0 & 0xff;
  37685. o[ 5] = x1 >>> 8 & 0xff;
  37686. o[ 6] = x1 >>> 16 & 0xff;
  37687. o[ 7] = x1 >>> 24 & 0xff;
  37688. o[ 8] = x2 >>> 0 & 0xff;
  37689. o[ 9] = x2 >>> 8 & 0xff;
  37690. o[10] = x2 >>> 16 & 0xff;
  37691. o[11] = x2 >>> 24 & 0xff;
  37692. o[12] = x3 >>> 0 & 0xff;
  37693. o[13] = x3 >>> 8 & 0xff;
  37694. o[14] = x3 >>> 16 & 0xff;
  37695. o[15] = x3 >>> 24 & 0xff;
  37696. o[16] = x4 >>> 0 & 0xff;
  37697. o[17] = x4 >>> 8 & 0xff;
  37698. o[18] = x4 >>> 16 & 0xff;
  37699. o[19] = x4 >>> 24 & 0xff;
  37700. o[20] = x5 >>> 0 & 0xff;
  37701. o[21] = x5 >>> 8 & 0xff;
  37702. o[22] = x5 >>> 16 & 0xff;
  37703. o[23] = x5 >>> 24 & 0xff;
  37704. o[24] = x6 >>> 0 & 0xff;
  37705. o[25] = x6 >>> 8 & 0xff;
  37706. o[26] = x6 >>> 16 & 0xff;
  37707. o[27] = x6 >>> 24 & 0xff;
  37708. o[28] = x7 >>> 0 & 0xff;
  37709. o[29] = x7 >>> 8 & 0xff;
  37710. o[30] = x7 >>> 16 & 0xff;
  37711. o[31] = x7 >>> 24 & 0xff;
  37712. o[32] = x8 >>> 0 & 0xff;
  37713. o[33] = x8 >>> 8 & 0xff;
  37714. o[34] = x8 >>> 16 & 0xff;
  37715. o[35] = x8 >>> 24 & 0xff;
  37716. o[36] = x9 >>> 0 & 0xff;
  37717. o[37] = x9 >>> 8 & 0xff;
  37718. o[38] = x9 >>> 16 & 0xff;
  37719. o[39] = x9 >>> 24 & 0xff;
  37720. o[40] = x10 >>> 0 & 0xff;
  37721. o[41] = x10 >>> 8 & 0xff;
  37722. o[42] = x10 >>> 16 & 0xff;
  37723. o[43] = x10 >>> 24 & 0xff;
  37724. o[44] = x11 >>> 0 & 0xff;
  37725. o[45] = x11 >>> 8 & 0xff;
  37726. o[46] = x11 >>> 16 & 0xff;
  37727. o[47] = x11 >>> 24 & 0xff;
  37728. o[48] = x12 >>> 0 & 0xff;
  37729. o[49] = x12 >>> 8 & 0xff;
  37730. o[50] = x12 >>> 16 & 0xff;
  37731. o[51] = x12 >>> 24 & 0xff;
  37732. o[52] = x13 >>> 0 & 0xff;
  37733. o[53] = x13 >>> 8 & 0xff;
  37734. o[54] = x13 >>> 16 & 0xff;
  37735. o[55] = x13 >>> 24 & 0xff;
  37736. o[56] = x14 >>> 0 & 0xff;
  37737. o[57] = x14 >>> 8 & 0xff;
  37738. o[58] = x14 >>> 16 & 0xff;
  37739. o[59] = x14 >>> 24 & 0xff;
  37740. o[60] = x15 >>> 0 & 0xff;
  37741. o[61] = x15 >>> 8 & 0xff;
  37742. o[62] = x15 >>> 16 & 0xff;
  37743. o[63] = x15 >>> 24 & 0xff;
  37744. }
  37745. function core_hsalsa20(o,p,k,c) {
  37746. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37747. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37748. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37749. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37750. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37751. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37752. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37753. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37754. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37755. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37756. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37757. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37758. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37759. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37760. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37761. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37762. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37763. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37764. x15 = j15, u;
  37765. for (var i = 0; i < 20; i += 2) {
  37766. u = x0 + x12 | 0;
  37767. x4 ^= u<<7 | u>>>(32-7);
  37768. u = x4 + x0 | 0;
  37769. x8 ^= u<<9 | u>>>(32-9);
  37770. u = x8 + x4 | 0;
  37771. x12 ^= u<<13 | u>>>(32-13);
  37772. u = x12 + x8 | 0;
  37773. x0 ^= u<<18 | u>>>(32-18);
  37774. u = x5 + x1 | 0;
  37775. x9 ^= u<<7 | u>>>(32-7);
  37776. u = x9 + x5 | 0;
  37777. x13 ^= u<<9 | u>>>(32-9);
  37778. u = x13 + x9 | 0;
  37779. x1 ^= u<<13 | u>>>(32-13);
  37780. u = x1 + x13 | 0;
  37781. x5 ^= u<<18 | u>>>(32-18);
  37782. u = x10 + x6 | 0;
  37783. x14 ^= u<<7 | u>>>(32-7);
  37784. u = x14 + x10 | 0;
  37785. x2 ^= u<<9 | u>>>(32-9);
  37786. u = x2 + x14 | 0;
  37787. x6 ^= u<<13 | u>>>(32-13);
  37788. u = x6 + x2 | 0;
  37789. x10 ^= u<<18 | u>>>(32-18);
  37790. u = x15 + x11 | 0;
  37791. x3 ^= u<<7 | u>>>(32-7);
  37792. u = x3 + x15 | 0;
  37793. x7 ^= u<<9 | u>>>(32-9);
  37794. u = x7 + x3 | 0;
  37795. x11 ^= u<<13 | u>>>(32-13);
  37796. u = x11 + x7 | 0;
  37797. x15 ^= u<<18 | u>>>(32-18);
  37798. u = x0 + x3 | 0;
  37799. x1 ^= u<<7 | u>>>(32-7);
  37800. u = x1 + x0 | 0;
  37801. x2 ^= u<<9 | u>>>(32-9);
  37802. u = x2 + x1 | 0;
  37803. x3 ^= u<<13 | u>>>(32-13);
  37804. u = x3 + x2 | 0;
  37805. x0 ^= u<<18 | u>>>(32-18);
  37806. u = x5 + x4 | 0;
  37807. x6 ^= u<<7 | u>>>(32-7);
  37808. u = x6 + x5 | 0;
  37809. x7 ^= u<<9 | u>>>(32-9);
  37810. u = x7 + x6 | 0;
  37811. x4 ^= u<<13 | u>>>(32-13);
  37812. u = x4 + x7 | 0;
  37813. x5 ^= u<<18 | u>>>(32-18);
  37814. u = x10 + x9 | 0;
  37815. x11 ^= u<<7 | u>>>(32-7);
  37816. u = x11 + x10 | 0;
  37817. x8 ^= u<<9 | u>>>(32-9);
  37818. u = x8 + x11 | 0;
  37819. x9 ^= u<<13 | u>>>(32-13);
  37820. u = x9 + x8 | 0;
  37821. x10 ^= u<<18 | u>>>(32-18);
  37822. u = x15 + x14 | 0;
  37823. x12 ^= u<<7 | u>>>(32-7);
  37824. u = x12 + x15 | 0;
  37825. x13 ^= u<<9 | u>>>(32-9);
  37826. u = x13 + x12 | 0;
  37827. x14 ^= u<<13 | u>>>(32-13);
  37828. u = x14 + x13 | 0;
  37829. x15 ^= u<<18 | u>>>(32-18);
  37830. }
  37831. o[ 0] = x0 >>> 0 & 0xff;
  37832. o[ 1] = x0 >>> 8 & 0xff;
  37833. o[ 2] = x0 >>> 16 & 0xff;
  37834. o[ 3] = x0 >>> 24 & 0xff;
  37835. o[ 4] = x5 >>> 0 & 0xff;
  37836. o[ 5] = x5 >>> 8 & 0xff;
  37837. o[ 6] = x5 >>> 16 & 0xff;
  37838. o[ 7] = x5 >>> 24 & 0xff;
  37839. o[ 8] = x10 >>> 0 & 0xff;
  37840. o[ 9] = x10 >>> 8 & 0xff;
  37841. o[10] = x10 >>> 16 & 0xff;
  37842. o[11] = x10 >>> 24 & 0xff;
  37843. o[12] = x15 >>> 0 & 0xff;
  37844. o[13] = x15 >>> 8 & 0xff;
  37845. o[14] = x15 >>> 16 & 0xff;
  37846. o[15] = x15 >>> 24 & 0xff;
  37847. o[16] = x6 >>> 0 & 0xff;
  37848. o[17] = x6 >>> 8 & 0xff;
  37849. o[18] = x6 >>> 16 & 0xff;
  37850. o[19] = x6 >>> 24 & 0xff;
  37851. o[20] = x7 >>> 0 & 0xff;
  37852. o[21] = x7 >>> 8 & 0xff;
  37853. o[22] = x7 >>> 16 & 0xff;
  37854. o[23] = x7 >>> 24 & 0xff;
  37855. o[24] = x8 >>> 0 & 0xff;
  37856. o[25] = x8 >>> 8 & 0xff;
  37857. o[26] = x8 >>> 16 & 0xff;
  37858. o[27] = x8 >>> 24 & 0xff;
  37859. o[28] = x9 >>> 0 & 0xff;
  37860. o[29] = x9 >>> 8 & 0xff;
  37861. o[30] = x9 >>> 16 & 0xff;
  37862. o[31] = x9 >>> 24 & 0xff;
  37863. }
  37864. function crypto_core_salsa20(out,inp,k,c) {
  37865. core_salsa20(out,inp,k,c);
  37866. }
  37867. function crypto_core_hsalsa20(out,inp,k,c) {
  37868. core_hsalsa20(out,inp,k,c);
  37869. }
  37870. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37871. // "expand 32-byte k"
  37872. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37873. var z = new Uint8Array(16), x = new Uint8Array(64);
  37874. var u, i;
  37875. for (i = 0; i < 16; i++) z[i] = 0;
  37876. for (i = 0; i < 8; i++) z[i] = n[i];
  37877. while (b >= 64) {
  37878. crypto_core_salsa20(x,z,k,sigma);
  37879. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37880. u = 1;
  37881. for (i = 8; i < 16; i++) {
  37882. u = u + (z[i] & 0xff) | 0;
  37883. z[i] = u & 0xff;
  37884. u >>>= 8;
  37885. }
  37886. b -= 64;
  37887. cpos += 64;
  37888. mpos += 64;
  37889. }
  37890. if (b > 0) {
  37891. crypto_core_salsa20(x,z,k,sigma);
  37892. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37893. }
  37894. return 0;
  37895. }
  37896. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37897. var z = new Uint8Array(16), x = new Uint8Array(64);
  37898. var u, i;
  37899. for (i = 0; i < 16; i++) z[i] = 0;
  37900. for (i = 0; i < 8; i++) z[i] = n[i];
  37901. while (b >= 64) {
  37902. crypto_core_salsa20(x,z,k,sigma);
  37903. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37904. u = 1;
  37905. for (i = 8; i < 16; i++) {
  37906. u = u + (z[i] & 0xff) | 0;
  37907. z[i] = u & 0xff;
  37908. u >>>= 8;
  37909. }
  37910. b -= 64;
  37911. cpos += 64;
  37912. }
  37913. if (b > 0) {
  37914. crypto_core_salsa20(x,z,k,sigma);
  37915. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37916. }
  37917. return 0;
  37918. }
  37919. function crypto_stream(c,cpos,d,n,k) {
  37920. var s = new Uint8Array(32);
  37921. crypto_core_hsalsa20(s,n,k,sigma);
  37922. var sn = new Uint8Array(8);
  37923. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37924. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37925. }
  37926. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37927. var s = new Uint8Array(32);
  37928. crypto_core_hsalsa20(s,n,k,sigma);
  37929. var sn = new Uint8Array(8);
  37930. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37931. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37932. }
  37933. /*
  37934. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37935. * https://github.com/floodyberry/poly1305-donna
  37936. */
  37937. var poly1305 = function(key) {
  37938. this.buffer = new Uint8Array(16);
  37939. this.r = new Uint16Array(10);
  37940. this.h = new Uint16Array(10);
  37941. this.pad = new Uint16Array(8);
  37942. this.leftover = 0;
  37943. this.fin = 0;
  37944. var t0, t1, t2, t3, t4, t5, t6, t7;
  37945. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37946. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37947. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37948. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37949. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37950. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37951. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37952. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37953. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37954. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37955. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37956. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37957. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37958. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37959. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37960. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37961. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37962. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37963. };
  37964. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37965. var hibit = this.fin ? 0 : (1 << 11);
  37966. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37967. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37968. var h0 = this.h[0],
  37969. h1 = this.h[1],
  37970. h2 = this.h[2],
  37971. h3 = this.h[3],
  37972. h4 = this.h[4],
  37973. h5 = this.h[5],
  37974. h6 = this.h[6],
  37975. h7 = this.h[7],
  37976. h8 = this.h[8],
  37977. h9 = this.h[9];
  37978. var r0 = this.r[0],
  37979. r1 = this.r[1],
  37980. r2 = this.r[2],
  37981. r3 = this.r[3],
  37982. r4 = this.r[4],
  37983. r5 = this.r[5],
  37984. r6 = this.r[6],
  37985. r7 = this.r[7],
  37986. r8 = this.r[8],
  37987. r9 = this.r[9];
  37988. while (bytes >= 16) {
  37989. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37990. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37991. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37992. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37993. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37994. h5 += ((t4 >>> 1)) & 0x1fff;
  37995. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37996. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37997. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37998. h9 += ((t7 >>> 5)) | hibit;
  37999. c = 0;
  38000. d0 = c;
  38001. d0 += h0 * r0;
  38002. d0 += h1 * (5 * r9);
  38003. d0 += h2 * (5 * r8);
  38004. d0 += h3 * (5 * r7);
  38005. d0 += h4 * (5 * r6);
  38006. c = (d0 >>> 13); d0 &= 0x1fff;
  38007. d0 += h5 * (5 * r5);
  38008. d0 += h6 * (5 * r4);
  38009. d0 += h7 * (5 * r3);
  38010. d0 += h8 * (5 * r2);
  38011. d0 += h9 * (5 * r1);
  38012. c += (d0 >>> 13); d0 &= 0x1fff;
  38013. d1 = c;
  38014. d1 += h0 * r1;
  38015. d1 += h1 * r0;
  38016. d1 += h2 * (5 * r9);
  38017. d1 += h3 * (5 * r8);
  38018. d1 += h4 * (5 * r7);
  38019. c = (d1 >>> 13); d1 &= 0x1fff;
  38020. d1 += h5 * (5 * r6);
  38021. d1 += h6 * (5 * r5);
  38022. d1 += h7 * (5 * r4);
  38023. d1 += h8 * (5 * r3);
  38024. d1 += h9 * (5 * r2);
  38025. c += (d1 >>> 13); d1 &= 0x1fff;
  38026. d2 = c;
  38027. d2 += h0 * r2;
  38028. d2 += h1 * r1;
  38029. d2 += h2 * r0;
  38030. d2 += h3 * (5 * r9);
  38031. d2 += h4 * (5 * r8);
  38032. c = (d2 >>> 13); d2 &= 0x1fff;
  38033. d2 += h5 * (5 * r7);
  38034. d2 += h6 * (5 * r6);
  38035. d2 += h7 * (5 * r5);
  38036. d2 += h8 * (5 * r4);
  38037. d2 += h9 * (5 * r3);
  38038. c += (d2 >>> 13); d2 &= 0x1fff;
  38039. d3 = c;
  38040. d3 += h0 * r3;
  38041. d3 += h1 * r2;
  38042. d3 += h2 * r1;
  38043. d3 += h3 * r0;
  38044. d3 += h4 * (5 * r9);
  38045. c = (d3 >>> 13); d3 &= 0x1fff;
  38046. d3 += h5 * (5 * r8);
  38047. d3 += h6 * (5 * r7);
  38048. d3 += h7 * (5 * r6);
  38049. d3 += h8 * (5 * r5);
  38050. d3 += h9 * (5 * r4);
  38051. c += (d3 >>> 13); d3 &= 0x1fff;
  38052. d4 = c;
  38053. d4 += h0 * r4;
  38054. d4 += h1 * r3;
  38055. d4 += h2 * r2;
  38056. d4 += h3 * r1;
  38057. d4 += h4 * r0;
  38058. c = (d4 >>> 13); d4 &= 0x1fff;
  38059. d4 += h5 * (5 * r9);
  38060. d4 += h6 * (5 * r8);
  38061. d4 += h7 * (5 * r7);
  38062. d4 += h8 * (5 * r6);
  38063. d4 += h9 * (5 * r5);
  38064. c += (d4 >>> 13); d4 &= 0x1fff;
  38065. d5 = c;
  38066. d5 += h0 * r5;
  38067. d5 += h1 * r4;
  38068. d5 += h2 * r3;
  38069. d5 += h3 * r2;
  38070. d5 += h4 * r1;
  38071. c = (d5 >>> 13); d5 &= 0x1fff;
  38072. d5 += h5 * r0;
  38073. d5 += h6 * (5 * r9);
  38074. d5 += h7 * (5 * r8);
  38075. d5 += h8 * (5 * r7);
  38076. d5 += h9 * (5 * r6);
  38077. c += (d5 >>> 13); d5 &= 0x1fff;
  38078. d6 = c;
  38079. d6 += h0 * r6;
  38080. d6 += h1 * r5;
  38081. d6 += h2 * r4;
  38082. d6 += h3 * r3;
  38083. d6 += h4 * r2;
  38084. c = (d6 >>> 13); d6 &= 0x1fff;
  38085. d6 += h5 * r1;
  38086. d6 += h6 * r0;
  38087. d6 += h7 * (5 * r9);
  38088. d6 += h8 * (5 * r8);
  38089. d6 += h9 * (5 * r7);
  38090. c += (d6 >>> 13); d6 &= 0x1fff;
  38091. d7 = c;
  38092. d7 += h0 * r7;
  38093. d7 += h1 * r6;
  38094. d7 += h2 * r5;
  38095. d7 += h3 * r4;
  38096. d7 += h4 * r3;
  38097. c = (d7 >>> 13); d7 &= 0x1fff;
  38098. d7 += h5 * r2;
  38099. d7 += h6 * r1;
  38100. d7 += h7 * r0;
  38101. d7 += h8 * (5 * r9);
  38102. d7 += h9 * (5 * r8);
  38103. c += (d7 >>> 13); d7 &= 0x1fff;
  38104. d8 = c;
  38105. d8 += h0 * r8;
  38106. d8 += h1 * r7;
  38107. d8 += h2 * r6;
  38108. d8 += h3 * r5;
  38109. d8 += h4 * r4;
  38110. c = (d8 >>> 13); d8 &= 0x1fff;
  38111. d8 += h5 * r3;
  38112. d8 += h6 * r2;
  38113. d8 += h7 * r1;
  38114. d8 += h8 * r0;
  38115. d8 += h9 * (5 * r9);
  38116. c += (d8 >>> 13); d8 &= 0x1fff;
  38117. d9 = c;
  38118. d9 += h0 * r9;
  38119. d9 += h1 * r8;
  38120. d9 += h2 * r7;
  38121. d9 += h3 * r6;
  38122. d9 += h4 * r5;
  38123. c = (d9 >>> 13); d9 &= 0x1fff;
  38124. d9 += h5 * r4;
  38125. d9 += h6 * r3;
  38126. d9 += h7 * r2;
  38127. d9 += h8 * r1;
  38128. d9 += h9 * r0;
  38129. c += (d9 >>> 13); d9 &= 0x1fff;
  38130. c = (((c << 2) + c)) | 0;
  38131. c = (c + d0) | 0;
  38132. d0 = c & 0x1fff;
  38133. c = (c >>> 13);
  38134. d1 += c;
  38135. h0 = d0;
  38136. h1 = d1;
  38137. h2 = d2;
  38138. h3 = d3;
  38139. h4 = d4;
  38140. h5 = d5;
  38141. h6 = d6;
  38142. h7 = d7;
  38143. h8 = d8;
  38144. h9 = d9;
  38145. mpos += 16;
  38146. bytes -= 16;
  38147. }
  38148. this.h[0] = h0;
  38149. this.h[1] = h1;
  38150. this.h[2] = h2;
  38151. this.h[3] = h3;
  38152. this.h[4] = h4;
  38153. this.h[5] = h5;
  38154. this.h[6] = h6;
  38155. this.h[7] = h7;
  38156. this.h[8] = h8;
  38157. this.h[9] = h9;
  38158. };
  38159. poly1305.prototype.finish = function(mac, macpos) {
  38160. var g = new Uint16Array(10);
  38161. var c, mask, f, i;
  38162. if (this.leftover) {
  38163. i = this.leftover;
  38164. this.buffer[i++] = 1;
  38165. for (; i < 16; i++) this.buffer[i] = 0;
  38166. this.fin = 1;
  38167. this.blocks(this.buffer, 0, 16);
  38168. }
  38169. c = this.h[1] >>> 13;
  38170. this.h[1] &= 0x1fff;
  38171. for (i = 2; i < 10; i++) {
  38172. this.h[i] += c;
  38173. c = this.h[i] >>> 13;
  38174. this.h[i] &= 0x1fff;
  38175. }
  38176. this.h[0] += (c * 5);
  38177. c = this.h[0] >>> 13;
  38178. this.h[0] &= 0x1fff;
  38179. this.h[1] += c;
  38180. c = this.h[1] >>> 13;
  38181. this.h[1] &= 0x1fff;
  38182. this.h[2] += c;
  38183. g[0] = this.h[0] + 5;
  38184. c = g[0] >>> 13;
  38185. g[0] &= 0x1fff;
  38186. for (i = 1; i < 10; i++) {
  38187. g[i] = this.h[i] + c;
  38188. c = g[i] >>> 13;
  38189. g[i] &= 0x1fff;
  38190. }
  38191. g[9] -= (1 << 13);
  38192. mask = (c ^ 1) - 1;
  38193. for (i = 0; i < 10; i++) g[i] &= mask;
  38194. mask = ~mask;
  38195. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38196. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38197. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38198. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38199. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38200. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38201. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38202. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38203. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38204. f = this.h[0] + this.pad[0];
  38205. this.h[0] = f & 0xffff;
  38206. for (i = 1; i < 8; i++) {
  38207. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38208. this.h[i] = f & 0xffff;
  38209. }
  38210. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38211. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38212. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38213. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38214. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38215. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38216. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38217. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38218. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38219. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38220. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38221. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38222. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38223. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38224. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38225. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38226. };
  38227. poly1305.prototype.update = function(m, mpos, bytes) {
  38228. var i, want;
  38229. if (this.leftover) {
  38230. want = (16 - this.leftover);
  38231. if (want > bytes)
  38232. want = bytes;
  38233. for (i = 0; i < want; i++)
  38234. this.buffer[this.leftover + i] = m[mpos+i];
  38235. bytes -= want;
  38236. mpos += want;
  38237. this.leftover += want;
  38238. if (this.leftover < 16)
  38239. return;
  38240. this.blocks(this.buffer, 0, 16);
  38241. this.leftover = 0;
  38242. }
  38243. if (bytes >= 16) {
  38244. want = bytes - (bytes % 16);
  38245. this.blocks(m, mpos, want);
  38246. mpos += want;
  38247. bytes -= want;
  38248. }
  38249. if (bytes) {
  38250. for (i = 0; i < bytes; i++)
  38251. this.buffer[this.leftover + i] = m[mpos+i];
  38252. this.leftover += bytes;
  38253. }
  38254. };
  38255. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38256. var s = new poly1305(k);
  38257. s.update(m, mpos, n);
  38258. s.finish(out, outpos);
  38259. return 0;
  38260. }
  38261. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38262. var x = new Uint8Array(16);
  38263. crypto_onetimeauth(x,0,m,mpos,n,k);
  38264. return crypto_verify_16(h,hpos,x,0);
  38265. }
  38266. function crypto_secretbox(c,m,d,n,k) {
  38267. var i;
  38268. if (d < 32) return -1;
  38269. crypto_stream_xor(c,0,m,0,d,n,k);
  38270. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38271. for (i = 0; i < 16; i++) c[i] = 0;
  38272. return 0;
  38273. }
  38274. function crypto_secretbox_open(m,c,d,n,k) {
  38275. var i;
  38276. var x = new Uint8Array(32);
  38277. if (d < 32) return -1;
  38278. crypto_stream(x,0,32,n,k);
  38279. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38280. crypto_stream_xor(m,0,c,0,d,n,k);
  38281. for (i = 0; i < 32; i++) m[i] = 0;
  38282. return 0;
  38283. }
  38284. function set25519(r, a) {
  38285. var i;
  38286. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38287. }
  38288. function car25519(o) {
  38289. var i, v, c = 1;
  38290. for (i = 0; i < 16; i++) {
  38291. v = o[i] + c + 65535;
  38292. c = Math.floor(v / 65536);
  38293. o[i] = v - c * 65536;
  38294. }
  38295. o[0] += c-1 + 37 * (c-1);
  38296. }
  38297. function sel25519(p, q, b) {
  38298. var t, c = ~(b-1);
  38299. for (var i = 0; i < 16; i++) {
  38300. t = c & (p[i] ^ q[i]);
  38301. p[i] ^= t;
  38302. q[i] ^= t;
  38303. }
  38304. }
  38305. function pack25519(o, n) {
  38306. var i, j, b;
  38307. var m = gf(), t = gf();
  38308. for (i = 0; i < 16; i++) t[i] = n[i];
  38309. car25519(t);
  38310. car25519(t);
  38311. car25519(t);
  38312. for (j = 0; j < 2; j++) {
  38313. m[0] = t[0] - 0xffed;
  38314. for (i = 1; i < 15; i++) {
  38315. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38316. m[i-1] &= 0xffff;
  38317. }
  38318. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38319. b = (m[15]>>16) & 1;
  38320. m[14] &= 0xffff;
  38321. sel25519(t, m, 1-b);
  38322. }
  38323. for (i = 0; i < 16; i++) {
  38324. o[2*i] = t[i] & 0xff;
  38325. o[2*i+1] = t[i]>>8;
  38326. }
  38327. }
  38328. function neq25519(a, b) {
  38329. var c = new Uint8Array(32), d = new Uint8Array(32);
  38330. pack25519(c, a);
  38331. pack25519(d, b);
  38332. return crypto_verify_32(c, 0, d, 0);
  38333. }
  38334. function par25519(a) {
  38335. var d = new Uint8Array(32);
  38336. pack25519(d, a);
  38337. return d[0] & 1;
  38338. }
  38339. function unpack25519(o, n) {
  38340. var i;
  38341. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38342. o[15] &= 0x7fff;
  38343. }
  38344. function A(o, a, b) {
  38345. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38346. }
  38347. function Z(o, a, b) {
  38348. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38349. }
  38350. function M(o, a, b) {
  38351. var v, c,
  38352. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38353. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38354. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38355. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38356. b0 = b[0],
  38357. b1 = b[1],
  38358. b2 = b[2],
  38359. b3 = b[3],
  38360. b4 = b[4],
  38361. b5 = b[5],
  38362. b6 = b[6],
  38363. b7 = b[7],
  38364. b8 = b[8],
  38365. b9 = b[9],
  38366. b10 = b[10],
  38367. b11 = b[11],
  38368. b12 = b[12],
  38369. b13 = b[13],
  38370. b14 = b[14],
  38371. b15 = b[15];
  38372. v = a[0];
  38373. t0 += v * b0;
  38374. t1 += v * b1;
  38375. t2 += v * b2;
  38376. t3 += v * b3;
  38377. t4 += v * b4;
  38378. t5 += v * b5;
  38379. t6 += v * b6;
  38380. t7 += v * b7;
  38381. t8 += v * b8;
  38382. t9 += v * b9;
  38383. t10 += v * b10;
  38384. t11 += v * b11;
  38385. t12 += v * b12;
  38386. t13 += v * b13;
  38387. t14 += v * b14;
  38388. t15 += v * b15;
  38389. v = a[1];
  38390. t1 += v * b0;
  38391. t2 += v * b1;
  38392. t3 += v * b2;
  38393. t4 += v * b3;
  38394. t5 += v * b4;
  38395. t6 += v * b5;
  38396. t7 += v * b6;
  38397. t8 += v * b7;
  38398. t9 += v * b8;
  38399. t10 += v * b9;
  38400. t11 += v * b10;
  38401. t12 += v * b11;
  38402. t13 += v * b12;
  38403. t14 += v * b13;
  38404. t15 += v * b14;
  38405. t16 += v * b15;
  38406. v = a[2];
  38407. t2 += v * b0;
  38408. t3 += v * b1;
  38409. t4 += v * b2;
  38410. t5 += v * b3;
  38411. t6 += v * b4;
  38412. t7 += v * b5;
  38413. t8 += v * b6;
  38414. t9 += v * b7;
  38415. t10 += v * b8;
  38416. t11 += v * b9;
  38417. t12 += v * b10;
  38418. t13 += v * b11;
  38419. t14 += v * b12;
  38420. t15 += v * b13;
  38421. t16 += v * b14;
  38422. t17 += v * b15;
  38423. v = a[3];
  38424. t3 += v * b0;
  38425. t4 += v * b1;
  38426. t5 += v * b2;
  38427. t6 += v * b3;
  38428. t7 += v * b4;
  38429. t8 += v * b5;
  38430. t9 += v * b6;
  38431. t10 += v * b7;
  38432. t11 += v * b8;
  38433. t12 += v * b9;
  38434. t13 += v * b10;
  38435. t14 += v * b11;
  38436. t15 += v * b12;
  38437. t16 += v * b13;
  38438. t17 += v * b14;
  38439. t18 += v * b15;
  38440. v = a[4];
  38441. t4 += v * b0;
  38442. t5 += v * b1;
  38443. t6 += v * b2;
  38444. t7 += v * b3;
  38445. t8 += v * b4;
  38446. t9 += v * b5;
  38447. t10 += v * b6;
  38448. t11 += v * b7;
  38449. t12 += v * b8;
  38450. t13 += v * b9;
  38451. t14 += v * b10;
  38452. t15 += v * b11;
  38453. t16 += v * b12;
  38454. t17 += v * b13;
  38455. t18 += v * b14;
  38456. t19 += v * b15;
  38457. v = a[5];
  38458. t5 += v * b0;
  38459. t6 += v * b1;
  38460. t7 += v * b2;
  38461. t8 += v * b3;
  38462. t9 += v * b4;
  38463. t10 += v * b5;
  38464. t11 += v * b6;
  38465. t12 += v * b7;
  38466. t13 += v * b8;
  38467. t14 += v * b9;
  38468. t15 += v * b10;
  38469. t16 += v * b11;
  38470. t17 += v * b12;
  38471. t18 += v * b13;
  38472. t19 += v * b14;
  38473. t20 += v * b15;
  38474. v = a[6];
  38475. t6 += v * b0;
  38476. t7 += v * b1;
  38477. t8 += v * b2;
  38478. t9 += v * b3;
  38479. t10 += v * b4;
  38480. t11 += v * b5;
  38481. t12 += v * b6;
  38482. t13 += v * b7;
  38483. t14 += v * b8;
  38484. t15 += v * b9;
  38485. t16 += v * b10;
  38486. t17 += v * b11;
  38487. t18 += v * b12;
  38488. t19 += v * b13;
  38489. t20 += v * b14;
  38490. t21 += v * b15;
  38491. v = a[7];
  38492. t7 += v * b0;
  38493. t8 += v * b1;
  38494. t9 += v * b2;
  38495. t10 += v * b3;
  38496. t11 += v * b4;
  38497. t12 += v * b5;
  38498. t13 += v * b6;
  38499. t14 += v * b7;
  38500. t15 += v * b8;
  38501. t16 += v * b9;
  38502. t17 += v * b10;
  38503. t18 += v * b11;
  38504. t19 += v * b12;
  38505. t20 += v * b13;
  38506. t21 += v * b14;
  38507. t22 += v * b15;
  38508. v = a[8];
  38509. t8 += v * b0;
  38510. t9 += v * b1;
  38511. t10 += v * b2;
  38512. t11 += v * b3;
  38513. t12 += v * b4;
  38514. t13 += v * b5;
  38515. t14 += v * b6;
  38516. t15 += v * b7;
  38517. t16 += v * b8;
  38518. t17 += v * b9;
  38519. t18 += v * b10;
  38520. t19 += v * b11;
  38521. t20 += v * b12;
  38522. t21 += v * b13;
  38523. t22 += v * b14;
  38524. t23 += v * b15;
  38525. v = a[9];
  38526. t9 += v * b0;
  38527. t10 += v * b1;
  38528. t11 += v * b2;
  38529. t12 += v * b3;
  38530. t13 += v * b4;
  38531. t14 += v * b5;
  38532. t15 += v * b6;
  38533. t16 += v * b7;
  38534. t17 += v * b8;
  38535. t18 += v * b9;
  38536. t19 += v * b10;
  38537. t20 += v * b11;
  38538. t21 += v * b12;
  38539. t22 += v * b13;
  38540. t23 += v * b14;
  38541. t24 += v * b15;
  38542. v = a[10];
  38543. t10 += v * b0;
  38544. t11 += v * b1;
  38545. t12 += v * b2;
  38546. t13 += v * b3;
  38547. t14 += v * b4;
  38548. t15 += v * b5;
  38549. t16 += v * b6;
  38550. t17 += v * b7;
  38551. t18 += v * b8;
  38552. t19 += v * b9;
  38553. t20 += v * b10;
  38554. t21 += v * b11;
  38555. t22 += v * b12;
  38556. t23 += v * b13;
  38557. t24 += v * b14;
  38558. t25 += v * b15;
  38559. v = a[11];
  38560. t11 += v * b0;
  38561. t12 += v * b1;
  38562. t13 += v * b2;
  38563. t14 += v * b3;
  38564. t15 += v * b4;
  38565. t16 += v * b5;
  38566. t17 += v * b6;
  38567. t18 += v * b7;
  38568. t19 += v * b8;
  38569. t20 += v * b9;
  38570. t21 += v * b10;
  38571. t22 += v * b11;
  38572. t23 += v * b12;
  38573. t24 += v * b13;
  38574. t25 += v * b14;
  38575. t26 += v * b15;
  38576. v = a[12];
  38577. t12 += v * b0;
  38578. t13 += v * b1;
  38579. t14 += v * b2;
  38580. t15 += v * b3;
  38581. t16 += v * b4;
  38582. t17 += v * b5;
  38583. t18 += v * b6;
  38584. t19 += v * b7;
  38585. t20 += v * b8;
  38586. t21 += v * b9;
  38587. t22 += v * b10;
  38588. t23 += v * b11;
  38589. t24 += v * b12;
  38590. t25 += v * b13;
  38591. t26 += v * b14;
  38592. t27 += v * b15;
  38593. v = a[13];
  38594. t13 += v * b0;
  38595. t14 += v * b1;
  38596. t15 += v * b2;
  38597. t16 += v * b3;
  38598. t17 += v * b4;
  38599. t18 += v * b5;
  38600. t19 += v * b6;
  38601. t20 += v * b7;
  38602. t21 += v * b8;
  38603. t22 += v * b9;
  38604. t23 += v * b10;
  38605. t24 += v * b11;
  38606. t25 += v * b12;
  38607. t26 += v * b13;
  38608. t27 += v * b14;
  38609. t28 += v * b15;
  38610. v = a[14];
  38611. t14 += v * b0;
  38612. t15 += v * b1;
  38613. t16 += v * b2;
  38614. t17 += v * b3;
  38615. t18 += v * b4;
  38616. t19 += v * b5;
  38617. t20 += v * b6;
  38618. t21 += v * b7;
  38619. t22 += v * b8;
  38620. t23 += v * b9;
  38621. t24 += v * b10;
  38622. t25 += v * b11;
  38623. t26 += v * b12;
  38624. t27 += v * b13;
  38625. t28 += v * b14;
  38626. t29 += v * b15;
  38627. v = a[15];
  38628. t15 += v * b0;
  38629. t16 += v * b1;
  38630. t17 += v * b2;
  38631. t18 += v * b3;
  38632. t19 += v * b4;
  38633. t20 += v * b5;
  38634. t21 += v * b6;
  38635. t22 += v * b7;
  38636. t23 += v * b8;
  38637. t24 += v * b9;
  38638. t25 += v * b10;
  38639. t26 += v * b11;
  38640. t27 += v * b12;
  38641. t28 += v * b13;
  38642. t29 += v * b14;
  38643. t30 += v * b15;
  38644. t0 += 38 * t16;
  38645. t1 += 38 * t17;
  38646. t2 += 38 * t18;
  38647. t3 += 38 * t19;
  38648. t4 += 38 * t20;
  38649. t5 += 38 * t21;
  38650. t6 += 38 * t22;
  38651. t7 += 38 * t23;
  38652. t8 += 38 * t24;
  38653. t9 += 38 * t25;
  38654. t10 += 38 * t26;
  38655. t11 += 38 * t27;
  38656. t12 += 38 * t28;
  38657. t13 += 38 * t29;
  38658. t14 += 38 * t30;
  38659. // t15 left as is
  38660. // first car
  38661. c = 1;
  38662. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38663. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38664. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38665. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38666. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38667. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38668. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38669. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38670. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38671. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38672. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38673. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38674. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38675. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38676. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38677. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38678. t0 += c-1 + 37 * (c-1);
  38679. // second car
  38680. c = 1;
  38681. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38682. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38683. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38684. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38685. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38686. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38687. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38688. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38689. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38690. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38691. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38692. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38693. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38694. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38695. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38696. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38697. t0 += c-1 + 37 * (c-1);
  38698. o[ 0] = t0;
  38699. o[ 1] = t1;
  38700. o[ 2] = t2;
  38701. o[ 3] = t3;
  38702. o[ 4] = t4;
  38703. o[ 5] = t5;
  38704. o[ 6] = t6;
  38705. o[ 7] = t7;
  38706. o[ 8] = t8;
  38707. o[ 9] = t9;
  38708. o[10] = t10;
  38709. o[11] = t11;
  38710. o[12] = t12;
  38711. o[13] = t13;
  38712. o[14] = t14;
  38713. o[15] = t15;
  38714. }
  38715. function S(o, a) {
  38716. M(o, a, a);
  38717. }
  38718. function inv25519(o, i) {
  38719. var c = gf();
  38720. var a;
  38721. for (a = 0; a < 16; a++) c[a] = i[a];
  38722. for (a = 253; a >= 0; a--) {
  38723. S(c, c);
  38724. if(a !== 2 && a !== 4) M(c, c, i);
  38725. }
  38726. for (a = 0; a < 16; a++) o[a] = c[a];
  38727. }
  38728. function pow2523(o, i) {
  38729. var c = gf();
  38730. var a;
  38731. for (a = 0; a < 16; a++) c[a] = i[a];
  38732. for (a = 250; a >= 0; a--) {
  38733. S(c, c);
  38734. if(a !== 1) M(c, c, i);
  38735. }
  38736. for (a = 0; a < 16; a++) o[a] = c[a];
  38737. }
  38738. function crypto_scalarmult(q, n, p) {
  38739. var z = new Uint8Array(32);
  38740. var x = new Float64Array(80), r, i;
  38741. var a = gf(), b = gf(), c = gf(),
  38742. d = gf(), e = gf(), f = gf();
  38743. for (i = 0; i < 31; i++) z[i] = n[i];
  38744. z[31]=(n[31]&127)|64;
  38745. z[0]&=248;
  38746. unpack25519(x,p);
  38747. for (i = 0; i < 16; i++) {
  38748. b[i]=x[i];
  38749. d[i]=a[i]=c[i]=0;
  38750. }
  38751. a[0]=d[0]=1;
  38752. for (i=254; i>=0; --i) {
  38753. r=(z[i>>>3]>>>(i&7))&1;
  38754. sel25519(a,b,r);
  38755. sel25519(c,d,r);
  38756. A(e,a,c);
  38757. Z(a,a,c);
  38758. A(c,b,d);
  38759. Z(b,b,d);
  38760. S(d,e);
  38761. S(f,a);
  38762. M(a,c,a);
  38763. M(c,b,e);
  38764. A(e,a,c);
  38765. Z(a,a,c);
  38766. S(b,a);
  38767. Z(c,d,f);
  38768. M(a,c,_121665);
  38769. A(a,a,d);
  38770. M(c,c,a);
  38771. M(a,d,f);
  38772. M(d,b,x);
  38773. S(b,e);
  38774. sel25519(a,b,r);
  38775. sel25519(c,d,r);
  38776. }
  38777. for (i = 0; i < 16; i++) {
  38778. x[i+16]=a[i];
  38779. x[i+32]=c[i];
  38780. x[i+48]=b[i];
  38781. x[i+64]=d[i];
  38782. }
  38783. var x32 = x.subarray(32);
  38784. var x16 = x.subarray(16);
  38785. inv25519(x32,x32);
  38786. M(x16,x16,x32);
  38787. pack25519(q,x16);
  38788. return 0;
  38789. }
  38790. function crypto_scalarmult_base(q, n) {
  38791. return crypto_scalarmult(q, n, _9);
  38792. }
  38793. function crypto_box_keypair(y, x) {
  38794. randombytes(x, 32);
  38795. return crypto_scalarmult_base(y, x);
  38796. }
  38797. function crypto_box_beforenm(k, y, x) {
  38798. var s = new Uint8Array(32);
  38799. crypto_scalarmult(s, x, y);
  38800. return crypto_core_hsalsa20(k, _0, s, sigma);
  38801. }
  38802. var crypto_box_afternm = crypto_secretbox;
  38803. var crypto_box_open_afternm = crypto_secretbox_open;
  38804. function crypto_box(c, m, d, n, y, x) {
  38805. var k = new Uint8Array(32);
  38806. crypto_box_beforenm(k, y, x);
  38807. return crypto_box_afternm(c, m, d, n, k);
  38808. }
  38809. function crypto_box_open(m, c, d, n, y, x) {
  38810. var k = new Uint8Array(32);
  38811. crypto_box_beforenm(k, y, x);
  38812. return crypto_box_open_afternm(m, c, d, n, k);
  38813. }
  38814. var K = [
  38815. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38816. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38817. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38818. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38819. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38820. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38821. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38822. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38823. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38824. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38825. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38826. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38827. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38828. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38829. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38830. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38831. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38832. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38833. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38834. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38835. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38836. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38837. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38838. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38839. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38840. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38841. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38842. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38843. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38844. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38845. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38846. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38847. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38848. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38849. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38850. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38851. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38852. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38853. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38854. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38855. ];
  38856. function crypto_hashblocks_hl(hh, hl, m, n) {
  38857. var wh = new Int32Array(16), wl = new Int32Array(16),
  38858. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38859. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38860. th, tl, i, j, h, l, a, b, c, d;
  38861. var ah0 = hh[0],
  38862. ah1 = hh[1],
  38863. ah2 = hh[2],
  38864. ah3 = hh[3],
  38865. ah4 = hh[4],
  38866. ah5 = hh[5],
  38867. ah6 = hh[6],
  38868. ah7 = hh[7],
  38869. al0 = hl[0],
  38870. al1 = hl[1],
  38871. al2 = hl[2],
  38872. al3 = hl[3],
  38873. al4 = hl[4],
  38874. al5 = hl[5],
  38875. al6 = hl[6],
  38876. al7 = hl[7];
  38877. var pos = 0;
  38878. while (n >= 128) {
  38879. for (i = 0; i < 16; i++) {
  38880. j = 8 * i + pos;
  38881. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38882. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38883. }
  38884. for (i = 0; i < 80; i++) {
  38885. bh0 = ah0;
  38886. bh1 = ah1;
  38887. bh2 = ah2;
  38888. bh3 = ah3;
  38889. bh4 = ah4;
  38890. bh5 = ah5;
  38891. bh6 = ah6;
  38892. bh7 = ah7;
  38893. bl0 = al0;
  38894. bl1 = al1;
  38895. bl2 = al2;
  38896. bl3 = al3;
  38897. bl4 = al4;
  38898. bl5 = al5;
  38899. bl6 = al6;
  38900. bl7 = al7;
  38901. // add
  38902. h = ah7;
  38903. l = al7;
  38904. a = l & 0xffff; b = l >>> 16;
  38905. c = h & 0xffff; d = h >>> 16;
  38906. // Sigma1
  38907. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38908. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38909. a += l & 0xffff; b += l >>> 16;
  38910. c += h & 0xffff; d += h >>> 16;
  38911. // Ch
  38912. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38913. l = (al4 & al5) ^ (~al4 & al6);
  38914. a += l & 0xffff; b += l >>> 16;
  38915. c += h & 0xffff; d += h >>> 16;
  38916. // K
  38917. h = K[i*2];
  38918. l = K[i*2+1];
  38919. a += l & 0xffff; b += l >>> 16;
  38920. c += h & 0xffff; d += h >>> 16;
  38921. // w
  38922. h = wh[i%16];
  38923. l = wl[i%16];
  38924. a += l & 0xffff; b += l >>> 16;
  38925. c += h & 0xffff; d += h >>> 16;
  38926. b += a >>> 16;
  38927. c += b >>> 16;
  38928. d += c >>> 16;
  38929. th = c & 0xffff | d << 16;
  38930. tl = a & 0xffff | b << 16;
  38931. // add
  38932. h = th;
  38933. l = tl;
  38934. a = l & 0xffff; b = l >>> 16;
  38935. c = h & 0xffff; d = h >>> 16;
  38936. // Sigma0
  38937. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38938. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38939. a += l & 0xffff; b += l >>> 16;
  38940. c += h & 0xffff; d += h >>> 16;
  38941. // Maj
  38942. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38943. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38944. a += l & 0xffff; b += l >>> 16;
  38945. c += h & 0xffff; d += h >>> 16;
  38946. b += a >>> 16;
  38947. c += b >>> 16;
  38948. d += c >>> 16;
  38949. bh7 = (c & 0xffff) | (d << 16);
  38950. bl7 = (a & 0xffff) | (b << 16);
  38951. // add
  38952. h = bh3;
  38953. l = bl3;
  38954. a = l & 0xffff; b = l >>> 16;
  38955. c = h & 0xffff; d = h >>> 16;
  38956. h = th;
  38957. l = tl;
  38958. a += l & 0xffff; b += l >>> 16;
  38959. c += h & 0xffff; d += h >>> 16;
  38960. b += a >>> 16;
  38961. c += b >>> 16;
  38962. d += c >>> 16;
  38963. bh3 = (c & 0xffff) | (d << 16);
  38964. bl3 = (a & 0xffff) | (b << 16);
  38965. ah1 = bh0;
  38966. ah2 = bh1;
  38967. ah3 = bh2;
  38968. ah4 = bh3;
  38969. ah5 = bh4;
  38970. ah6 = bh5;
  38971. ah7 = bh6;
  38972. ah0 = bh7;
  38973. al1 = bl0;
  38974. al2 = bl1;
  38975. al3 = bl2;
  38976. al4 = bl3;
  38977. al5 = bl4;
  38978. al6 = bl5;
  38979. al7 = bl6;
  38980. al0 = bl7;
  38981. if (i%16 === 15) {
  38982. for (j = 0; j < 16; j++) {
  38983. // add
  38984. h = wh[j];
  38985. l = wl[j];
  38986. a = l & 0xffff; b = l >>> 16;
  38987. c = h & 0xffff; d = h >>> 16;
  38988. h = wh[(j+9)%16];
  38989. l = wl[(j+9)%16];
  38990. a += l & 0xffff; b += l >>> 16;
  38991. c += h & 0xffff; d += h >>> 16;
  38992. // sigma0
  38993. th = wh[(j+1)%16];
  38994. tl = wl[(j+1)%16];
  38995. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38996. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38997. a += l & 0xffff; b += l >>> 16;
  38998. c += h & 0xffff; d += h >>> 16;
  38999. // sigma1
  39000. th = wh[(j+14)%16];
  39001. tl = wl[(j+14)%16];
  39002. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39003. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39004. a += l & 0xffff; b += l >>> 16;
  39005. c += h & 0xffff; d += h >>> 16;
  39006. b += a >>> 16;
  39007. c += b >>> 16;
  39008. d += c >>> 16;
  39009. wh[j] = (c & 0xffff) | (d << 16);
  39010. wl[j] = (a & 0xffff) | (b << 16);
  39011. }
  39012. }
  39013. }
  39014. // add
  39015. h = ah0;
  39016. l = al0;
  39017. a = l & 0xffff; b = l >>> 16;
  39018. c = h & 0xffff; d = h >>> 16;
  39019. h = hh[0];
  39020. l = hl[0];
  39021. a += l & 0xffff; b += l >>> 16;
  39022. c += h & 0xffff; d += h >>> 16;
  39023. b += a >>> 16;
  39024. c += b >>> 16;
  39025. d += c >>> 16;
  39026. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39027. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39028. h = ah1;
  39029. l = al1;
  39030. a = l & 0xffff; b = l >>> 16;
  39031. c = h & 0xffff; d = h >>> 16;
  39032. h = hh[1];
  39033. l = hl[1];
  39034. a += l & 0xffff; b += l >>> 16;
  39035. c += h & 0xffff; d += h >>> 16;
  39036. b += a >>> 16;
  39037. c += b >>> 16;
  39038. d += c >>> 16;
  39039. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39040. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39041. h = ah2;
  39042. l = al2;
  39043. a = l & 0xffff; b = l >>> 16;
  39044. c = h & 0xffff; d = h >>> 16;
  39045. h = hh[2];
  39046. l = hl[2];
  39047. a += l & 0xffff; b += l >>> 16;
  39048. c += h & 0xffff; d += h >>> 16;
  39049. b += a >>> 16;
  39050. c += b >>> 16;
  39051. d += c >>> 16;
  39052. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39053. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39054. h = ah3;
  39055. l = al3;
  39056. a = l & 0xffff; b = l >>> 16;
  39057. c = h & 0xffff; d = h >>> 16;
  39058. h = hh[3];
  39059. l = hl[3];
  39060. a += l & 0xffff; b += l >>> 16;
  39061. c += h & 0xffff; d += h >>> 16;
  39062. b += a >>> 16;
  39063. c += b >>> 16;
  39064. d += c >>> 16;
  39065. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39066. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39067. h = ah4;
  39068. l = al4;
  39069. a = l & 0xffff; b = l >>> 16;
  39070. c = h & 0xffff; d = h >>> 16;
  39071. h = hh[4];
  39072. l = hl[4];
  39073. a += l & 0xffff; b += l >>> 16;
  39074. c += h & 0xffff; d += h >>> 16;
  39075. b += a >>> 16;
  39076. c += b >>> 16;
  39077. d += c >>> 16;
  39078. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39079. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39080. h = ah5;
  39081. l = al5;
  39082. a = l & 0xffff; b = l >>> 16;
  39083. c = h & 0xffff; d = h >>> 16;
  39084. h = hh[5];
  39085. l = hl[5];
  39086. a += l & 0xffff; b += l >>> 16;
  39087. c += h & 0xffff; d += h >>> 16;
  39088. b += a >>> 16;
  39089. c += b >>> 16;
  39090. d += c >>> 16;
  39091. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39092. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39093. h = ah6;
  39094. l = al6;
  39095. a = l & 0xffff; b = l >>> 16;
  39096. c = h & 0xffff; d = h >>> 16;
  39097. h = hh[6];
  39098. l = hl[6];
  39099. a += l & 0xffff; b += l >>> 16;
  39100. c += h & 0xffff; d += h >>> 16;
  39101. b += a >>> 16;
  39102. c += b >>> 16;
  39103. d += c >>> 16;
  39104. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39105. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39106. h = ah7;
  39107. l = al7;
  39108. a = l & 0xffff; b = l >>> 16;
  39109. c = h & 0xffff; d = h >>> 16;
  39110. h = hh[7];
  39111. l = hl[7];
  39112. a += l & 0xffff; b += l >>> 16;
  39113. c += h & 0xffff; d += h >>> 16;
  39114. b += a >>> 16;
  39115. c += b >>> 16;
  39116. d += c >>> 16;
  39117. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39118. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39119. pos += 128;
  39120. n -= 128;
  39121. }
  39122. return n;
  39123. }
  39124. function crypto_hash(out, m, n) {
  39125. var hh = new Int32Array(8),
  39126. hl = new Int32Array(8),
  39127. x = new Uint8Array(256),
  39128. i, b = n;
  39129. hh[0] = 0x6a09e667;
  39130. hh[1] = 0xbb67ae85;
  39131. hh[2] = 0x3c6ef372;
  39132. hh[3] = 0xa54ff53a;
  39133. hh[4] = 0x510e527f;
  39134. hh[5] = 0x9b05688c;
  39135. hh[6] = 0x1f83d9ab;
  39136. hh[7] = 0x5be0cd19;
  39137. hl[0] = 0xf3bcc908;
  39138. hl[1] = 0x84caa73b;
  39139. hl[2] = 0xfe94f82b;
  39140. hl[3] = 0x5f1d36f1;
  39141. hl[4] = 0xade682d1;
  39142. hl[5] = 0x2b3e6c1f;
  39143. hl[6] = 0xfb41bd6b;
  39144. hl[7] = 0x137e2179;
  39145. crypto_hashblocks_hl(hh, hl, m, n);
  39146. n %= 128;
  39147. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39148. x[n] = 128;
  39149. n = 256-128*(n<112?1:0);
  39150. x[n-9] = 0;
  39151. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39152. crypto_hashblocks_hl(hh, hl, x, n);
  39153. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39154. return 0;
  39155. }
  39156. function add(p, q) {
  39157. var a = gf(), b = gf(), c = gf(),
  39158. d = gf(), e = gf(), f = gf(),
  39159. g = gf(), h = gf(), t = gf();
  39160. Z(a, p[1], p[0]);
  39161. Z(t, q[1], q[0]);
  39162. M(a, a, t);
  39163. A(b, p[0], p[1]);
  39164. A(t, q[0], q[1]);
  39165. M(b, b, t);
  39166. M(c, p[3], q[3]);
  39167. M(c, c, D2);
  39168. M(d, p[2], q[2]);
  39169. A(d, d, d);
  39170. Z(e, b, a);
  39171. Z(f, d, c);
  39172. A(g, d, c);
  39173. A(h, b, a);
  39174. M(p[0], e, f);
  39175. M(p[1], h, g);
  39176. M(p[2], g, f);
  39177. M(p[3], e, h);
  39178. }
  39179. function cswap(p, q, b) {
  39180. var i;
  39181. for (i = 0; i < 4; i++) {
  39182. sel25519(p[i], q[i], b);
  39183. }
  39184. }
  39185. function pack(r, p) {
  39186. var tx = gf(), ty = gf(), zi = gf();
  39187. inv25519(zi, p[2]);
  39188. M(tx, p[0], zi);
  39189. M(ty, p[1], zi);
  39190. pack25519(r, ty);
  39191. r[31] ^= par25519(tx) << 7;
  39192. }
  39193. function scalarmult(p, q, s) {
  39194. var b, i;
  39195. set25519(p[0], gf0);
  39196. set25519(p[1], gf1);
  39197. set25519(p[2], gf1);
  39198. set25519(p[3], gf0);
  39199. for (i = 255; i >= 0; --i) {
  39200. b = (s[(i/8)|0] >> (i&7)) & 1;
  39201. cswap(p, q, b);
  39202. add(q, p);
  39203. add(p, p);
  39204. cswap(p, q, b);
  39205. }
  39206. }
  39207. function scalarbase(p, s) {
  39208. var q = [gf(), gf(), gf(), gf()];
  39209. set25519(q[0], X);
  39210. set25519(q[1], Y);
  39211. set25519(q[2], gf1);
  39212. M(q[3], X, Y);
  39213. scalarmult(p, q, s);
  39214. }
  39215. function crypto_sign_keypair(pk, sk, seeded) {
  39216. var d = new Uint8Array(64);
  39217. var p = [gf(), gf(), gf(), gf()];
  39218. var i;
  39219. if (!seeded) randombytes(sk, 32);
  39220. crypto_hash(d, sk, 32);
  39221. d[0] &= 248;
  39222. d[31] &= 127;
  39223. d[31] |= 64;
  39224. scalarbase(p, d);
  39225. pack(pk, p);
  39226. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39227. return 0;
  39228. }
  39229. 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]);
  39230. function modL(r, x) {
  39231. var carry, i, j, k;
  39232. for (i = 63; i >= 32; --i) {
  39233. carry = 0;
  39234. for (j = i - 32, k = i - 12; j < k; ++j) {
  39235. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39236. carry = (x[j] + 128) >> 8;
  39237. x[j] -= carry * 256;
  39238. }
  39239. x[j] += carry;
  39240. x[i] = 0;
  39241. }
  39242. carry = 0;
  39243. for (j = 0; j < 32; j++) {
  39244. x[j] += carry - (x[31] >> 4) * L[j];
  39245. carry = x[j] >> 8;
  39246. x[j] &= 255;
  39247. }
  39248. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39249. for (i = 0; i < 32; i++) {
  39250. x[i+1] += x[i] >> 8;
  39251. r[i] = x[i] & 255;
  39252. }
  39253. }
  39254. function reduce(r) {
  39255. var x = new Float64Array(64), i;
  39256. for (i = 0; i < 64; i++) x[i] = r[i];
  39257. for (i = 0; i < 64; i++) r[i] = 0;
  39258. modL(r, x);
  39259. }
  39260. // Note: difference from C - smlen returned, not passed as argument.
  39261. function crypto_sign(sm, m, n, sk) {
  39262. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39263. var i, j, x = new Float64Array(64);
  39264. var p = [gf(), gf(), gf(), gf()];
  39265. crypto_hash(d, sk, 32);
  39266. d[0] &= 248;
  39267. d[31] &= 127;
  39268. d[31] |= 64;
  39269. var smlen = n + 64;
  39270. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39271. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39272. crypto_hash(r, sm.subarray(32), n+32);
  39273. reduce(r);
  39274. scalarbase(p, r);
  39275. pack(sm, p);
  39276. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39277. crypto_hash(h, sm, n + 64);
  39278. reduce(h);
  39279. for (i = 0; i < 64; i++) x[i] = 0;
  39280. for (i = 0; i < 32; i++) x[i] = r[i];
  39281. for (i = 0; i < 32; i++) {
  39282. for (j = 0; j < 32; j++) {
  39283. x[i+j] += h[i] * d[j];
  39284. }
  39285. }
  39286. modL(sm.subarray(32), x);
  39287. return smlen;
  39288. }
  39289. function unpackneg(r, p) {
  39290. var t = gf(), chk = gf(), num = gf(),
  39291. den = gf(), den2 = gf(), den4 = gf(),
  39292. den6 = gf();
  39293. set25519(r[2], gf1);
  39294. unpack25519(r[1], p);
  39295. S(num, r[1]);
  39296. M(den, num, D);
  39297. Z(num, num, r[2]);
  39298. A(den, r[2], den);
  39299. S(den2, den);
  39300. S(den4, den2);
  39301. M(den6, den4, den2);
  39302. M(t, den6, num);
  39303. M(t, t, den);
  39304. pow2523(t, t);
  39305. M(t, t, num);
  39306. M(t, t, den);
  39307. M(t, t, den);
  39308. M(r[0], t, den);
  39309. S(chk, r[0]);
  39310. M(chk, chk, den);
  39311. if (neq25519(chk, num)) M(r[0], r[0], I);
  39312. S(chk, r[0]);
  39313. M(chk, chk, den);
  39314. if (neq25519(chk, num)) return -1;
  39315. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39316. M(r[3], r[0], r[1]);
  39317. return 0;
  39318. }
  39319. function crypto_sign_open(m, sm, n, pk) {
  39320. var i, mlen;
  39321. var t = new Uint8Array(32), h = new Uint8Array(64);
  39322. var p = [gf(), gf(), gf(), gf()],
  39323. q = [gf(), gf(), gf(), gf()];
  39324. mlen = -1;
  39325. if (n < 64) return -1;
  39326. if (unpackneg(q, pk)) return -1;
  39327. for (i = 0; i < n; i++) m[i] = sm[i];
  39328. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39329. crypto_hash(h, m, n);
  39330. reduce(h);
  39331. scalarmult(p, q, h);
  39332. scalarbase(q, sm.subarray(32));
  39333. add(p, q);
  39334. pack(t, p);
  39335. n -= 64;
  39336. if (crypto_verify_32(sm, 0, t, 0)) {
  39337. for (i = 0; i < n; i++) m[i] = 0;
  39338. return -1;
  39339. }
  39340. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39341. mlen = n;
  39342. return mlen;
  39343. }
  39344. var crypto_secretbox_KEYBYTES = 32,
  39345. crypto_secretbox_NONCEBYTES = 24,
  39346. crypto_secretbox_ZEROBYTES = 32,
  39347. crypto_secretbox_BOXZEROBYTES = 16,
  39348. crypto_scalarmult_BYTES = 32,
  39349. crypto_scalarmult_SCALARBYTES = 32,
  39350. crypto_box_PUBLICKEYBYTES = 32,
  39351. crypto_box_SECRETKEYBYTES = 32,
  39352. crypto_box_BEFORENMBYTES = 32,
  39353. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39354. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39355. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39356. crypto_sign_BYTES = 64,
  39357. crypto_sign_PUBLICKEYBYTES = 32,
  39358. crypto_sign_SECRETKEYBYTES = 64,
  39359. crypto_sign_SEEDBYTES = 32,
  39360. crypto_hash_BYTES = 64;
  39361. nacl.lowlevel = {
  39362. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39363. crypto_stream_xor: crypto_stream_xor,
  39364. crypto_stream: crypto_stream,
  39365. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39366. crypto_stream_salsa20: crypto_stream_salsa20,
  39367. crypto_onetimeauth: crypto_onetimeauth,
  39368. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39369. crypto_verify_16: crypto_verify_16,
  39370. crypto_verify_32: crypto_verify_32,
  39371. crypto_secretbox: crypto_secretbox,
  39372. crypto_secretbox_open: crypto_secretbox_open,
  39373. crypto_scalarmult: crypto_scalarmult,
  39374. crypto_scalarmult_base: crypto_scalarmult_base,
  39375. crypto_box_beforenm: crypto_box_beforenm,
  39376. crypto_box_afternm: crypto_box_afternm,
  39377. crypto_box: crypto_box,
  39378. crypto_box_open: crypto_box_open,
  39379. crypto_box_keypair: crypto_box_keypair,
  39380. crypto_hash: crypto_hash,
  39381. crypto_sign: crypto_sign,
  39382. crypto_sign_keypair: crypto_sign_keypair,
  39383. crypto_sign_open: crypto_sign_open,
  39384. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39385. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39386. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39387. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39388. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39389. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39390. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39391. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39392. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39393. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39394. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39395. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39396. crypto_sign_BYTES: crypto_sign_BYTES,
  39397. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39398. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39399. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39400. crypto_hash_BYTES: crypto_hash_BYTES
  39401. };
  39402. /* High-level API */
  39403. function checkLengths(k, n) {
  39404. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39405. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39406. }
  39407. function checkBoxLengths(pk, sk) {
  39408. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39409. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39410. }
  39411. function checkArrayTypes() {
  39412. for (var i = 0; i < arguments.length; i++) {
  39413. if (!(arguments[i] instanceof Uint8Array))
  39414. throw new TypeError('unexpected type, use Uint8Array');
  39415. }
  39416. }
  39417. function cleanup(arr) {
  39418. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39419. }
  39420. nacl.randomBytes = function(n) {
  39421. var b = new Uint8Array(n);
  39422. randombytes(b, n);
  39423. return b;
  39424. };
  39425. nacl.secretbox = function(msg, nonce, key) {
  39426. checkArrayTypes(msg, nonce, key);
  39427. checkLengths(key, nonce);
  39428. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39429. var c = new Uint8Array(m.length);
  39430. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39431. crypto_secretbox(c, m, m.length, nonce, key);
  39432. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39433. };
  39434. nacl.secretbox.open = function(box, nonce, key) {
  39435. checkArrayTypes(box, nonce, key);
  39436. checkLengths(key, nonce);
  39437. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39438. var m = new Uint8Array(c.length);
  39439. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39440. if (c.length < 32) return null;
  39441. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39442. return m.subarray(crypto_secretbox_ZEROBYTES);
  39443. };
  39444. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39445. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39446. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39447. nacl.scalarMult = function(n, p) {
  39448. checkArrayTypes(n, p);
  39449. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39450. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39451. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39452. crypto_scalarmult(q, n, p);
  39453. return q;
  39454. };
  39455. nacl.scalarMult.base = function(n) {
  39456. checkArrayTypes(n);
  39457. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39458. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39459. crypto_scalarmult_base(q, n);
  39460. return q;
  39461. };
  39462. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39463. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39464. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39465. var k = nacl.box.before(publicKey, secretKey);
  39466. return nacl.secretbox(msg, nonce, k);
  39467. };
  39468. nacl.box.before = function(publicKey, secretKey) {
  39469. checkArrayTypes(publicKey, secretKey);
  39470. checkBoxLengths(publicKey, secretKey);
  39471. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39472. crypto_box_beforenm(k, publicKey, secretKey);
  39473. return k;
  39474. };
  39475. nacl.box.after = nacl.secretbox;
  39476. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39477. var k = nacl.box.before(publicKey, secretKey);
  39478. return nacl.secretbox.open(msg, nonce, k);
  39479. };
  39480. nacl.box.open.after = nacl.secretbox.open;
  39481. nacl.box.keyPair = function() {
  39482. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39483. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39484. crypto_box_keypair(pk, sk);
  39485. return {publicKey: pk, secretKey: sk};
  39486. };
  39487. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39488. checkArrayTypes(secretKey);
  39489. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39490. throw new Error('bad secret key size');
  39491. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39492. crypto_scalarmult_base(pk, secretKey);
  39493. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39494. };
  39495. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39496. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39497. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39498. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39499. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39500. nacl.sign = function(msg, secretKey) {
  39501. checkArrayTypes(msg, secretKey);
  39502. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39503. throw new Error('bad secret key size');
  39504. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39505. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39506. return signedMsg;
  39507. };
  39508. nacl.sign.open = function(signedMsg, publicKey) {
  39509. checkArrayTypes(signedMsg, publicKey);
  39510. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39511. throw new Error('bad public key size');
  39512. var tmp = new Uint8Array(signedMsg.length);
  39513. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39514. if (mlen < 0) return null;
  39515. var m = new Uint8Array(mlen);
  39516. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39517. return m;
  39518. };
  39519. nacl.sign.detached = function(msg, secretKey) {
  39520. var signedMsg = nacl.sign(msg, secretKey);
  39521. var sig = new Uint8Array(crypto_sign_BYTES);
  39522. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39523. return sig;
  39524. };
  39525. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39526. checkArrayTypes(msg, sig, publicKey);
  39527. if (sig.length !== crypto_sign_BYTES)
  39528. throw new Error('bad signature size');
  39529. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39530. throw new Error('bad public key size');
  39531. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39532. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39533. var i;
  39534. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39535. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39536. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39537. };
  39538. nacl.sign.keyPair = function() {
  39539. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39540. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39541. crypto_sign_keypair(pk, sk);
  39542. return {publicKey: pk, secretKey: sk};
  39543. };
  39544. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39545. checkArrayTypes(secretKey);
  39546. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39547. throw new Error('bad secret key size');
  39548. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39549. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39550. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39551. };
  39552. nacl.sign.keyPair.fromSeed = function(seed) {
  39553. checkArrayTypes(seed);
  39554. if (seed.length !== crypto_sign_SEEDBYTES)
  39555. throw new Error('bad seed size');
  39556. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39557. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39558. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39559. crypto_sign_keypair(pk, sk, true);
  39560. return {publicKey: pk, secretKey: sk};
  39561. };
  39562. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39563. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39564. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39565. nacl.sign.signatureLength = crypto_sign_BYTES;
  39566. nacl.hash = function(msg) {
  39567. checkArrayTypes(msg);
  39568. var h = new Uint8Array(crypto_hash_BYTES);
  39569. crypto_hash(h, msg, msg.length);
  39570. return h;
  39571. };
  39572. nacl.hash.hashLength = crypto_hash_BYTES;
  39573. nacl.verify = function(x, y) {
  39574. checkArrayTypes(x, y);
  39575. // Zero length arguments are considered not equal.
  39576. if (x.length === 0 || y.length === 0) return false;
  39577. if (x.length !== y.length) return false;
  39578. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39579. };
  39580. nacl.setPRNG = function(fn) {
  39581. randombytes = fn;
  39582. };
  39583. (function() {
  39584. // Initialize PRNG if environment provides CSPRNG.
  39585. // If not, methods calling randombytes will throw.
  39586. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39587. if (crypto && crypto.getRandomValues) {
  39588. // Browsers.
  39589. var QUOTA = 65536;
  39590. nacl.setPRNG(function(x, n) {
  39591. var i, v = new Uint8Array(n);
  39592. for (i = 0; i < n; i += QUOTA) {
  39593. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39594. }
  39595. for (i = 0; i < n; i++) x[i] = v[i];
  39596. cleanup(v);
  39597. });
  39598. } else if (true) {
  39599. // Node.js.
  39600. crypto = __webpack_require__(3);
  39601. if (crypto && crypto.randomBytes) {
  39602. nacl.setPRNG(function(x, n) {
  39603. var i, v = crypto.randomBytes(n);
  39604. for (i = 0; i < n; i++) x[i] = v[i];
  39605. cleanup(v);
  39606. });
  39607. }
  39608. }
  39609. })();
  39610. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39611. /***/ }),
  39612. /* 1 */
  39613. /***/ (function(module, exports, __webpack_require__) {
  39614. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39615. // Public domain.
  39616. (function(root, f) {
  39617. 'use strict';
  39618. if ( true && module.exports) module.exports = f();
  39619. else if (root.nacl) root.nacl.util = f();
  39620. else {
  39621. root.nacl = {};
  39622. root.nacl.util = f();
  39623. }
  39624. }(this, function() {
  39625. 'use strict';
  39626. var util = {};
  39627. function validateBase64(s) {
  39628. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39629. throw new TypeError('invalid encoding');
  39630. }
  39631. }
  39632. util.decodeUTF8 = function(s) {
  39633. if (typeof s !== 'string') throw new TypeError('expected string');
  39634. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39635. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39636. return b;
  39637. };
  39638. util.encodeUTF8 = function(arr) {
  39639. var i, s = [];
  39640. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39641. return decodeURIComponent(escape(s.join('')));
  39642. };
  39643. if (typeof atob === 'undefined') {
  39644. // Node.js
  39645. if (typeof Buffer.from !== 'undefined') {
  39646. // Node v6 and later
  39647. util.encodeBase64 = function (arr) { // v6 and later
  39648. return Buffer.from(arr).toString('base64');
  39649. };
  39650. util.decodeBase64 = function (s) {
  39651. validateBase64(s);
  39652. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39653. };
  39654. } else {
  39655. // Node earlier than v6
  39656. util.encodeBase64 = function (arr) { // v6 and later
  39657. return (new Buffer(arr)).toString('base64');
  39658. };
  39659. util.decodeBase64 = function(s) {
  39660. validateBase64(s);
  39661. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39662. };
  39663. }
  39664. } else {
  39665. // Browsers
  39666. util.encodeBase64 = function(arr) {
  39667. var i, s = [], len = arr.length;
  39668. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39669. return btoa(s.join(''));
  39670. };
  39671. util.decodeBase64 = function(s) {
  39672. validateBase64(s);
  39673. var i, d = atob(s), b = new Uint8Array(d.length);
  39674. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39675. return b;
  39676. };
  39677. }
  39678. return util;
  39679. }));
  39680. /***/ }),
  39681. /* 2 */
  39682. /***/ (function(module, exports, __webpack_require__) {
  39683. // required so we don't have to do require('pusher').default etc.
  39684. module.exports = __webpack_require__(4).default;
  39685. /***/ }),
  39686. /* 3 */
  39687. /***/ (function(module, exports) {
  39688. /* (ignored) */
  39689. /***/ }),
  39690. /* 4 */
  39691. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39692. "use strict";
  39693. __webpack_require__.r(__webpack_exports__);
  39694. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39695. var ScriptReceiverFactory = (function () {
  39696. function ScriptReceiverFactory(prefix, name) {
  39697. this.lastId = 0;
  39698. this.prefix = prefix;
  39699. this.name = name;
  39700. }
  39701. ScriptReceiverFactory.prototype.create = function (callback) {
  39702. this.lastId++;
  39703. var number = this.lastId;
  39704. var id = this.prefix + number;
  39705. var name = this.name + "[" + number + "]";
  39706. var called = false;
  39707. var callbackWrapper = function () {
  39708. if (!called) {
  39709. callback.apply(null, arguments);
  39710. called = true;
  39711. }
  39712. };
  39713. this[number] = callbackWrapper;
  39714. return { number: number, id: id, name: name, callback: callbackWrapper };
  39715. };
  39716. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39717. delete this[receiver.number];
  39718. };
  39719. return ScriptReceiverFactory;
  39720. }());
  39721. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39722. // CONCATENATED MODULE: ./src/core/defaults.ts
  39723. var Defaults = {
  39724. VERSION: "5.0.3",
  39725. PROTOCOL: 7,
  39726. host: 'ws.pusherapp.com',
  39727. ws_port: 80,
  39728. wss_port: 443,
  39729. ws_path: '',
  39730. sockjs_host: 'sockjs.pusher.com',
  39731. sockjs_http_port: 80,
  39732. sockjs_https_port: 443,
  39733. sockjs_path: '/pusher',
  39734. stats_host: 'stats.pusher.com',
  39735. channel_auth_endpoint: '/pusher/auth',
  39736. channel_auth_transport: 'ajax',
  39737. activity_timeout: 120000,
  39738. pong_timeout: 30000,
  39739. unavailable_timeout: 10000,
  39740. cdn_http: "http://js.pusher.com",
  39741. cdn_https: "https://js.pusher.com",
  39742. dependency_suffix: ""
  39743. };
  39744. /* harmony default export */ var defaults = (Defaults);
  39745. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39746. var dependency_loader_DependencyLoader = (function () {
  39747. function DependencyLoader(options) {
  39748. this.options = options;
  39749. this.receivers = options.receivers || ScriptReceivers;
  39750. this.loading = {};
  39751. }
  39752. DependencyLoader.prototype.load = function (name, options, callback) {
  39753. var self = this;
  39754. if (self.loading[name] && self.loading[name].length > 0) {
  39755. self.loading[name].push(callback);
  39756. }
  39757. else {
  39758. self.loading[name] = [callback];
  39759. var request = runtime.createScriptRequest(self.getPath(name, options));
  39760. var receiver = self.receivers.create(function (error) {
  39761. self.receivers.remove(receiver);
  39762. if (self.loading[name]) {
  39763. var callbacks = self.loading[name];
  39764. delete self.loading[name];
  39765. var successCallback = function (wasSuccessful) {
  39766. if (!wasSuccessful) {
  39767. request.cleanup();
  39768. }
  39769. };
  39770. for (var i = 0; i < callbacks.length; i++) {
  39771. callbacks[i](error, successCallback);
  39772. }
  39773. }
  39774. });
  39775. request.send(receiver);
  39776. }
  39777. };
  39778. DependencyLoader.prototype.getRoot = function (options) {
  39779. var cdn;
  39780. var protocol = runtime.getDocument().location.protocol;
  39781. if ((options && options.useTLS) || protocol === "https:") {
  39782. cdn = this.options.cdn_https;
  39783. }
  39784. else {
  39785. cdn = this.options.cdn_http;
  39786. }
  39787. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39788. };
  39789. DependencyLoader.prototype.getPath = function (name, options) {
  39790. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39791. };
  39792. ;
  39793. return DependencyLoader;
  39794. }());
  39795. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39796. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39797. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39798. var Dependencies = new dependency_loader({
  39799. cdn_http: defaults.cdn_http,
  39800. cdn_https: defaults.cdn_https,
  39801. version: defaults.VERSION,
  39802. suffix: defaults.dependency_suffix,
  39803. receivers: DependenciesReceivers
  39804. });
  39805. // CONCATENATED MODULE: ./src/core/base64.ts
  39806. function encode(s) {
  39807. return btoa(utob(s));
  39808. }
  39809. var fromCharCode = String.fromCharCode;
  39810. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39811. var b64tab = {};
  39812. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39813. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39814. }
  39815. var cb_utob = function (c) {
  39816. var cc = c.charCodeAt(0);
  39817. return cc < 0x80
  39818. ? c
  39819. : cc < 0x800
  39820. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39821. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39822. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39823. fromCharCode(0x80 | (cc & 0x3f));
  39824. };
  39825. var utob = function (u) {
  39826. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39827. };
  39828. var cb_encode = function (ccc) {
  39829. var padlen = [0, 2, 1][ccc.length % 3];
  39830. var ord = (ccc.charCodeAt(0) << 16) |
  39831. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39832. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39833. var chars = [
  39834. b64chars.charAt(ord >>> 18),
  39835. b64chars.charAt((ord >>> 12) & 63),
  39836. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39837. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39838. ];
  39839. return chars.join('');
  39840. };
  39841. var btoa = window.btoa ||
  39842. function (b) {
  39843. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39844. };
  39845. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39846. var Timer = (function () {
  39847. function Timer(set, clear, delay, callback) {
  39848. var _this = this;
  39849. this.clear = clear;
  39850. this.timer = set(function () {
  39851. if (_this.timer) {
  39852. _this.timer = callback(_this.timer);
  39853. }
  39854. }, delay);
  39855. }
  39856. Timer.prototype.isRunning = function () {
  39857. return this.timer !== null;
  39858. };
  39859. Timer.prototype.ensureAborted = function () {
  39860. if (this.timer) {
  39861. this.clear(this.timer);
  39862. this.timer = null;
  39863. }
  39864. };
  39865. return Timer;
  39866. }());
  39867. /* harmony default export */ var abstract_timer = (Timer);
  39868. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39869. var __extends = (undefined && undefined.__extends) || (function () {
  39870. var extendStatics = function (d, b) {
  39871. extendStatics = Object.setPrototypeOf ||
  39872. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39873. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39874. return extendStatics(d, b);
  39875. };
  39876. return function (d, b) {
  39877. extendStatics(d, b);
  39878. function __() { this.constructor = d; }
  39879. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39880. };
  39881. })();
  39882. function timers_clearTimeout(timer) {
  39883. window.clearTimeout(timer);
  39884. }
  39885. function timers_clearInterval(timer) {
  39886. window.clearInterval(timer);
  39887. }
  39888. var OneOffTimer = (function (_super) {
  39889. __extends(OneOffTimer, _super);
  39890. function OneOffTimer(delay, callback) {
  39891. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39892. callback();
  39893. return null;
  39894. }) || this;
  39895. }
  39896. return OneOffTimer;
  39897. }(abstract_timer));
  39898. var PeriodicTimer = (function (_super) {
  39899. __extends(PeriodicTimer, _super);
  39900. function PeriodicTimer(delay, callback) {
  39901. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39902. callback();
  39903. return timer;
  39904. }) || this;
  39905. }
  39906. return PeriodicTimer;
  39907. }(abstract_timer));
  39908. // CONCATENATED MODULE: ./src/core/util.ts
  39909. var Util = {
  39910. now: function () {
  39911. if (Date.now) {
  39912. return Date.now();
  39913. }
  39914. else {
  39915. return new Date().valueOf();
  39916. }
  39917. },
  39918. defer: function (callback) {
  39919. return new OneOffTimer(0, callback);
  39920. },
  39921. method: function (name) {
  39922. var args = [];
  39923. for (var _i = 1; _i < arguments.length; _i++) {
  39924. args[_i - 1] = arguments[_i];
  39925. }
  39926. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39927. return function (object) {
  39928. return object[name].apply(object, boundArguments.concat(arguments));
  39929. };
  39930. }
  39931. };
  39932. /* harmony default export */ var util = (Util);
  39933. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39934. function extend(target) {
  39935. var sources = [];
  39936. for (var _i = 1; _i < arguments.length; _i++) {
  39937. sources[_i - 1] = arguments[_i];
  39938. }
  39939. for (var i = 0; i < sources.length; i++) {
  39940. var extensions = sources[i];
  39941. for (var property in extensions) {
  39942. if (extensions[property] && extensions[property].constructor &&
  39943. extensions[property].constructor === Object) {
  39944. target[property] = extend(target[property] || {}, extensions[property]);
  39945. }
  39946. else {
  39947. target[property] = extensions[property];
  39948. }
  39949. }
  39950. }
  39951. return target;
  39952. }
  39953. function stringify() {
  39954. var m = ["Pusher"];
  39955. for (var i = 0; i < arguments.length; i++) {
  39956. if (typeof arguments[i] === "string") {
  39957. m.push(arguments[i]);
  39958. }
  39959. else {
  39960. m.push(safeJSONStringify(arguments[i]));
  39961. }
  39962. }
  39963. return m.join(" : ");
  39964. }
  39965. function arrayIndexOf(array, item) {
  39966. var nativeIndexOf = Array.prototype.indexOf;
  39967. if (array === null) {
  39968. return -1;
  39969. }
  39970. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39971. return array.indexOf(item);
  39972. }
  39973. for (var i = 0, l = array.length; i < l; i++) {
  39974. if (array[i] === item) {
  39975. return i;
  39976. }
  39977. }
  39978. return -1;
  39979. }
  39980. function objectApply(object, f) {
  39981. for (var key in object) {
  39982. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39983. f(object[key], key, object);
  39984. }
  39985. }
  39986. }
  39987. function keys(object) {
  39988. var keys = [];
  39989. objectApply(object, function (_, key) {
  39990. keys.push(key);
  39991. });
  39992. return keys;
  39993. }
  39994. function values(object) {
  39995. var values = [];
  39996. objectApply(object, function (value) {
  39997. values.push(value);
  39998. });
  39999. return values;
  40000. }
  40001. function apply(array, f, context) {
  40002. for (var i = 0; i < array.length; i++) {
  40003. f.call(context || window, array[i], i, array);
  40004. }
  40005. }
  40006. function map(array, f) {
  40007. var result = [];
  40008. for (var i = 0; i < array.length; i++) {
  40009. result.push(f(array[i], i, array, result));
  40010. }
  40011. return result;
  40012. }
  40013. function mapObject(object, f) {
  40014. var result = {};
  40015. objectApply(object, function (value, key) {
  40016. result[key] = f(value);
  40017. });
  40018. return result;
  40019. }
  40020. function filter(array, test) {
  40021. test = test || function (value) { return !!value; };
  40022. var result = [];
  40023. for (var i = 0; i < array.length; i++) {
  40024. if (test(array[i], i, array, result)) {
  40025. result.push(array[i]);
  40026. }
  40027. }
  40028. return result;
  40029. }
  40030. function filterObject(object, test) {
  40031. var result = {};
  40032. objectApply(object, function (value, key) {
  40033. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40034. result[key] = value;
  40035. }
  40036. });
  40037. return result;
  40038. }
  40039. function flatten(object) {
  40040. var result = [];
  40041. objectApply(object, function (value, key) {
  40042. result.push([key, value]);
  40043. });
  40044. return result;
  40045. }
  40046. function any(array, test) {
  40047. for (var i = 0; i < array.length; i++) {
  40048. if (test(array[i], i, array)) {
  40049. return true;
  40050. }
  40051. }
  40052. return false;
  40053. }
  40054. function collections_all(array, test) {
  40055. for (var i = 0; i < array.length; i++) {
  40056. if (!test(array[i], i, array)) {
  40057. return false;
  40058. }
  40059. }
  40060. return true;
  40061. }
  40062. function encodeParamsObject(data) {
  40063. return mapObject(data, function (value) {
  40064. if (typeof value === "object") {
  40065. value = safeJSONStringify(value);
  40066. }
  40067. return encodeURIComponent(encode(value.toString()));
  40068. });
  40069. }
  40070. function buildQueryString(data) {
  40071. var params = filterObject(data, function (value) {
  40072. return value !== undefined;
  40073. });
  40074. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40075. return query;
  40076. }
  40077. function decycleObject(object) {
  40078. var objects = [], paths = [];
  40079. return (function derez(value, path) {
  40080. var i, name, nu;
  40081. switch (typeof value) {
  40082. case 'object':
  40083. if (!value) {
  40084. return null;
  40085. }
  40086. for (i = 0; i < objects.length; i += 1) {
  40087. if (objects[i] === value) {
  40088. return { $ref: paths[i] };
  40089. }
  40090. }
  40091. objects.push(value);
  40092. paths.push(path);
  40093. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40094. nu = [];
  40095. for (i = 0; i < value.length; i += 1) {
  40096. nu[i] = derez(value[i], path + '[' + i + ']');
  40097. }
  40098. }
  40099. else {
  40100. nu = {};
  40101. for (name in value) {
  40102. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40103. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40104. }
  40105. }
  40106. }
  40107. return nu;
  40108. case 'number':
  40109. case 'string':
  40110. case 'boolean':
  40111. return value;
  40112. }
  40113. }(object, '$'));
  40114. }
  40115. function safeJSONStringify(source) {
  40116. try {
  40117. return JSON.stringify(source);
  40118. }
  40119. catch (e) {
  40120. return JSON.stringify(decycleObject(source));
  40121. }
  40122. }
  40123. // CONCATENATED MODULE: ./src/core/logger.ts
  40124. var logger_Logger = (function () {
  40125. function Logger() {
  40126. this.globalLog = function (message) {
  40127. if (window.console && window.console.log) {
  40128. window.console.log(message);
  40129. }
  40130. };
  40131. }
  40132. Logger.prototype.debug = function () {
  40133. var args = [];
  40134. for (var _i = 0; _i < arguments.length; _i++) {
  40135. args[_i] = arguments[_i];
  40136. }
  40137. this.log(this.globalLog, args);
  40138. };
  40139. Logger.prototype.warn = function () {
  40140. var args = [];
  40141. for (var _i = 0; _i < arguments.length; _i++) {
  40142. args[_i] = arguments[_i];
  40143. }
  40144. this.log(this.globalLogWarn, args);
  40145. };
  40146. Logger.prototype.error = function () {
  40147. var args = [];
  40148. for (var _i = 0; _i < arguments.length; _i++) {
  40149. args[_i] = arguments[_i];
  40150. }
  40151. this.log(this.globalLogError, args);
  40152. };
  40153. Logger.prototype.globalLogWarn = function (message) {
  40154. if (window.console && window.console.warn) {
  40155. window.console.warn(message);
  40156. }
  40157. else {
  40158. this.globalLog(message);
  40159. }
  40160. };
  40161. Logger.prototype.globalLogError = function (message) {
  40162. if (window.console && window.console.error) {
  40163. window.console.error(message);
  40164. }
  40165. else {
  40166. this.globalLogWarn(message);
  40167. }
  40168. };
  40169. Logger.prototype.log = function (defaultLoggingFunction) {
  40170. var args = [];
  40171. for (var _i = 1; _i < arguments.length; _i++) {
  40172. args[_i - 1] = arguments[_i];
  40173. }
  40174. var message = stringify.apply(this, arguments);
  40175. if (core_pusher.log) {
  40176. core_pusher.log(message);
  40177. }
  40178. else if (core_pusher.logToConsole) {
  40179. var log = defaultLoggingFunction.bind(this);
  40180. log(message);
  40181. }
  40182. };
  40183. return Logger;
  40184. }());
  40185. /* harmony default export */ var logger = (new logger_Logger());
  40186. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40187. var urlStore = {
  40188. baseUrl: "https://pusher.com",
  40189. urls: {
  40190. authenticationEndpoint: {
  40191. path: "/docs/authenticating_users",
  40192. },
  40193. javascriptQuickStart: {
  40194. path: "/docs/javascript_quick_start"
  40195. },
  40196. triggeringClientEvents: {
  40197. path: "/docs/client_api_guide/client_events#trigger-events"
  40198. }
  40199. }
  40200. };
  40201. var buildLogSuffix = function (key) {
  40202. var urlPrefix = "See:";
  40203. var urlObj = urlStore.urls[key];
  40204. if (!urlObj)
  40205. return "";
  40206. var url;
  40207. if (urlObj.fullUrl) {
  40208. url = urlObj.fullUrl;
  40209. }
  40210. else if (urlObj.path) {
  40211. url = urlStore.baseUrl + urlObj.path;
  40212. }
  40213. if (!url)
  40214. return "";
  40215. return urlPrefix + " " + url;
  40216. };
  40217. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40218. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40219. var ajax = function (context, socketId, callback) {
  40220. var self = this, xhr;
  40221. xhr = runtime.createXHR();
  40222. xhr.open("POST", self.options.authEndpoint, true);
  40223. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40224. for (var headerName in this.authOptions.headers) {
  40225. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40226. }
  40227. xhr.onreadystatechange = function () {
  40228. if (xhr.readyState === 4) {
  40229. if (xhr.status === 200) {
  40230. var data, parsed = false;
  40231. try {
  40232. data = JSON.parse(xhr.responseText);
  40233. parsed = true;
  40234. }
  40235. catch (e) {
  40236. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40237. }
  40238. if (parsed) {
  40239. callback(false, data);
  40240. }
  40241. }
  40242. else {
  40243. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40244. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40245. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40246. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40247. callback(true, xhr.status);
  40248. }
  40249. }
  40250. };
  40251. xhr.send(this.composeQuery(socketId));
  40252. return xhr;
  40253. };
  40254. /* harmony default export */ var xhr_auth = (ajax);
  40255. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40256. var jsonp = function (context, socketId, callback) {
  40257. if (this.authOptions.headers !== undefined) {
  40258. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40259. }
  40260. var callbackName = context.nextAuthCallbackID.toString();
  40261. context.nextAuthCallbackID++;
  40262. var document = context.getDocument();
  40263. var script = document.createElement("script");
  40264. context.auth_callbacks[callbackName] = function (data) {
  40265. callback(false, data);
  40266. };
  40267. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40268. script.src = this.options.authEndpoint +
  40269. '?callback=' +
  40270. encodeURIComponent(callback_name) +
  40271. '&' +
  40272. this.composeQuery(socketId);
  40273. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40274. head.insertBefore(script, head.firstChild);
  40275. };
  40276. /* harmony default export */ var jsonp_auth = (jsonp);
  40277. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40278. var ScriptRequest = (function () {
  40279. function ScriptRequest(src) {
  40280. this.src = src;
  40281. }
  40282. ScriptRequest.prototype.send = function (receiver) {
  40283. var self = this;
  40284. var errorString = "Error loading " + self.src;
  40285. self.script = document.createElement("script");
  40286. self.script.id = receiver.id;
  40287. self.script.src = self.src;
  40288. self.script.type = "text/javascript";
  40289. self.script.charset = "UTF-8";
  40290. if (self.script.addEventListener) {
  40291. self.script.onerror = function () {
  40292. receiver.callback(errorString);
  40293. };
  40294. self.script.onload = function () {
  40295. receiver.callback(null);
  40296. };
  40297. }
  40298. else {
  40299. self.script.onreadystatechange = function () {
  40300. if (self.script.readyState === 'loaded' ||
  40301. self.script.readyState === 'complete') {
  40302. receiver.callback(null);
  40303. }
  40304. };
  40305. }
  40306. if (self.script.async === undefined && document.attachEvent &&
  40307. /opera/i.test(navigator.userAgent)) {
  40308. self.errorScript = document.createElement("script");
  40309. self.errorScript.id = receiver.id + "_error";
  40310. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40311. self.script.async = self.errorScript.async = false;
  40312. }
  40313. else {
  40314. self.script.async = true;
  40315. }
  40316. var head = document.getElementsByTagName('head')[0];
  40317. head.insertBefore(self.script, head.firstChild);
  40318. if (self.errorScript) {
  40319. head.insertBefore(self.errorScript, self.script.nextSibling);
  40320. }
  40321. };
  40322. ScriptRequest.prototype.cleanup = function () {
  40323. if (this.script) {
  40324. this.script.onload = this.script.onerror = null;
  40325. this.script.onreadystatechange = null;
  40326. }
  40327. if (this.script && this.script.parentNode) {
  40328. this.script.parentNode.removeChild(this.script);
  40329. }
  40330. if (this.errorScript && this.errorScript.parentNode) {
  40331. this.errorScript.parentNode.removeChild(this.errorScript);
  40332. }
  40333. this.script = null;
  40334. this.errorScript = null;
  40335. };
  40336. return ScriptRequest;
  40337. }());
  40338. /* harmony default export */ var script_request = (ScriptRequest);
  40339. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40340. var jsonp_request_JSONPRequest = (function () {
  40341. function JSONPRequest(url, data) {
  40342. this.url = url;
  40343. this.data = data;
  40344. }
  40345. JSONPRequest.prototype.send = function (receiver) {
  40346. if (this.request) {
  40347. return;
  40348. }
  40349. var query = buildQueryString(this.data);
  40350. var url = this.url + "/" + receiver.number + "?" + query;
  40351. this.request = runtime.createScriptRequest(url);
  40352. this.request.send(receiver);
  40353. };
  40354. JSONPRequest.prototype.cleanup = function () {
  40355. if (this.request) {
  40356. this.request.cleanup();
  40357. }
  40358. };
  40359. return JSONPRequest;
  40360. }());
  40361. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40362. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40363. var getAgent = function (sender, useTLS) {
  40364. return function (data, callback) {
  40365. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40366. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40367. var request = runtime.createJSONPRequest(url, data);
  40368. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40369. ScriptReceivers.remove(receiver);
  40370. request.cleanup();
  40371. if (result && result.host) {
  40372. sender.host = result.host;
  40373. }
  40374. if (callback) {
  40375. callback(error, result);
  40376. }
  40377. });
  40378. request.send(receiver);
  40379. };
  40380. };
  40381. var jsonp_timeline_jsonp = {
  40382. name: 'jsonp',
  40383. getAgent: getAgent
  40384. };
  40385. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40386. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40387. function getGenericURL(baseScheme, params, path) {
  40388. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40389. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40390. return scheme + "://" + host + path;
  40391. }
  40392. function getGenericPath(key, queryString) {
  40393. var path = "/app/" + key;
  40394. var query = "?protocol=" + defaults.PROTOCOL +
  40395. "&client=js" +
  40396. "&version=" + defaults.VERSION +
  40397. (queryString ? ("&" + queryString) : "");
  40398. return path + query;
  40399. }
  40400. var ws = {
  40401. getInitial: function (key, params) {
  40402. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40403. return getGenericURL("ws", params, path);
  40404. }
  40405. };
  40406. var http = {
  40407. getInitial: function (key, params) {
  40408. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40409. return getGenericURL("http", params, path);
  40410. }
  40411. };
  40412. var sockjs = {
  40413. getInitial: function (key, params) {
  40414. return getGenericURL("http", params, params.httpPath || "/pusher");
  40415. },
  40416. getPath: function (key, params) {
  40417. return getGenericPath(key);
  40418. }
  40419. };
  40420. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40421. var callback_registry_CallbackRegistry = (function () {
  40422. function CallbackRegistry() {
  40423. this._callbacks = {};
  40424. }
  40425. CallbackRegistry.prototype.get = function (name) {
  40426. return this._callbacks[prefix(name)];
  40427. };
  40428. CallbackRegistry.prototype.add = function (name, callback, context) {
  40429. var prefixedEventName = prefix(name);
  40430. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40431. this._callbacks[prefixedEventName].push({
  40432. fn: callback,
  40433. context: context
  40434. });
  40435. };
  40436. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40437. if (!name && !callback && !context) {
  40438. this._callbacks = {};
  40439. return;
  40440. }
  40441. var names = name ? [prefix(name)] : keys(this._callbacks);
  40442. if (callback || context) {
  40443. this.removeCallback(names, callback, context);
  40444. }
  40445. else {
  40446. this.removeAllCallbacks(names);
  40447. }
  40448. };
  40449. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40450. apply(names, function (name) {
  40451. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40452. return (callback && callback !== binding.fn) ||
  40453. (context && context !== binding.context);
  40454. });
  40455. if (this._callbacks[name].length === 0) {
  40456. delete this._callbacks[name];
  40457. }
  40458. }, this);
  40459. };
  40460. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40461. apply(names, function (name) {
  40462. delete this._callbacks[name];
  40463. }, this);
  40464. };
  40465. return CallbackRegistry;
  40466. }());
  40467. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40468. function prefix(name) {
  40469. return "_" + name;
  40470. }
  40471. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40472. var dispatcher_Dispatcher = (function () {
  40473. function Dispatcher(failThrough) {
  40474. this.callbacks = new callback_registry();
  40475. this.global_callbacks = [];
  40476. this.failThrough = failThrough;
  40477. }
  40478. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40479. this.callbacks.add(eventName, callback, context);
  40480. return this;
  40481. };
  40482. Dispatcher.prototype.bind_global = function (callback) {
  40483. this.global_callbacks.push(callback);
  40484. return this;
  40485. };
  40486. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40487. this.callbacks.remove(eventName, callback, context);
  40488. return this;
  40489. };
  40490. Dispatcher.prototype.unbind_global = function (callback) {
  40491. if (!callback) {
  40492. this.global_callbacks = [];
  40493. return this;
  40494. }
  40495. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40496. return this;
  40497. };
  40498. Dispatcher.prototype.unbind_all = function () {
  40499. this.unbind();
  40500. this.unbind_global();
  40501. return this;
  40502. };
  40503. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40504. for (var i = 0; i < this.global_callbacks.length; i++) {
  40505. this.global_callbacks[i](eventName, data);
  40506. }
  40507. var callbacks = this.callbacks.get(eventName);
  40508. var args = [];
  40509. if (metadata) {
  40510. args.push(data, metadata);
  40511. }
  40512. else if (data) {
  40513. args.push(data);
  40514. }
  40515. if (callbacks && callbacks.length > 0) {
  40516. for (var i = 0; i < callbacks.length; i++) {
  40517. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40518. }
  40519. }
  40520. else if (this.failThrough) {
  40521. this.failThrough(eventName, data);
  40522. }
  40523. return this;
  40524. };
  40525. return Dispatcher;
  40526. }());
  40527. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40528. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40529. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40530. var extendStatics = function (d, b) {
  40531. extendStatics = Object.setPrototypeOf ||
  40532. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40533. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40534. return extendStatics(d, b);
  40535. };
  40536. return function (d, b) {
  40537. extendStatics(d, b);
  40538. function __() { this.constructor = d; }
  40539. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40540. };
  40541. })();
  40542. var transport_connection_TransportConnection = (function (_super) {
  40543. transport_connection_extends(TransportConnection, _super);
  40544. function TransportConnection(hooks, name, priority, key, options) {
  40545. var _this = _super.call(this) || this;
  40546. _this.initialize = runtime.transportConnectionInitializer;
  40547. _this.hooks = hooks;
  40548. _this.name = name;
  40549. _this.priority = priority;
  40550. _this.key = key;
  40551. _this.options = options;
  40552. _this.state = "new";
  40553. _this.timeline = options.timeline;
  40554. _this.activityTimeout = options.activityTimeout;
  40555. _this.id = _this.timeline.generateUniqueID();
  40556. return _this;
  40557. }
  40558. TransportConnection.prototype.handlesActivityChecks = function () {
  40559. return Boolean(this.hooks.handlesActivityChecks);
  40560. };
  40561. TransportConnection.prototype.supportsPing = function () {
  40562. return Boolean(this.hooks.supportsPing);
  40563. };
  40564. TransportConnection.prototype.connect = function () {
  40565. var _this = this;
  40566. if (this.socket || this.state !== "initialized") {
  40567. return false;
  40568. }
  40569. var url = this.hooks.urls.getInitial(this.key, this.options);
  40570. try {
  40571. this.socket = this.hooks.getSocket(url, this.options);
  40572. }
  40573. catch (e) {
  40574. util.defer(function () {
  40575. _this.onError(e);
  40576. _this.changeState("closed");
  40577. });
  40578. return false;
  40579. }
  40580. this.bindListeners();
  40581. logger.debug("Connecting", { transport: this.name, url: url });
  40582. this.changeState("connecting");
  40583. return true;
  40584. };
  40585. TransportConnection.prototype.close = function () {
  40586. if (this.socket) {
  40587. this.socket.close();
  40588. return true;
  40589. }
  40590. else {
  40591. return false;
  40592. }
  40593. };
  40594. TransportConnection.prototype.send = function (data) {
  40595. var _this = this;
  40596. if (this.state === "open") {
  40597. util.defer(function () {
  40598. if (_this.socket) {
  40599. _this.socket.send(data);
  40600. }
  40601. });
  40602. return true;
  40603. }
  40604. else {
  40605. return false;
  40606. }
  40607. };
  40608. TransportConnection.prototype.ping = function () {
  40609. if (this.state === "open" && this.supportsPing()) {
  40610. this.socket.ping();
  40611. }
  40612. };
  40613. TransportConnection.prototype.onOpen = function () {
  40614. if (this.hooks.beforeOpen) {
  40615. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40616. }
  40617. this.changeState("open");
  40618. this.socket.onopen = undefined;
  40619. };
  40620. TransportConnection.prototype.onError = function (error) {
  40621. this.emit("error", { type: 'WebSocketError', error: error });
  40622. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40623. };
  40624. TransportConnection.prototype.onClose = function (closeEvent) {
  40625. if (closeEvent) {
  40626. this.changeState("closed", {
  40627. code: closeEvent.code,
  40628. reason: closeEvent.reason,
  40629. wasClean: closeEvent.wasClean
  40630. });
  40631. }
  40632. else {
  40633. this.changeState("closed");
  40634. }
  40635. this.unbindListeners();
  40636. this.socket = undefined;
  40637. };
  40638. TransportConnection.prototype.onMessage = function (message) {
  40639. this.emit("message", message);
  40640. };
  40641. TransportConnection.prototype.onActivity = function () {
  40642. this.emit("activity");
  40643. };
  40644. TransportConnection.prototype.bindListeners = function () {
  40645. var _this = this;
  40646. this.socket.onopen = function () {
  40647. _this.onOpen();
  40648. };
  40649. this.socket.onerror = function (error) {
  40650. _this.onError(error);
  40651. };
  40652. this.socket.onclose = function (closeEvent) {
  40653. _this.onClose(closeEvent);
  40654. };
  40655. this.socket.onmessage = function (message) {
  40656. _this.onMessage(message);
  40657. };
  40658. if (this.supportsPing()) {
  40659. this.socket.onactivity = function () { _this.onActivity(); };
  40660. }
  40661. };
  40662. TransportConnection.prototype.unbindListeners = function () {
  40663. if (this.socket) {
  40664. this.socket.onopen = undefined;
  40665. this.socket.onerror = undefined;
  40666. this.socket.onclose = undefined;
  40667. this.socket.onmessage = undefined;
  40668. if (this.supportsPing()) {
  40669. this.socket.onactivity = undefined;
  40670. }
  40671. }
  40672. };
  40673. TransportConnection.prototype.changeState = function (state, params) {
  40674. this.state = state;
  40675. this.timeline.info(this.buildTimelineMessage({
  40676. state: state,
  40677. params: params
  40678. }));
  40679. this.emit(state, params);
  40680. };
  40681. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40682. return extend({ cid: this.id }, message);
  40683. };
  40684. return TransportConnection;
  40685. }(dispatcher));
  40686. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40687. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40688. var transport_Transport = (function () {
  40689. function Transport(hooks) {
  40690. this.hooks = hooks;
  40691. }
  40692. Transport.prototype.isSupported = function (environment) {
  40693. return this.hooks.isSupported(environment);
  40694. };
  40695. Transport.prototype.createConnection = function (name, priority, key, options) {
  40696. return new transport_connection(this.hooks, name, priority, key, options);
  40697. };
  40698. return Transport;
  40699. }());
  40700. /* harmony default export */ var transports_transport = (transport_Transport);
  40701. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40702. var WSTransport = new transports_transport({
  40703. urls: ws,
  40704. handlesActivityChecks: false,
  40705. supportsPing: false,
  40706. isInitialized: function () {
  40707. return Boolean(runtime.getWebSocketAPI());
  40708. },
  40709. isSupported: function () {
  40710. return Boolean(runtime.getWebSocketAPI());
  40711. },
  40712. getSocket: function (url) {
  40713. return runtime.createWebSocket(url);
  40714. }
  40715. });
  40716. var httpConfiguration = {
  40717. urls: http,
  40718. handlesActivityChecks: false,
  40719. supportsPing: true,
  40720. isInitialized: function () {
  40721. return true;
  40722. }
  40723. };
  40724. var streamingConfiguration = extend({ getSocket: function (url) {
  40725. return runtime.HTTPFactory.createStreamingSocket(url);
  40726. }
  40727. }, httpConfiguration);
  40728. var pollingConfiguration = extend({ getSocket: function (url) {
  40729. return runtime.HTTPFactory.createPollingSocket(url);
  40730. }
  40731. }, httpConfiguration);
  40732. var xhrConfiguration = {
  40733. isSupported: function () {
  40734. return runtime.isXHRSupported();
  40735. }
  40736. };
  40737. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40738. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40739. var Transports = {
  40740. ws: WSTransport,
  40741. xhr_streaming: XHRStreamingTransport,
  40742. xhr_polling: XHRPollingTransport
  40743. };
  40744. /* harmony default export */ var transports = (Transports);
  40745. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40746. var SockJSTransport = new transports_transport({
  40747. file: "sockjs",
  40748. urls: sockjs,
  40749. handlesActivityChecks: true,
  40750. supportsPing: false,
  40751. isSupported: function () {
  40752. return true;
  40753. },
  40754. isInitialized: function () {
  40755. return window.SockJS !== undefined;
  40756. },
  40757. getSocket: function (url, options) {
  40758. return new window.SockJS(url, null, {
  40759. js_path: Dependencies.getPath("sockjs", {
  40760. useTLS: options.useTLS
  40761. }),
  40762. ignore_null_origin: options.ignoreNullOrigin
  40763. });
  40764. },
  40765. beforeOpen: function (socket, path) {
  40766. socket.send(JSON.stringify({
  40767. path: path
  40768. }));
  40769. }
  40770. });
  40771. var xdrConfiguration = {
  40772. isSupported: function (environment) {
  40773. var yes = runtime.isXDRSupported(environment.useTLS);
  40774. return yes;
  40775. }
  40776. };
  40777. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40778. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40779. transports.xdr_streaming = XDRStreamingTransport;
  40780. transports.xdr_polling = XDRPollingTransport;
  40781. transports.sockjs = SockJSTransport;
  40782. /* harmony default export */ var transports_transports = (transports);
  40783. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40784. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40785. var extendStatics = function (d, b) {
  40786. extendStatics = Object.setPrototypeOf ||
  40787. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40788. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40789. return extendStatics(d, b);
  40790. };
  40791. return function (d, b) {
  40792. extendStatics(d, b);
  40793. function __() { this.constructor = d; }
  40794. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40795. };
  40796. })();
  40797. var NetInfo = (function (_super) {
  40798. net_info_extends(NetInfo, _super);
  40799. function NetInfo() {
  40800. var _this = _super.call(this) || this;
  40801. var self = _this;
  40802. if (window.addEventListener !== undefined) {
  40803. window.addEventListener("online", function () {
  40804. self.emit('online');
  40805. }, false);
  40806. window.addEventListener("offline", function () {
  40807. self.emit('offline');
  40808. }, false);
  40809. }
  40810. return _this;
  40811. }
  40812. NetInfo.prototype.isOnline = function () {
  40813. if (window.navigator.onLine === undefined) {
  40814. return true;
  40815. }
  40816. else {
  40817. return window.navigator.onLine;
  40818. }
  40819. };
  40820. return NetInfo;
  40821. }(dispatcher));
  40822. var net_info_Network = new NetInfo();
  40823. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40824. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40825. function AssistantToTheTransportManager(manager, transport, options) {
  40826. this.manager = manager;
  40827. this.transport = transport;
  40828. this.minPingDelay = options.minPingDelay;
  40829. this.maxPingDelay = options.maxPingDelay;
  40830. this.pingDelay = undefined;
  40831. }
  40832. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40833. var _this = this;
  40834. options = extend({}, options, {
  40835. activityTimeout: this.pingDelay
  40836. });
  40837. var connection = this.transport.createConnection(name, priority, key, options);
  40838. var openTimestamp = null;
  40839. var onOpen = function () {
  40840. connection.unbind("open", onOpen);
  40841. connection.bind("closed", onClosed);
  40842. openTimestamp = util.now();
  40843. };
  40844. var onClosed = function (closeEvent) {
  40845. connection.unbind("closed", onClosed);
  40846. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40847. _this.manager.reportDeath();
  40848. }
  40849. else if (!closeEvent.wasClean && openTimestamp) {
  40850. var lifespan = util.now() - openTimestamp;
  40851. if (lifespan < 2 * _this.maxPingDelay) {
  40852. _this.manager.reportDeath();
  40853. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40854. }
  40855. }
  40856. };
  40857. connection.bind("open", onOpen);
  40858. return connection;
  40859. };
  40860. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40861. return this.manager.isAlive() && this.transport.isSupported(environment);
  40862. };
  40863. return AssistantToTheTransportManager;
  40864. }());
  40865. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40866. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40867. var Protocol = {
  40868. decodeMessage: function (messageEvent) {
  40869. try {
  40870. var messageData = JSON.parse(messageEvent.data);
  40871. var pusherEventData = messageData.data;
  40872. if (typeof pusherEventData === 'string') {
  40873. try {
  40874. pusherEventData = JSON.parse(messageData.data);
  40875. }
  40876. catch (e) { }
  40877. }
  40878. var pusherEvent = {
  40879. event: messageData.event,
  40880. channel: messageData.channel,
  40881. data: pusherEventData,
  40882. };
  40883. if (messageData.user_id) {
  40884. pusherEvent.user_id = messageData.user_id;
  40885. }
  40886. return pusherEvent;
  40887. }
  40888. catch (e) {
  40889. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40890. }
  40891. },
  40892. encodeMessage: function (event) {
  40893. return JSON.stringify(event);
  40894. },
  40895. processHandshake: function (messageEvent) {
  40896. var message = Protocol.decodeMessage(messageEvent);
  40897. if (message.event === "pusher:connection_established") {
  40898. if (!message.data.activity_timeout) {
  40899. throw "No activity timeout specified in handshake";
  40900. }
  40901. return {
  40902. action: "connected",
  40903. id: message.data.socket_id,
  40904. activityTimeout: message.data.activity_timeout * 1000
  40905. };
  40906. }
  40907. else if (message.event === "pusher:error") {
  40908. return {
  40909. action: this.getCloseAction(message.data),
  40910. error: this.getCloseError(message.data)
  40911. };
  40912. }
  40913. else {
  40914. throw "Invalid handshake";
  40915. }
  40916. },
  40917. getCloseAction: function (closeEvent) {
  40918. if (closeEvent.code < 4000) {
  40919. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40920. return "backoff";
  40921. }
  40922. else {
  40923. return null;
  40924. }
  40925. }
  40926. else if (closeEvent.code === 4000) {
  40927. return "tls_only";
  40928. }
  40929. else if (closeEvent.code < 4100) {
  40930. return "refused";
  40931. }
  40932. else if (closeEvent.code < 4200) {
  40933. return "backoff";
  40934. }
  40935. else if (closeEvent.code < 4300) {
  40936. return "retry";
  40937. }
  40938. else {
  40939. return "refused";
  40940. }
  40941. },
  40942. getCloseError: function (closeEvent) {
  40943. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40944. return {
  40945. type: 'PusherError',
  40946. data: {
  40947. code: closeEvent.code,
  40948. message: closeEvent.reason || closeEvent.message
  40949. }
  40950. };
  40951. }
  40952. else {
  40953. return null;
  40954. }
  40955. }
  40956. };
  40957. /* harmony default export */ var protocol_protocol = (Protocol);
  40958. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40959. var connection_extends = (undefined && undefined.__extends) || (function () {
  40960. var extendStatics = function (d, b) {
  40961. extendStatics = Object.setPrototypeOf ||
  40962. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40963. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40964. return extendStatics(d, b);
  40965. };
  40966. return function (d, b) {
  40967. extendStatics(d, b);
  40968. function __() { this.constructor = d; }
  40969. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40970. };
  40971. })();
  40972. var connection_Connection = (function (_super) {
  40973. connection_extends(Connection, _super);
  40974. function Connection(id, transport) {
  40975. var _this = _super.call(this) || this;
  40976. _this.id = id;
  40977. _this.transport = transport;
  40978. _this.activityTimeout = transport.activityTimeout;
  40979. _this.bindListeners();
  40980. return _this;
  40981. }
  40982. Connection.prototype.handlesActivityChecks = function () {
  40983. return this.transport.handlesActivityChecks();
  40984. };
  40985. Connection.prototype.send = function (data) {
  40986. return this.transport.send(data);
  40987. };
  40988. Connection.prototype.send_event = function (name, data, channel) {
  40989. var event = { event: name, data: data };
  40990. if (channel) {
  40991. event.channel = channel;
  40992. }
  40993. logger.debug('Event sent', event);
  40994. return this.send(protocol_protocol.encodeMessage(event));
  40995. };
  40996. Connection.prototype.ping = function () {
  40997. if (this.transport.supportsPing()) {
  40998. this.transport.ping();
  40999. }
  41000. else {
  41001. this.send_event('pusher:ping', {});
  41002. }
  41003. };
  41004. Connection.prototype.close = function () {
  41005. this.transport.close();
  41006. };
  41007. Connection.prototype.bindListeners = function () {
  41008. var _this = this;
  41009. var listeners = {
  41010. message: function (messageEvent) {
  41011. var pusherEvent;
  41012. try {
  41013. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41014. }
  41015. catch (e) {
  41016. _this.emit('error', {
  41017. type: 'MessageParseError',
  41018. error: e,
  41019. data: messageEvent.data
  41020. });
  41021. }
  41022. if (pusherEvent !== undefined) {
  41023. logger.debug('Event recd', pusherEvent);
  41024. switch (pusherEvent.event) {
  41025. case 'pusher:error':
  41026. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41027. break;
  41028. case 'pusher:ping':
  41029. _this.emit("ping");
  41030. break;
  41031. case 'pusher:pong':
  41032. _this.emit("pong");
  41033. break;
  41034. }
  41035. _this.emit('message', pusherEvent);
  41036. }
  41037. },
  41038. activity: function () {
  41039. _this.emit("activity");
  41040. },
  41041. error: function (error) {
  41042. _this.emit("error", { type: "WebSocketError", error: error });
  41043. },
  41044. closed: function (closeEvent) {
  41045. unbindListeners();
  41046. if (closeEvent && closeEvent.code) {
  41047. _this.handleCloseEvent(closeEvent);
  41048. }
  41049. _this.transport = null;
  41050. _this.emit("closed");
  41051. }
  41052. };
  41053. var unbindListeners = function () {
  41054. objectApply(listeners, function (listener, event) {
  41055. _this.transport.unbind(event, listener);
  41056. });
  41057. };
  41058. objectApply(listeners, function (listener, event) {
  41059. _this.transport.bind(event, listener);
  41060. });
  41061. };
  41062. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41063. var action = protocol_protocol.getCloseAction(closeEvent);
  41064. var error = protocol_protocol.getCloseError(closeEvent);
  41065. if (error) {
  41066. this.emit('error', error);
  41067. }
  41068. if (action) {
  41069. this.emit(action, { action: action, error: error });
  41070. }
  41071. };
  41072. return Connection;
  41073. }(dispatcher));
  41074. /* harmony default export */ var connection_connection = (connection_Connection);
  41075. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41076. var handshake_Handshake = (function () {
  41077. function Handshake(transport, callback) {
  41078. this.transport = transport;
  41079. this.callback = callback;
  41080. this.bindListeners();
  41081. }
  41082. Handshake.prototype.close = function () {
  41083. this.unbindListeners();
  41084. this.transport.close();
  41085. };
  41086. Handshake.prototype.bindListeners = function () {
  41087. var _this = this;
  41088. this.onMessage = function (m) {
  41089. _this.unbindListeners();
  41090. var result;
  41091. try {
  41092. result = protocol_protocol.processHandshake(m);
  41093. }
  41094. catch (e) {
  41095. _this.finish("error", { error: e });
  41096. _this.transport.close();
  41097. return;
  41098. }
  41099. if (result.action === "connected") {
  41100. _this.finish("connected", {
  41101. connection: new connection_connection(result.id, _this.transport),
  41102. activityTimeout: result.activityTimeout
  41103. });
  41104. }
  41105. else {
  41106. _this.finish(result.action, { error: result.error });
  41107. _this.transport.close();
  41108. }
  41109. };
  41110. this.onClosed = function (closeEvent) {
  41111. _this.unbindListeners();
  41112. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41113. var error = protocol_protocol.getCloseError(closeEvent);
  41114. _this.finish(action, { error: error });
  41115. };
  41116. this.transport.bind("message", this.onMessage);
  41117. this.transport.bind("closed", this.onClosed);
  41118. };
  41119. Handshake.prototype.unbindListeners = function () {
  41120. this.transport.unbind("message", this.onMessage);
  41121. this.transport.unbind("closed", this.onClosed);
  41122. };
  41123. Handshake.prototype.finish = function (action, params) {
  41124. this.callback(extend({ transport: this.transport, action: action }, params));
  41125. };
  41126. return Handshake;
  41127. }());
  41128. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41129. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41130. var pusher_authorizer_PusherAuthorizer = (function () {
  41131. function PusherAuthorizer(channel, options) {
  41132. this.channel = channel;
  41133. var authTransport = options.authTransport;
  41134. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41135. throw "'" + authTransport + "' is not a recognized auth transport";
  41136. }
  41137. this.type = authTransport;
  41138. this.options = options;
  41139. this.authOptions = (options || {}).auth || {};
  41140. }
  41141. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41142. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41143. '&channel_name=' + encodeURIComponent(this.channel.name);
  41144. for (var i in this.authOptions.params) {
  41145. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41146. }
  41147. return query;
  41148. };
  41149. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41150. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41151. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41152. };
  41153. return PusherAuthorizer;
  41154. }());
  41155. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41156. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41157. var timeline_sender_TimelineSender = (function () {
  41158. function TimelineSender(timeline, options) {
  41159. this.timeline = timeline;
  41160. this.options = options || {};
  41161. }
  41162. TimelineSender.prototype.send = function (useTLS, callback) {
  41163. if (this.timeline.isEmpty()) {
  41164. return;
  41165. }
  41166. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41167. };
  41168. return TimelineSender;
  41169. }());
  41170. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41171. // CONCATENATED MODULE: ./src/core/errors.ts
  41172. var errors_extends = (undefined && undefined.__extends) || (function () {
  41173. var extendStatics = function (d, b) {
  41174. extendStatics = Object.setPrototypeOf ||
  41175. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41176. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41177. return extendStatics(d, b);
  41178. };
  41179. return function (d, b) {
  41180. extendStatics(d, b);
  41181. function __() { this.constructor = d; }
  41182. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41183. };
  41184. })();
  41185. var BadEventName = (function (_super) {
  41186. errors_extends(BadEventName, _super);
  41187. function BadEventName(msg) {
  41188. var _newTarget = this.constructor;
  41189. var _this = _super.call(this, msg) || this;
  41190. Object.setPrototypeOf(_this, _newTarget.prototype);
  41191. return _this;
  41192. }
  41193. return BadEventName;
  41194. }(Error));
  41195. var RequestTimedOut = (function (_super) {
  41196. errors_extends(RequestTimedOut, _super);
  41197. function RequestTimedOut(msg) {
  41198. var _newTarget = this.constructor;
  41199. var _this = _super.call(this, msg) || this;
  41200. Object.setPrototypeOf(_this, _newTarget.prototype);
  41201. return _this;
  41202. }
  41203. return RequestTimedOut;
  41204. }(Error));
  41205. var TransportPriorityTooLow = (function (_super) {
  41206. errors_extends(TransportPriorityTooLow, _super);
  41207. function TransportPriorityTooLow(msg) {
  41208. var _newTarget = this.constructor;
  41209. var _this = _super.call(this, msg) || this;
  41210. Object.setPrototypeOf(_this, _newTarget.prototype);
  41211. return _this;
  41212. }
  41213. return TransportPriorityTooLow;
  41214. }(Error));
  41215. var TransportClosed = (function (_super) {
  41216. errors_extends(TransportClosed, _super);
  41217. function TransportClosed(msg) {
  41218. var _newTarget = this.constructor;
  41219. var _this = _super.call(this, msg) || this;
  41220. Object.setPrototypeOf(_this, _newTarget.prototype);
  41221. return _this;
  41222. }
  41223. return TransportClosed;
  41224. }(Error));
  41225. var UnsupportedFeature = (function (_super) {
  41226. errors_extends(UnsupportedFeature, _super);
  41227. function UnsupportedFeature(msg) {
  41228. var _newTarget = this.constructor;
  41229. var _this = _super.call(this, msg) || this;
  41230. Object.setPrototypeOf(_this, _newTarget.prototype);
  41231. return _this;
  41232. }
  41233. return UnsupportedFeature;
  41234. }(Error));
  41235. var UnsupportedTransport = (function (_super) {
  41236. errors_extends(UnsupportedTransport, _super);
  41237. function UnsupportedTransport(msg) {
  41238. var _newTarget = this.constructor;
  41239. var _this = _super.call(this, msg) || this;
  41240. Object.setPrototypeOf(_this, _newTarget.prototype);
  41241. return _this;
  41242. }
  41243. return UnsupportedTransport;
  41244. }(Error));
  41245. var UnsupportedStrategy = (function (_super) {
  41246. errors_extends(UnsupportedStrategy, _super);
  41247. function UnsupportedStrategy(msg) {
  41248. var _newTarget = this.constructor;
  41249. var _this = _super.call(this, msg) || this;
  41250. Object.setPrototypeOf(_this, _newTarget.prototype);
  41251. return _this;
  41252. }
  41253. return UnsupportedStrategy;
  41254. }(Error));
  41255. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41256. var channel_extends = (undefined && undefined.__extends) || (function () {
  41257. var extendStatics = function (d, b) {
  41258. extendStatics = Object.setPrototypeOf ||
  41259. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41260. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41261. return extendStatics(d, b);
  41262. };
  41263. return function (d, b) {
  41264. extendStatics(d, b);
  41265. function __() { this.constructor = d; }
  41266. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41267. };
  41268. })();
  41269. var channel_Channel = (function (_super) {
  41270. channel_extends(Channel, _super);
  41271. function Channel(name, pusher) {
  41272. var _this = _super.call(this, function (event, data) {
  41273. logger.debug('No callbacks on ' + name + ' for ' + event);
  41274. }) || this;
  41275. _this.name = name;
  41276. _this.pusher = pusher;
  41277. _this.subscribed = false;
  41278. _this.subscriptionPending = false;
  41279. _this.subscriptionCancelled = false;
  41280. return _this;
  41281. }
  41282. Channel.prototype.authorize = function (socketId, callback) {
  41283. return callback(false, {});
  41284. };
  41285. Channel.prototype.trigger = function (event, data) {
  41286. if (event.indexOf("client-") !== 0) {
  41287. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41288. }
  41289. if (!this.subscribed) {
  41290. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41291. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41292. }
  41293. return this.pusher.send_event(event, data, this.name);
  41294. };
  41295. Channel.prototype.disconnect = function () {
  41296. this.subscribed = false;
  41297. this.subscriptionPending = false;
  41298. };
  41299. Channel.prototype.handleEvent = function (event) {
  41300. var eventName = event.event;
  41301. var data = event.data;
  41302. if (eventName === "pusher_internal:subscription_succeeded") {
  41303. this.handleSubscriptionSucceededEvent(event);
  41304. }
  41305. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41306. var metadata = {};
  41307. this.emit(eventName, data, metadata);
  41308. }
  41309. };
  41310. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41311. this.subscriptionPending = false;
  41312. this.subscribed = true;
  41313. if (this.subscriptionCancelled) {
  41314. this.pusher.unsubscribe(this.name);
  41315. }
  41316. else {
  41317. this.emit("pusher:subscription_succeeded", event.data);
  41318. }
  41319. };
  41320. Channel.prototype.subscribe = function () {
  41321. var _this = this;
  41322. if (this.subscribed) {
  41323. return;
  41324. }
  41325. this.subscriptionPending = true;
  41326. this.subscriptionCancelled = false;
  41327. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41328. if (error) {
  41329. logger.error(data);
  41330. _this.emit('pusher:subscription_error', data);
  41331. }
  41332. else {
  41333. _this.pusher.send_event('pusher:subscribe', {
  41334. auth: data.auth,
  41335. channel_data: data.channel_data,
  41336. channel: _this.name
  41337. });
  41338. }
  41339. });
  41340. };
  41341. Channel.prototype.unsubscribe = function () {
  41342. this.subscribed = false;
  41343. this.pusher.send_event('pusher:unsubscribe', {
  41344. channel: this.name
  41345. });
  41346. };
  41347. Channel.prototype.cancelSubscription = function () {
  41348. this.subscriptionCancelled = true;
  41349. };
  41350. Channel.prototype.reinstateSubscription = function () {
  41351. this.subscriptionCancelled = false;
  41352. };
  41353. return Channel;
  41354. }(dispatcher));
  41355. /* harmony default export */ var channels_channel = (channel_Channel);
  41356. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41357. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41358. var extendStatics = function (d, b) {
  41359. extendStatics = Object.setPrototypeOf ||
  41360. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41361. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41362. return extendStatics(d, b);
  41363. };
  41364. return function (d, b) {
  41365. extendStatics(d, b);
  41366. function __() { this.constructor = d; }
  41367. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41368. };
  41369. })();
  41370. var private_channel_PrivateChannel = (function (_super) {
  41371. private_channel_extends(PrivateChannel, _super);
  41372. function PrivateChannel() {
  41373. return _super !== null && _super.apply(this, arguments) || this;
  41374. }
  41375. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41376. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41377. return authorizer.authorize(socketId, callback);
  41378. };
  41379. return PrivateChannel;
  41380. }(channels_channel));
  41381. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41382. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41383. var members_Members = (function () {
  41384. function Members() {
  41385. this.reset();
  41386. }
  41387. Members.prototype.get = function (id) {
  41388. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41389. return {
  41390. id: id,
  41391. info: this.members[id]
  41392. };
  41393. }
  41394. else {
  41395. return null;
  41396. }
  41397. };
  41398. Members.prototype.each = function (callback) {
  41399. var _this = this;
  41400. objectApply(this.members, function (member, id) {
  41401. callback(_this.get(id));
  41402. });
  41403. };
  41404. Members.prototype.setMyID = function (id) {
  41405. this.myID = id;
  41406. };
  41407. Members.prototype.onSubscription = function (subscriptionData) {
  41408. this.members = subscriptionData.presence.hash;
  41409. this.count = subscriptionData.presence.count;
  41410. this.me = this.get(this.myID);
  41411. };
  41412. Members.prototype.addMember = function (memberData) {
  41413. if (this.get(memberData.user_id) === null) {
  41414. this.count++;
  41415. }
  41416. this.members[memberData.user_id] = memberData.user_info;
  41417. return this.get(memberData.user_id);
  41418. };
  41419. Members.prototype.removeMember = function (memberData) {
  41420. var member = this.get(memberData.user_id);
  41421. if (member) {
  41422. delete this.members[memberData.user_id];
  41423. this.count--;
  41424. }
  41425. return member;
  41426. };
  41427. Members.prototype.reset = function () {
  41428. this.members = {};
  41429. this.count = 0;
  41430. this.myID = null;
  41431. this.me = null;
  41432. };
  41433. return Members;
  41434. }());
  41435. /* harmony default export */ var members = (members_Members);
  41436. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41437. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41438. var extendStatics = function (d, b) {
  41439. extendStatics = Object.setPrototypeOf ||
  41440. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41441. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41442. return extendStatics(d, b);
  41443. };
  41444. return function (d, b) {
  41445. extendStatics(d, b);
  41446. function __() { this.constructor = d; }
  41447. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41448. };
  41449. })();
  41450. var presence_channel_PresenceChannel = (function (_super) {
  41451. presence_channel_extends(PresenceChannel, _super);
  41452. function PresenceChannel(name, pusher) {
  41453. var _this = _super.call(this, name, pusher) || this;
  41454. _this.members = new members();
  41455. return _this;
  41456. }
  41457. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41458. var _this = this;
  41459. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41460. if (!error) {
  41461. if (authData.channel_data === undefined) {
  41462. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41463. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41464. ("expected 'channel_data' field. " + suffix));
  41465. callback("Invalid auth response");
  41466. return;
  41467. }
  41468. var channelData = JSON.parse(authData.channel_data);
  41469. _this.members.setMyID(channelData.user_id);
  41470. }
  41471. callback(error, authData);
  41472. });
  41473. };
  41474. PresenceChannel.prototype.handleEvent = function (event) {
  41475. var eventName = event.event;
  41476. if (eventName.indexOf("pusher_internal:") === 0) {
  41477. this.handleInternalEvent(event);
  41478. }
  41479. else {
  41480. var data = event.data;
  41481. var metadata = {};
  41482. if (event.user_id) {
  41483. metadata.user_id = event.user_id;
  41484. }
  41485. this.emit(eventName, data, metadata);
  41486. }
  41487. };
  41488. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41489. var eventName = event.event;
  41490. var data = event.data;
  41491. switch (eventName) {
  41492. case "pusher_internal:subscription_succeeded":
  41493. this.handleSubscriptionSucceededEvent(event);
  41494. break;
  41495. case "pusher_internal:member_added":
  41496. var addedMember = this.members.addMember(data);
  41497. this.emit('pusher:member_added', addedMember);
  41498. break;
  41499. case "pusher_internal:member_removed":
  41500. var removedMember = this.members.removeMember(data);
  41501. if (removedMember) {
  41502. this.emit('pusher:member_removed', removedMember);
  41503. }
  41504. break;
  41505. }
  41506. };
  41507. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41508. this.subscriptionPending = false;
  41509. this.subscribed = true;
  41510. if (this.subscriptionCancelled) {
  41511. this.pusher.unsubscribe(this.name);
  41512. }
  41513. else {
  41514. this.members.onSubscription(event.data);
  41515. this.emit("pusher:subscription_succeeded", this.members);
  41516. }
  41517. };
  41518. PresenceChannel.prototype.disconnect = function () {
  41519. this.members.reset();
  41520. _super.prototype.disconnect.call(this);
  41521. };
  41522. return PresenceChannel;
  41523. }(private_channel));
  41524. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41525. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41526. var nacl_fast = __webpack_require__(0);
  41527. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41528. var nacl_util = __webpack_require__(1);
  41529. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41530. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41531. var extendStatics = function (d, b) {
  41532. extendStatics = Object.setPrototypeOf ||
  41533. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41534. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41535. return extendStatics(d, b);
  41536. };
  41537. return function (d, b) {
  41538. extendStatics(d, b);
  41539. function __() { this.constructor = d; }
  41540. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41541. };
  41542. })();
  41543. var encrypted_channel_EncryptedChannel = (function (_super) {
  41544. encrypted_channel_extends(EncryptedChannel, _super);
  41545. function EncryptedChannel() {
  41546. var _this = _super !== null && _super.apply(this, arguments) || this;
  41547. _this.key = null;
  41548. return _this;
  41549. }
  41550. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41551. var _this = this;
  41552. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41553. if (error) {
  41554. callback(true, authData);
  41555. return;
  41556. }
  41557. var sharedSecret = authData["shared_secret"];
  41558. if (!sharedSecret) {
  41559. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41560. callback(true, errorMsg);
  41561. return;
  41562. }
  41563. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41564. delete authData["shared_secret"];
  41565. callback(false, authData);
  41566. });
  41567. };
  41568. EncryptedChannel.prototype.trigger = function (event, data) {
  41569. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41570. };
  41571. EncryptedChannel.prototype.handleEvent = function (event) {
  41572. var eventName = event.event;
  41573. var data = event.data;
  41574. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41575. _super.prototype.handleEvent.call(this, event);
  41576. return;
  41577. }
  41578. this.handleEncryptedEvent(eventName, data);
  41579. };
  41580. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41581. var _this = this;
  41582. if (!this.key) {
  41583. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41584. return;
  41585. }
  41586. if (!data.ciphertext || !data.nonce) {
  41587. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41588. return;
  41589. }
  41590. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41591. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41592. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41593. return;
  41594. }
  41595. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41596. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41597. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41598. return;
  41599. }
  41600. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41601. if (bytes === null) {
  41602. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41603. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41604. if (error) {
  41605. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41606. return;
  41607. }
  41608. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41609. if (bytes === null) {
  41610. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41611. return;
  41612. }
  41613. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41614. return;
  41615. });
  41616. return;
  41617. }
  41618. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41619. };
  41620. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41621. try {
  41622. this.emit(eventName, JSON.parse(data));
  41623. }
  41624. catch (e) {
  41625. this.emit(eventName, data);
  41626. }
  41627. return this;
  41628. };
  41629. return EncryptedChannel;
  41630. }(private_channel));
  41631. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41632. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41633. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41634. var extendStatics = function (d, b) {
  41635. extendStatics = Object.setPrototypeOf ||
  41636. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41637. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41638. return extendStatics(d, b);
  41639. };
  41640. return function (d, b) {
  41641. extendStatics(d, b);
  41642. function __() { this.constructor = d; }
  41643. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41644. };
  41645. })();
  41646. var connection_manager_ConnectionManager = (function (_super) {
  41647. connection_manager_extends(ConnectionManager, _super);
  41648. function ConnectionManager(key, options) {
  41649. var _this = _super.call(this) || this;
  41650. _this.key = key;
  41651. _this.options = options || {};
  41652. _this.state = "initialized";
  41653. _this.connection = null;
  41654. _this.usingTLS = !!options.useTLS;
  41655. _this.timeline = _this.options.timeline;
  41656. _this.errorCallbacks = _this.buildErrorCallbacks();
  41657. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41658. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41659. var Network = runtime.getNetwork();
  41660. Network.bind("online", function () {
  41661. _this.timeline.info({ netinfo: "online" });
  41662. if (_this.state === "connecting" || _this.state === "unavailable") {
  41663. _this.retryIn(0);
  41664. }
  41665. });
  41666. Network.bind("offline", function () {
  41667. _this.timeline.info({ netinfo: "offline" });
  41668. if (_this.connection) {
  41669. _this.sendActivityCheck();
  41670. }
  41671. });
  41672. _this.updateStrategy();
  41673. return _this;
  41674. }
  41675. ConnectionManager.prototype.connect = function () {
  41676. if (this.connection || this.runner) {
  41677. return;
  41678. }
  41679. if (!this.strategy.isSupported()) {
  41680. this.updateState("failed");
  41681. return;
  41682. }
  41683. this.updateState("connecting");
  41684. this.startConnecting();
  41685. this.setUnavailableTimer();
  41686. };
  41687. ;
  41688. ConnectionManager.prototype.send = function (data) {
  41689. if (this.connection) {
  41690. return this.connection.send(data);
  41691. }
  41692. else {
  41693. return false;
  41694. }
  41695. };
  41696. ;
  41697. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41698. if (this.connection) {
  41699. return this.connection.send_event(name, data, channel);
  41700. }
  41701. else {
  41702. return false;
  41703. }
  41704. };
  41705. ;
  41706. ConnectionManager.prototype.disconnect = function () {
  41707. this.disconnectInternally();
  41708. this.updateState("disconnected");
  41709. };
  41710. ;
  41711. ConnectionManager.prototype.isUsingTLS = function () {
  41712. return this.usingTLS;
  41713. };
  41714. ;
  41715. ConnectionManager.prototype.startConnecting = function () {
  41716. var _this = this;
  41717. var callback = function (error, handshake) {
  41718. if (error) {
  41719. _this.runner = _this.strategy.connect(0, callback);
  41720. }
  41721. else {
  41722. if (handshake.action === "error") {
  41723. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41724. _this.timeline.error({ handshakeError: handshake.error });
  41725. }
  41726. else {
  41727. _this.abortConnecting();
  41728. _this.handshakeCallbacks[handshake.action](handshake);
  41729. }
  41730. }
  41731. };
  41732. this.runner = this.strategy.connect(0, callback);
  41733. };
  41734. ;
  41735. ConnectionManager.prototype.abortConnecting = function () {
  41736. if (this.runner) {
  41737. this.runner.abort();
  41738. this.runner = null;
  41739. }
  41740. };
  41741. ;
  41742. ConnectionManager.prototype.disconnectInternally = function () {
  41743. this.abortConnecting();
  41744. this.clearRetryTimer();
  41745. this.clearUnavailableTimer();
  41746. if (this.connection) {
  41747. var connection = this.abandonConnection();
  41748. connection.close();
  41749. }
  41750. };
  41751. ;
  41752. ConnectionManager.prototype.updateStrategy = function () {
  41753. this.strategy = this.options.getStrategy({
  41754. key: this.key,
  41755. timeline: this.timeline,
  41756. useTLS: this.usingTLS
  41757. });
  41758. };
  41759. ;
  41760. ConnectionManager.prototype.retryIn = function (delay) {
  41761. var _this = this;
  41762. this.timeline.info({ action: "retry", delay: delay });
  41763. if (delay > 0) {
  41764. this.emit("connecting_in", Math.round(delay / 1000));
  41765. }
  41766. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41767. _this.disconnectInternally();
  41768. _this.connect();
  41769. });
  41770. };
  41771. ;
  41772. ConnectionManager.prototype.clearRetryTimer = function () {
  41773. if (this.retryTimer) {
  41774. this.retryTimer.ensureAborted();
  41775. this.retryTimer = null;
  41776. }
  41777. };
  41778. ;
  41779. ConnectionManager.prototype.setUnavailableTimer = function () {
  41780. var _this = this;
  41781. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41782. _this.updateState("unavailable");
  41783. });
  41784. };
  41785. ;
  41786. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41787. if (this.unavailableTimer) {
  41788. this.unavailableTimer.ensureAborted();
  41789. }
  41790. };
  41791. ;
  41792. ConnectionManager.prototype.sendActivityCheck = function () {
  41793. var _this = this;
  41794. this.stopActivityCheck();
  41795. this.connection.ping();
  41796. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41797. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41798. _this.retryIn(0);
  41799. });
  41800. };
  41801. ;
  41802. ConnectionManager.prototype.resetActivityCheck = function () {
  41803. var _this = this;
  41804. this.stopActivityCheck();
  41805. if (this.connection && !this.connection.handlesActivityChecks()) {
  41806. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41807. _this.sendActivityCheck();
  41808. });
  41809. }
  41810. };
  41811. ;
  41812. ConnectionManager.prototype.stopActivityCheck = function () {
  41813. if (this.activityTimer) {
  41814. this.activityTimer.ensureAborted();
  41815. }
  41816. };
  41817. ;
  41818. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41819. var _this = this;
  41820. return extend({}, errorCallbacks, {
  41821. message: function (message) {
  41822. _this.resetActivityCheck();
  41823. _this.emit('message', message);
  41824. },
  41825. ping: function () {
  41826. _this.send_event('pusher:pong', {});
  41827. },
  41828. activity: function () {
  41829. _this.resetActivityCheck();
  41830. },
  41831. error: function (error) {
  41832. _this.emit("error", { type: "WebSocketError", error: error });
  41833. },
  41834. closed: function () {
  41835. _this.abandonConnection();
  41836. if (_this.shouldRetry()) {
  41837. _this.retryIn(1000);
  41838. }
  41839. }
  41840. });
  41841. };
  41842. ;
  41843. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41844. var _this = this;
  41845. return extend({}, errorCallbacks, {
  41846. connected: function (handshake) {
  41847. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41848. _this.clearUnavailableTimer();
  41849. _this.setConnection(handshake.connection);
  41850. _this.socket_id = _this.connection.id;
  41851. _this.updateState("connected", { socket_id: _this.socket_id });
  41852. }
  41853. });
  41854. };
  41855. ;
  41856. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41857. var _this = this;
  41858. var withErrorEmitted = function (callback) {
  41859. return function (result) {
  41860. if (result.error) {
  41861. _this.emit("error", { type: "WebSocketError", error: result.error });
  41862. }
  41863. callback(result);
  41864. };
  41865. };
  41866. return {
  41867. tls_only: withErrorEmitted(function () {
  41868. _this.usingTLS = true;
  41869. _this.updateStrategy();
  41870. _this.retryIn(0);
  41871. }),
  41872. refused: withErrorEmitted(function () {
  41873. _this.disconnect();
  41874. }),
  41875. backoff: withErrorEmitted(function () {
  41876. _this.retryIn(1000);
  41877. }),
  41878. retry: withErrorEmitted(function () {
  41879. _this.retryIn(0);
  41880. })
  41881. };
  41882. };
  41883. ;
  41884. ConnectionManager.prototype.setConnection = function (connection) {
  41885. this.connection = connection;
  41886. for (var event in this.connectionCallbacks) {
  41887. this.connection.bind(event, this.connectionCallbacks[event]);
  41888. }
  41889. this.resetActivityCheck();
  41890. };
  41891. ;
  41892. ConnectionManager.prototype.abandonConnection = function () {
  41893. if (!this.connection) {
  41894. return;
  41895. }
  41896. this.stopActivityCheck();
  41897. for (var event in this.connectionCallbacks) {
  41898. this.connection.unbind(event, this.connectionCallbacks[event]);
  41899. }
  41900. var connection = this.connection;
  41901. this.connection = null;
  41902. return connection;
  41903. };
  41904. ConnectionManager.prototype.updateState = function (newState, data) {
  41905. var previousState = this.state;
  41906. this.state = newState;
  41907. if (previousState !== newState) {
  41908. var newStateDescription = newState;
  41909. if (newStateDescription === "connected") {
  41910. newStateDescription += " with new socket ID " + data.socket_id;
  41911. }
  41912. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41913. this.timeline.info({ state: newState, params: data });
  41914. this.emit('state_change', { previous: previousState, current: newState });
  41915. this.emit(newState, data);
  41916. }
  41917. };
  41918. ConnectionManager.prototype.shouldRetry = function () {
  41919. return this.state === "connecting" || this.state === "connected";
  41920. };
  41921. return ConnectionManager;
  41922. }(dispatcher));
  41923. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41924. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41925. var channels_Channels = (function () {
  41926. function Channels() {
  41927. this.channels = {};
  41928. }
  41929. Channels.prototype.add = function (name, pusher) {
  41930. if (!this.channels[name]) {
  41931. this.channels[name] = createChannel(name, pusher);
  41932. }
  41933. return this.channels[name];
  41934. };
  41935. Channels.prototype.all = function () {
  41936. return values(this.channels);
  41937. };
  41938. Channels.prototype.find = function (name) {
  41939. return this.channels[name];
  41940. };
  41941. Channels.prototype.remove = function (name) {
  41942. var channel = this.channels[name];
  41943. delete this.channels[name];
  41944. return channel;
  41945. };
  41946. Channels.prototype.disconnect = function () {
  41947. objectApply(this.channels, function (channel) {
  41948. channel.disconnect();
  41949. });
  41950. };
  41951. return Channels;
  41952. }());
  41953. /* harmony default export */ var channels = (channels_Channels);
  41954. function createChannel(name, pusher) {
  41955. if (name.indexOf('private-encrypted-') === 0) {
  41956. if (false) { var errorMsg; }
  41957. return factory.createEncryptedChannel(name, pusher);
  41958. }
  41959. else if (name.indexOf('private-') === 0) {
  41960. return factory.createPrivateChannel(name, pusher);
  41961. }
  41962. else if (name.indexOf('presence-') === 0) {
  41963. return factory.createPresenceChannel(name, pusher);
  41964. }
  41965. else {
  41966. return factory.createChannel(name, pusher);
  41967. }
  41968. }
  41969. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41970. var Factory = {
  41971. createChannels: function () {
  41972. return new channels();
  41973. },
  41974. createConnectionManager: function (key, options) {
  41975. return new connection_manager(key, options);
  41976. },
  41977. createChannel: function (name, pusher) {
  41978. return new channels_channel(name, pusher);
  41979. },
  41980. createPrivateChannel: function (name, pusher) {
  41981. return new private_channel(name, pusher);
  41982. },
  41983. createPresenceChannel: function (name, pusher) {
  41984. return new presence_channel(name, pusher);
  41985. },
  41986. createEncryptedChannel: function (name, pusher) {
  41987. return new encrypted_channel(name, pusher);
  41988. },
  41989. createTimelineSender: function (timeline, options) {
  41990. return new timeline_sender(timeline, options);
  41991. },
  41992. createAuthorizer: function (channel, options) {
  41993. if (options.authorizer) {
  41994. return options.authorizer(channel, options);
  41995. }
  41996. return new pusher_authorizer(channel, options);
  41997. },
  41998. createHandshake: function (transport, callback) {
  41999. return new connection_handshake(transport, callback);
  42000. },
  42001. createAssistantToTheTransportManager: function (manager, transport, options) {
  42002. return new assistant_to_the_transport_manager(manager, transport, options);
  42003. }
  42004. };
  42005. /* harmony default export */ var factory = (Factory);
  42006. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42007. var transport_manager_TransportManager = (function () {
  42008. function TransportManager(options) {
  42009. this.options = options || {};
  42010. this.livesLeft = this.options.lives || Infinity;
  42011. }
  42012. TransportManager.prototype.getAssistant = function (transport) {
  42013. return factory.createAssistantToTheTransportManager(this, transport, {
  42014. minPingDelay: this.options.minPingDelay,
  42015. maxPingDelay: this.options.maxPingDelay
  42016. });
  42017. };
  42018. TransportManager.prototype.isAlive = function () {
  42019. return this.livesLeft > 0;
  42020. };
  42021. TransportManager.prototype.reportDeath = function () {
  42022. this.livesLeft -= 1;
  42023. };
  42024. return TransportManager;
  42025. }());
  42026. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42027. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42028. var sequential_strategy_SequentialStrategy = (function () {
  42029. function SequentialStrategy(strategies, options) {
  42030. this.strategies = strategies;
  42031. this.loop = Boolean(options.loop);
  42032. this.failFast = Boolean(options.failFast);
  42033. this.timeout = options.timeout;
  42034. this.timeoutLimit = options.timeoutLimit;
  42035. }
  42036. SequentialStrategy.prototype.isSupported = function () {
  42037. return any(this.strategies, util.method("isSupported"));
  42038. };
  42039. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42040. var _this = this;
  42041. var strategies = this.strategies;
  42042. var current = 0;
  42043. var timeout = this.timeout;
  42044. var runner = null;
  42045. var tryNextStrategy = function (error, handshake) {
  42046. if (handshake) {
  42047. callback(null, handshake);
  42048. }
  42049. else {
  42050. current = current + 1;
  42051. if (_this.loop) {
  42052. current = current % strategies.length;
  42053. }
  42054. if (current < strategies.length) {
  42055. if (timeout) {
  42056. timeout = timeout * 2;
  42057. if (_this.timeoutLimit) {
  42058. timeout = Math.min(timeout, _this.timeoutLimit);
  42059. }
  42060. }
  42061. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42062. }
  42063. else {
  42064. callback(true);
  42065. }
  42066. }
  42067. };
  42068. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42069. return {
  42070. abort: function () {
  42071. runner.abort();
  42072. },
  42073. forceMinPriority: function (p) {
  42074. minPriority = p;
  42075. if (runner) {
  42076. runner.forceMinPriority(p);
  42077. }
  42078. }
  42079. };
  42080. };
  42081. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42082. var timer = null;
  42083. var runner = null;
  42084. if (options.timeout > 0) {
  42085. timer = new OneOffTimer(options.timeout, function () {
  42086. runner.abort();
  42087. callback(true);
  42088. });
  42089. }
  42090. runner = strategy.connect(minPriority, function (error, handshake) {
  42091. if (error && timer && timer.isRunning() && !options.failFast) {
  42092. return;
  42093. }
  42094. if (timer) {
  42095. timer.ensureAborted();
  42096. }
  42097. callback(error, handshake);
  42098. });
  42099. return {
  42100. abort: function () {
  42101. if (timer) {
  42102. timer.ensureAborted();
  42103. }
  42104. runner.abort();
  42105. },
  42106. forceMinPriority: function (p) {
  42107. runner.forceMinPriority(p);
  42108. }
  42109. };
  42110. };
  42111. return SequentialStrategy;
  42112. }());
  42113. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42114. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42115. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42116. function BestConnectedEverStrategy(strategies) {
  42117. this.strategies = strategies;
  42118. }
  42119. BestConnectedEverStrategy.prototype.isSupported = function () {
  42120. return any(this.strategies, util.method("isSupported"));
  42121. };
  42122. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42123. return connect(this.strategies, minPriority, function (i, runners) {
  42124. return function (error, handshake) {
  42125. runners[i].error = error;
  42126. if (error) {
  42127. if (allRunnersFailed(runners)) {
  42128. callback(true);
  42129. }
  42130. return;
  42131. }
  42132. apply(runners, function (runner) {
  42133. runner.forceMinPriority(handshake.transport.priority);
  42134. });
  42135. callback(null, handshake);
  42136. };
  42137. });
  42138. };
  42139. return BestConnectedEverStrategy;
  42140. }());
  42141. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42142. function connect(strategies, minPriority, callbackBuilder) {
  42143. var runners = map(strategies, function (strategy, i, _, rs) {
  42144. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42145. });
  42146. return {
  42147. abort: function () {
  42148. apply(runners, abortRunner);
  42149. },
  42150. forceMinPriority: function (p) {
  42151. apply(runners, function (runner) {
  42152. runner.forceMinPriority(p);
  42153. });
  42154. }
  42155. };
  42156. }
  42157. function allRunnersFailed(runners) {
  42158. return collections_all(runners, function (runner) {
  42159. return Boolean(runner.error);
  42160. });
  42161. }
  42162. function abortRunner(runner) {
  42163. if (!runner.error && !runner.aborted) {
  42164. runner.abort();
  42165. runner.aborted = true;
  42166. }
  42167. }
  42168. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42169. var cached_strategy_CachedStrategy = (function () {
  42170. function CachedStrategy(strategy, transports, options) {
  42171. this.strategy = strategy;
  42172. this.transports = transports;
  42173. this.ttl = options.ttl || 1800 * 1000;
  42174. this.usingTLS = options.useTLS;
  42175. this.timeline = options.timeline;
  42176. }
  42177. CachedStrategy.prototype.isSupported = function () {
  42178. return this.strategy.isSupported();
  42179. };
  42180. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42181. var usingTLS = this.usingTLS;
  42182. var info = fetchTransportCache(usingTLS);
  42183. var strategies = [this.strategy];
  42184. if (info && info.timestamp + this.ttl >= util.now()) {
  42185. var transport = this.transports[info.transport];
  42186. if (transport) {
  42187. this.timeline.info({
  42188. cached: true,
  42189. transport: info.transport,
  42190. latency: info.latency
  42191. });
  42192. strategies.push(new sequential_strategy([transport], {
  42193. timeout: info.latency * 2 + 1000,
  42194. failFast: true
  42195. }));
  42196. }
  42197. }
  42198. var startTimestamp = util.now();
  42199. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42200. if (error) {
  42201. flushTransportCache(usingTLS);
  42202. if (strategies.length > 0) {
  42203. startTimestamp = util.now();
  42204. runner = strategies.pop().connect(minPriority, cb);
  42205. }
  42206. else {
  42207. callback(error);
  42208. }
  42209. }
  42210. else {
  42211. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42212. callback(null, handshake);
  42213. }
  42214. });
  42215. return {
  42216. abort: function () {
  42217. runner.abort();
  42218. },
  42219. forceMinPriority: function (p) {
  42220. minPriority = p;
  42221. if (runner) {
  42222. runner.forceMinPriority(p);
  42223. }
  42224. }
  42225. };
  42226. };
  42227. return CachedStrategy;
  42228. }());
  42229. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42230. function getTransportCacheKey(usingTLS) {
  42231. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42232. }
  42233. function fetchTransportCache(usingTLS) {
  42234. var storage = runtime.getLocalStorage();
  42235. if (storage) {
  42236. try {
  42237. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42238. if (serializedCache) {
  42239. return JSON.parse(serializedCache);
  42240. }
  42241. }
  42242. catch (e) {
  42243. flushTransportCache(usingTLS);
  42244. }
  42245. }
  42246. return null;
  42247. }
  42248. function storeTransportCache(usingTLS, transport, latency) {
  42249. var storage = runtime.getLocalStorage();
  42250. if (storage) {
  42251. try {
  42252. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42253. timestamp: util.now(),
  42254. transport: transport,
  42255. latency: latency
  42256. });
  42257. }
  42258. catch (e) {
  42259. }
  42260. }
  42261. }
  42262. function flushTransportCache(usingTLS) {
  42263. var storage = runtime.getLocalStorage();
  42264. if (storage) {
  42265. try {
  42266. delete storage[getTransportCacheKey(usingTLS)];
  42267. }
  42268. catch (e) {
  42269. }
  42270. }
  42271. }
  42272. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42273. var delayed_strategy_DelayedStrategy = (function () {
  42274. function DelayedStrategy(strategy, _a) {
  42275. var number = _a.delay;
  42276. this.strategy = strategy;
  42277. this.options = { delay: number };
  42278. }
  42279. DelayedStrategy.prototype.isSupported = function () {
  42280. return this.strategy.isSupported();
  42281. };
  42282. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42283. var strategy = this.strategy;
  42284. var runner;
  42285. var timer = new OneOffTimer(this.options.delay, function () {
  42286. runner = strategy.connect(minPriority, callback);
  42287. });
  42288. return {
  42289. abort: function () {
  42290. timer.ensureAborted();
  42291. if (runner) {
  42292. runner.abort();
  42293. }
  42294. },
  42295. forceMinPriority: function (p) {
  42296. minPriority = p;
  42297. if (runner) {
  42298. runner.forceMinPriority(p);
  42299. }
  42300. }
  42301. };
  42302. };
  42303. return DelayedStrategy;
  42304. }());
  42305. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42306. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42307. var IfStrategy = (function () {
  42308. function IfStrategy(test, trueBranch, falseBranch) {
  42309. this.test = test;
  42310. this.trueBranch = trueBranch;
  42311. this.falseBranch = falseBranch;
  42312. }
  42313. IfStrategy.prototype.isSupported = function () {
  42314. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42315. return branch.isSupported();
  42316. };
  42317. IfStrategy.prototype.connect = function (minPriority, callback) {
  42318. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42319. return branch.connect(minPriority, callback);
  42320. };
  42321. return IfStrategy;
  42322. }());
  42323. /* harmony default export */ var if_strategy = (IfStrategy);
  42324. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42325. var FirstConnectedStrategy = (function () {
  42326. function FirstConnectedStrategy(strategy) {
  42327. this.strategy = strategy;
  42328. }
  42329. FirstConnectedStrategy.prototype.isSupported = function () {
  42330. return this.strategy.isSupported();
  42331. };
  42332. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42333. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42334. if (handshake) {
  42335. runner.abort();
  42336. }
  42337. callback(error, handshake);
  42338. });
  42339. return runner;
  42340. };
  42341. return FirstConnectedStrategy;
  42342. }());
  42343. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42344. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42345. function testSupportsStrategy(strategy) {
  42346. return function () {
  42347. return strategy.isSupported();
  42348. };
  42349. }
  42350. var getDefaultStrategy = function (config, defineTransport) {
  42351. var definedTransports = {};
  42352. function defineTransportStrategy(name, type, priority, options, manager) {
  42353. var transport = defineTransport(config, name, type, priority, options, manager);
  42354. definedTransports[name] = transport;
  42355. return transport;
  42356. }
  42357. var ws_options = {
  42358. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42359. hostTLS: config.wsHost + ":" + config.wssPort,
  42360. httpPath: config.wsPath
  42361. };
  42362. var wss_options = extend({}, ws_options, {
  42363. useTLS: true
  42364. });
  42365. var sockjs_options = {
  42366. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42367. hostTLS: config.httpHost + ":" + config.httpsPort,
  42368. httpPath: config.httpPath
  42369. };
  42370. var timeouts = {
  42371. loop: true,
  42372. timeout: 15000,
  42373. timeoutLimit: 60000
  42374. };
  42375. var ws_manager = new transport_manager({
  42376. lives: 2,
  42377. minPingDelay: 10000,
  42378. maxPingDelay: config.activity_timeout
  42379. });
  42380. var streaming_manager = new transport_manager({
  42381. lives: 2,
  42382. minPingDelay: 10000,
  42383. maxPingDelay: config.activity_timeout
  42384. });
  42385. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42386. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42387. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42388. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42389. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42390. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42391. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42392. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42393. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42394. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42395. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42396. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42397. 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);
  42398. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42399. var wsStrategy;
  42400. if (config.useTLS) {
  42401. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42402. }
  42403. else {
  42404. wsStrategy = new best_connected_ever_strategy([
  42405. ws_loop,
  42406. new delayed_strategy(wss_loop, { delay: 2000 }),
  42407. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42408. ]);
  42409. }
  42410. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42411. ttl: 1800000,
  42412. timeline: config.timeline,
  42413. useTLS: config.useTLS
  42414. });
  42415. };
  42416. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42417. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42418. /* harmony default export */ var transport_connection_initializer = (function () {
  42419. var self = this;
  42420. self.timeline.info(self.buildTimelineMessage({
  42421. transport: self.name + (self.options.useTLS ? "s" : "")
  42422. }));
  42423. if (self.hooks.isInitialized()) {
  42424. self.changeState("initialized");
  42425. }
  42426. else if (self.hooks.file) {
  42427. self.changeState("initializing");
  42428. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42429. if (self.hooks.isInitialized()) {
  42430. self.changeState("initialized");
  42431. callback(true);
  42432. }
  42433. else {
  42434. if (error) {
  42435. self.onError(error);
  42436. }
  42437. self.onClose();
  42438. callback(false);
  42439. }
  42440. });
  42441. }
  42442. else {
  42443. self.onClose();
  42444. }
  42445. });
  42446. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42447. var http_xdomain_request_hooks = {
  42448. getRequest: function (socket) {
  42449. var xdr = new window.XDomainRequest();
  42450. xdr.ontimeout = function () {
  42451. socket.emit("error", new RequestTimedOut());
  42452. socket.close();
  42453. };
  42454. xdr.onerror = function (e) {
  42455. socket.emit("error", e);
  42456. socket.close();
  42457. };
  42458. xdr.onprogress = function () {
  42459. if (xdr.responseText && xdr.responseText.length > 0) {
  42460. socket.onChunk(200, xdr.responseText);
  42461. }
  42462. };
  42463. xdr.onload = function () {
  42464. if (xdr.responseText && xdr.responseText.length > 0) {
  42465. socket.onChunk(200, xdr.responseText);
  42466. }
  42467. socket.emit("finished", 200);
  42468. socket.close();
  42469. };
  42470. return xdr;
  42471. },
  42472. abortRequest: function (xdr) {
  42473. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42474. xdr.abort();
  42475. }
  42476. };
  42477. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42478. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42479. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42480. var extendStatics = function (d, b) {
  42481. extendStatics = Object.setPrototypeOf ||
  42482. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42483. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42484. return extendStatics(d, b);
  42485. };
  42486. return function (d, b) {
  42487. extendStatics(d, b);
  42488. function __() { this.constructor = d; }
  42489. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42490. };
  42491. })();
  42492. var MAX_BUFFER_LENGTH = 256 * 1024;
  42493. var http_request_HTTPRequest = (function (_super) {
  42494. http_request_extends(HTTPRequest, _super);
  42495. function HTTPRequest(hooks, method, url) {
  42496. var _this = _super.call(this) || this;
  42497. _this.hooks = hooks;
  42498. _this.method = method;
  42499. _this.url = url;
  42500. return _this;
  42501. }
  42502. HTTPRequest.prototype.start = function (payload) {
  42503. var _this = this;
  42504. this.position = 0;
  42505. this.xhr = this.hooks.getRequest(this);
  42506. this.unloader = function () {
  42507. _this.close();
  42508. };
  42509. runtime.addUnloadListener(this.unloader);
  42510. this.xhr.open(this.method, this.url, true);
  42511. if (this.xhr.setRequestHeader) {
  42512. this.xhr.setRequestHeader("Content-Type", "application/json");
  42513. }
  42514. this.xhr.send(payload);
  42515. };
  42516. HTTPRequest.prototype.close = function () {
  42517. if (this.unloader) {
  42518. runtime.removeUnloadListener(this.unloader);
  42519. this.unloader = null;
  42520. }
  42521. if (this.xhr) {
  42522. this.hooks.abortRequest(this.xhr);
  42523. this.xhr = null;
  42524. }
  42525. };
  42526. HTTPRequest.prototype.onChunk = function (status, data) {
  42527. while (true) {
  42528. var chunk = this.advanceBuffer(data);
  42529. if (chunk) {
  42530. this.emit("chunk", { status: status, data: chunk });
  42531. }
  42532. else {
  42533. break;
  42534. }
  42535. }
  42536. if (this.isBufferTooLong(data)) {
  42537. this.emit("buffer_too_long");
  42538. }
  42539. };
  42540. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42541. var unreadData = buffer.slice(this.position);
  42542. var endOfLinePosition = unreadData.indexOf("\n");
  42543. if (endOfLinePosition !== -1) {
  42544. this.position += endOfLinePosition + 1;
  42545. return unreadData.slice(0, endOfLinePosition);
  42546. }
  42547. else {
  42548. return null;
  42549. }
  42550. };
  42551. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42552. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42553. };
  42554. return HTTPRequest;
  42555. }(dispatcher));
  42556. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42557. // CONCATENATED MODULE: ./src/core/http/state.ts
  42558. var State;
  42559. (function (State) {
  42560. State[State["CONNECTING"] = 0] = "CONNECTING";
  42561. State[State["OPEN"] = 1] = "OPEN";
  42562. State[State["CLOSED"] = 3] = "CLOSED";
  42563. })(State || (State = {}));
  42564. /* harmony default export */ var state = (State);
  42565. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42566. var autoIncrement = 1;
  42567. var http_socket_HTTPSocket = (function () {
  42568. function HTTPSocket(hooks, url) {
  42569. this.hooks = hooks;
  42570. this.session = randomNumber(1000) + "/" + randomString(8);
  42571. this.location = getLocation(url);
  42572. this.readyState = state.CONNECTING;
  42573. this.openStream();
  42574. }
  42575. HTTPSocket.prototype.send = function (payload) {
  42576. return this.sendRaw(JSON.stringify([payload]));
  42577. };
  42578. HTTPSocket.prototype.ping = function () {
  42579. this.hooks.sendHeartbeat(this);
  42580. };
  42581. HTTPSocket.prototype.close = function (code, reason) {
  42582. this.onClose(code, reason, true);
  42583. };
  42584. HTTPSocket.prototype.sendRaw = function (payload) {
  42585. if (this.readyState === state.OPEN) {
  42586. try {
  42587. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42588. return true;
  42589. }
  42590. catch (e) {
  42591. return false;
  42592. }
  42593. }
  42594. else {
  42595. return false;
  42596. }
  42597. };
  42598. HTTPSocket.prototype.reconnect = function () {
  42599. this.closeStream();
  42600. this.openStream();
  42601. };
  42602. ;
  42603. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42604. this.closeStream();
  42605. this.readyState = state.CLOSED;
  42606. if (this.onclose) {
  42607. this.onclose({
  42608. code: code,
  42609. reason: reason,
  42610. wasClean: wasClean
  42611. });
  42612. }
  42613. };
  42614. HTTPSocket.prototype.onChunk = function (chunk) {
  42615. if (chunk.status !== 200) {
  42616. return;
  42617. }
  42618. if (this.readyState === state.OPEN) {
  42619. this.onActivity();
  42620. }
  42621. var payload;
  42622. var type = chunk.data.slice(0, 1);
  42623. switch (type) {
  42624. case 'o':
  42625. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42626. this.onOpen(payload);
  42627. break;
  42628. case 'a':
  42629. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42630. for (var i = 0; i < payload.length; i++) {
  42631. this.onEvent(payload[i]);
  42632. }
  42633. break;
  42634. case 'm':
  42635. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42636. this.onEvent(payload);
  42637. break;
  42638. case 'h':
  42639. this.hooks.onHeartbeat(this);
  42640. break;
  42641. case 'c':
  42642. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42643. this.onClose(payload[0], payload[1], true);
  42644. break;
  42645. }
  42646. };
  42647. HTTPSocket.prototype.onOpen = function (options) {
  42648. if (this.readyState === state.CONNECTING) {
  42649. if (options && options.hostname) {
  42650. this.location.base = replaceHost(this.location.base, options.hostname);
  42651. }
  42652. this.readyState = state.OPEN;
  42653. if (this.onopen) {
  42654. this.onopen();
  42655. }
  42656. }
  42657. else {
  42658. this.onClose(1006, "Server lost session", true);
  42659. }
  42660. };
  42661. HTTPSocket.prototype.onEvent = function (event) {
  42662. if (this.readyState === state.OPEN && this.onmessage) {
  42663. this.onmessage({ data: event });
  42664. }
  42665. };
  42666. HTTPSocket.prototype.onActivity = function () {
  42667. if (this.onactivity) {
  42668. this.onactivity();
  42669. }
  42670. };
  42671. HTTPSocket.prototype.onError = function (error) {
  42672. if (this.onerror) {
  42673. this.onerror(error);
  42674. }
  42675. };
  42676. HTTPSocket.prototype.openStream = function () {
  42677. var _this = this;
  42678. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42679. this.stream.bind("chunk", function (chunk) {
  42680. _this.onChunk(chunk);
  42681. });
  42682. this.stream.bind("finished", function (status) {
  42683. _this.hooks.onFinished(_this, status);
  42684. });
  42685. this.stream.bind("buffer_too_long", function () {
  42686. _this.reconnect();
  42687. });
  42688. try {
  42689. this.stream.start();
  42690. }
  42691. catch (error) {
  42692. util.defer(function () {
  42693. _this.onError(error);
  42694. _this.onClose(1006, "Could not start streaming", false);
  42695. });
  42696. }
  42697. };
  42698. HTTPSocket.prototype.closeStream = function () {
  42699. if (this.stream) {
  42700. this.stream.unbind_all();
  42701. this.stream.close();
  42702. this.stream = null;
  42703. }
  42704. };
  42705. return HTTPSocket;
  42706. }());
  42707. function getLocation(url) {
  42708. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42709. return {
  42710. base: parts[1],
  42711. queryString: parts[2]
  42712. };
  42713. }
  42714. function getSendURL(url, session) {
  42715. return url.base + "/" + session + "/xhr_send";
  42716. }
  42717. function getUniqueURL(url) {
  42718. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42719. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42720. }
  42721. function replaceHost(url, hostname) {
  42722. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42723. return urlParts[1] + hostname + urlParts[3];
  42724. }
  42725. function randomNumber(max) {
  42726. return Math.floor(Math.random() * max);
  42727. }
  42728. function randomString(length) {
  42729. var result = [];
  42730. for (var i = 0; i < length; i++) {
  42731. result.push(randomNumber(32).toString(32));
  42732. }
  42733. return result.join('');
  42734. }
  42735. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42736. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42737. var http_streaming_socket_hooks = {
  42738. getReceiveURL: function (url, session) {
  42739. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42740. },
  42741. onHeartbeat: function (socket) {
  42742. socket.sendRaw("[]");
  42743. },
  42744. sendHeartbeat: function (socket) {
  42745. socket.sendRaw("[]");
  42746. },
  42747. onFinished: function (socket, status) {
  42748. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42749. }
  42750. };
  42751. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42752. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42753. var http_polling_socket_hooks = {
  42754. getReceiveURL: function (url, session) {
  42755. return url.base + "/" + session + "/xhr" + url.queryString;
  42756. },
  42757. onHeartbeat: function () {
  42758. },
  42759. sendHeartbeat: function (socket) {
  42760. socket.sendRaw("[]");
  42761. },
  42762. onFinished: function (socket, status) {
  42763. if (status === 200) {
  42764. socket.reconnect();
  42765. }
  42766. else {
  42767. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42768. }
  42769. }
  42770. };
  42771. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42772. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42773. var http_xhr_request_hooks = {
  42774. getRequest: function (socket) {
  42775. var Constructor = runtime.getXHRAPI();
  42776. var xhr = new Constructor();
  42777. xhr.onreadystatechange = xhr.onprogress = function () {
  42778. switch (xhr.readyState) {
  42779. case 3:
  42780. if (xhr.responseText && xhr.responseText.length > 0) {
  42781. socket.onChunk(xhr.status, xhr.responseText);
  42782. }
  42783. break;
  42784. case 4:
  42785. if (xhr.responseText && xhr.responseText.length > 0) {
  42786. socket.onChunk(xhr.status, xhr.responseText);
  42787. }
  42788. socket.emit("finished", xhr.status);
  42789. socket.close();
  42790. break;
  42791. }
  42792. };
  42793. return xhr;
  42794. },
  42795. abortRequest: function (xhr) {
  42796. xhr.onreadystatechange = null;
  42797. xhr.abort();
  42798. }
  42799. };
  42800. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42801. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42802. var HTTP = {
  42803. createStreamingSocket: function (url) {
  42804. return this.createSocket(http_streaming_socket, url);
  42805. },
  42806. createPollingSocket: function (url) {
  42807. return this.createSocket(http_polling_socket, url);
  42808. },
  42809. createSocket: function (hooks, url) {
  42810. return new http_socket(hooks, url);
  42811. },
  42812. createXHR: function (method, url) {
  42813. return this.createRequest(http_xhr_request, method, url);
  42814. },
  42815. createRequest: function (hooks, method, url) {
  42816. return new http_request(hooks, method, url);
  42817. }
  42818. };
  42819. /* harmony default export */ var http_http = (HTTP);
  42820. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42821. http_http.createXDR = function (method, url) {
  42822. return this.createRequest(http_xdomain_request, method, url);
  42823. };
  42824. /* harmony default export */ var web_http_http = (http_http);
  42825. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42826. var Runtime = {
  42827. nextAuthCallbackID: 1,
  42828. auth_callbacks: {},
  42829. ScriptReceivers: ScriptReceivers,
  42830. DependenciesReceivers: DependenciesReceivers,
  42831. getDefaultStrategy: default_strategy,
  42832. Transports: transports_transports,
  42833. transportConnectionInitializer: transport_connection_initializer,
  42834. HTTPFactory: web_http_http,
  42835. TimelineTransport: jsonp_timeline,
  42836. getXHRAPI: function () {
  42837. return window.XMLHttpRequest;
  42838. },
  42839. getWebSocketAPI: function () {
  42840. return window.WebSocket || window.MozWebSocket;
  42841. },
  42842. setup: function (PusherClass) {
  42843. var _this = this;
  42844. window.Pusher = PusherClass;
  42845. var initializeOnDocumentBody = function () {
  42846. _this.onDocumentBody(PusherClass.ready);
  42847. };
  42848. if (!window.JSON) {
  42849. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42850. }
  42851. else {
  42852. initializeOnDocumentBody();
  42853. }
  42854. },
  42855. getDocument: function () {
  42856. return document;
  42857. },
  42858. getProtocol: function () {
  42859. return this.getDocument().location.protocol;
  42860. },
  42861. getAuthorizers: function () {
  42862. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42863. },
  42864. onDocumentBody: function (callback) {
  42865. var _this = this;
  42866. if (document.body) {
  42867. callback();
  42868. }
  42869. else {
  42870. setTimeout(function () {
  42871. _this.onDocumentBody(callback);
  42872. }, 0);
  42873. }
  42874. },
  42875. createJSONPRequest: function (url, data) {
  42876. return new jsonp_request(url, data);
  42877. },
  42878. createScriptRequest: function (src) {
  42879. return new script_request(src);
  42880. },
  42881. getLocalStorage: function () {
  42882. try {
  42883. return window.localStorage;
  42884. }
  42885. catch (e) {
  42886. return undefined;
  42887. }
  42888. },
  42889. createXHR: function () {
  42890. if (this.getXHRAPI()) {
  42891. return this.createXMLHttpRequest();
  42892. }
  42893. else {
  42894. return this.createMicrosoftXHR();
  42895. }
  42896. },
  42897. createXMLHttpRequest: function () {
  42898. var Constructor = this.getXHRAPI();
  42899. return new Constructor();
  42900. },
  42901. createMicrosoftXHR: function () {
  42902. return new ActiveXObject("Microsoft.XMLHTTP");
  42903. },
  42904. getNetwork: function () {
  42905. return net_info_Network;
  42906. },
  42907. createWebSocket: function (url) {
  42908. var Constructor = this.getWebSocketAPI();
  42909. return new Constructor(url);
  42910. },
  42911. createSocketRequest: function (method, url) {
  42912. if (this.isXHRSupported()) {
  42913. return this.HTTPFactory.createXHR(method, url);
  42914. }
  42915. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42916. return this.HTTPFactory.createXDR(method, url);
  42917. }
  42918. else {
  42919. throw "Cross-origin HTTP requests are not supported";
  42920. }
  42921. },
  42922. isXHRSupported: function () {
  42923. var Constructor = this.getXHRAPI();
  42924. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42925. },
  42926. isXDRSupported: function (useTLS) {
  42927. var protocol = useTLS ? "https:" : "http:";
  42928. var documentProtocol = this.getProtocol();
  42929. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42930. },
  42931. addUnloadListener: function (listener) {
  42932. if (window.addEventListener !== undefined) {
  42933. window.addEventListener("unload", listener, false);
  42934. }
  42935. else if (window.attachEvent !== undefined) {
  42936. window.attachEvent("onunload", listener);
  42937. }
  42938. },
  42939. removeUnloadListener: function (listener) {
  42940. if (window.addEventListener !== undefined) {
  42941. window.removeEventListener("unload", listener, false);
  42942. }
  42943. else if (window.detachEvent !== undefined) {
  42944. window.detachEvent("onunload", listener);
  42945. }
  42946. }
  42947. };
  42948. /* harmony default export */ var runtime = (Runtime);
  42949. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42950. var TimelineLevel;
  42951. (function (TimelineLevel) {
  42952. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42953. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42954. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42955. })(TimelineLevel || (TimelineLevel = {}));
  42956. /* harmony default export */ var timeline_level = (TimelineLevel);
  42957. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42958. var timeline_Timeline = (function () {
  42959. function Timeline(key, session, options) {
  42960. this.key = key;
  42961. this.session = session;
  42962. this.events = [];
  42963. this.options = options || {};
  42964. this.sent = 0;
  42965. this.uniqueID = 0;
  42966. }
  42967. Timeline.prototype.log = function (level, event) {
  42968. if (level <= this.options.level) {
  42969. this.events.push(extend({}, event, { timestamp: util.now() }));
  42970. if (this.options.limit && this.events.length > this.options.limit) {
  42971. this.events.shift();
  42972. }
  42973. }
  42974. };
  42975. Timeline.prototype.error = function (event) {
  42976. this.log(timeline_level.ERROR, event);
  42977. };
  42978. Timeline.prototype.info = function (event) {
  42979. this.log(timeline_level.INFO, event);
  42980. };
  42981. Timeline.prototype.debug = function (event) {
  42982. this.log(timeline_level.DEBUG, event);
  42983. };
  42984. Timeline.prototype.isEmpty = function () {
  42985. return this.events.length === 0;
  42986. };
  42987. Timeline.prototype.send = function (sendfn, callback) {
  42988. var _this = this;
  42989. var data = extend({
  42990. session: this.session,
  42991. bundle: this.sent + 1,
  42992. key: this.key,
  42993. lib: "js",
  42994. version: this.options.version,
  42995. cluster: this.options.cluster,
  42996. features: this.options.features,
  42997. timeline: this.events
  42998. }, this.options.params);
  42999. this.events = [];
  43000. sendfn(data, function (error, result) {
  43001. if (!error) {
  43002. _this.sent++;
  43003. }
  43004. if (callback) {
  43005. callback(error, result);
  43006. }
  43007. });
  43008. return true;
  43009. };
  43010. Timeline.prototype.generateUniqueID = function () {
  43011. this.uniqueID++;
  43012. return this.uniqueID;
  43013. };
  43014. return Timeline;
  43015. }());
  43016. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43017. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43018. var transport_strategy_TransportStrategy = (function () {
  43019. function TransportStrategy(name, priority, transport, options) {
  43020. this.name = name;
  43021. this.priority = priority;
  43022. this.transport = transport;
  43023. this.options = options || {};
  43024. }
  43025. TransportStrategy.prototype.isSupported = function () {
  43026. return this.transport.isSupported({
  43027. useTLS: this.options.useTLS
  43028. });
  43029. };
  43030. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43031. var _this = this;
  43032. if (!this.isSupported()) {
  43033. return failAttempt(new UnsupportedStrategy(), callback);
  43034. }
  43035. else if (this.priority < minPriority) {
  43036. return failAttempt(new TransportPriorityTooLow(), callback);
  43037. }
  43038. var connected = false;
  43039. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43040. var handshake = null;
  43041. var onInitialized = function () {
  43042. transport.unbind("initialized", onInitialized);
  43043. transport.connect();
  43044. };
  43045. var onOpen = function () {
  43046. handshake = factory.createHandshake(transport, function (result) {
  43047. connected = true;
  43048. unbindListeners();
  43049. callback(null, result);
  43050. });
  43051. };
  43052. var onError = function (error) {
  43053. unbindListeners();
  43054. callback(error);
  43055. };
  43056. var onClosed = function () {
  43057. unbindListeners();
  43058. var serializedTransport;
  43059. serializedTransport = safeJSONStringify(transport);
  43060. callback(new TransportClosed(serializedTransport));
  43061. };
  43062. var unbindListeners = function () {
  43063. transport.unbind("initialized", onInitialized);
  43064. transport.unbind("open", onOpen);
  43065. transport.unbind("error", onError);
  43066. transport.unbind("closed", onClosed);
  43067. };
  43068. transport.bind("initialized", onInitialized);
  43069. transport.bind("open", onOpen);
  43070. transport.bind("error", onError);
  43071. transport.bind("closed", onClosed);
  43072. transport.initialize();
  43073. return {
  43074. abort: function () {
  43075. if (connected) {
  43076. return;
  43077. }
  43078. unbindListeners();
  43079. if (handshake) {
  43080. handshake.close();
  43081. }
  43082. else {
  43083. transport.close();
  43084. }
  43085. },
  43086. forceMinPriority: function (p) {
  43087. if (connected) {
  43088. return;
  43089. }
  43090. if (_this.priority < p) {
  43091. if (handshake) {
  43092. handshake.close();
  43093. }
  43094. else {
  43095. transport.close();
  43096. }
  43097. }
  43098. }
  43099. };
  43100. };
  43101. return TransportStrategy;
  43102. }());
  43103. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43104. function failAttempt(error, callback) {
  43105. util.defer(function () {
  43106. callback(error);
  43107. });
  43108. return {
  43109. abort: function () { },
  43110. forceMinPriority: function () { }
  43111. };
  43112. }
  43113. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43114. var strategy_builder_Transports = runtime.Transports;
  43115. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43116. var transportClass = strategy_builder_Transports[type];
  43117. if (!transportClass) {
  43118. throw new UnsupportedTransport(type);
  43119. }
  43120. var enabled = (!config.enabledTransports ||
  43121. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43122. (!config.disabledTransports ||
  43123. arrayIndexOf(config.disabledTransports, name) === -1);
  43124. var transport;
  43125. if (enabled) {
  43126. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43127. key: config.key,
  43128. useTLS: config.useTLS,
  43129. timeline: config.timeline,
  43130. ignoreNullOrigin: config.ignoreNullOrigin
  43131. }, options));
  43132. }
  43133. else {
  43134. transport = strategy_builder_UnsupportedStrategy;
  43135. }
  43136. return transport;
  43137. };
  43138. var strategy_builder_UnsupportedStrategy = {
  43139. isSupported: function () {
  43140. return false;
  43141. },
  43142. connect: function (_, callback) {
  43143. var deferred = util.defer(function () {
  43144. callback(new UnsupportedStrategy());
  43145. });
  43146. return {
  43147. abort: function () {
  43148. deferred.ensureAborted();
  43149. },
  43150. forceMinPriority: function () { }
  43151. };
  43152. }
  43153. };
  43154. // CONCATENATED MODULE: ./src/core/config.ts
  43155. var getGlobalConfig = function () {
  43156. return {
  43157. wsHost: defaults.host,
  43158. wsPort: defaults.ws_port,
  43159. wssPort: defaults.wss_port,
  43160. wsPath: defaults.ws_path,
  43161. httpHost: defaults.sockjs_host,
  43162. httpPort: defaults.sockjs_http_port,
  43163. httpsPort: defaults.sockjs_https_port,
  43164. httpPath: defaults.sockjs_path,
  43165. statsHost: defaults.stats_host,
  43166. authEndpoint: defaults.channel_auth_endpoint,
  43167. authTransport: defaults.channel_auth_transport,
  43168. activity_timeout: defaults.activity_timeout,
  43169. pong_timeout: defaults.pong_timeout,
  43170. unavailable_timeout: defaults.unavailable_timeout
  43171. };
  43172. };
  43173. var getClusterConfig = function (clusterName) {
  43174. return {
  43175. wsHost: 'ws-' + clusterName + '.pusher.com',
  43176. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43177. };
  43178. };
  43179. // CONCATENATED MODULE: ./src/core/pusher.ts
  43180. var pusher_Pusher = (function () {
  43181. function Pusher(app_key, options) {
  43182. var _this = this;
  43183. checkAppKey(app_key);
  43184. options = options || {};
  43185. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43186. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43187. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43188. }
  43189. this.key = app_key;
  43190. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43191. this.channels = factory.createChannels();
  43192. this.global_emitter = new dispatcher();
  43193. this.sessionID = Math.floor(Math.random() * 1000000000);
  43194. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43195. cluster: this.config.cluster,
  43196. features: Pusher.getClientFeatures(),
  43197. params: this.config.timelineParams || {},
  43198. limit: 50,
  43199. level: timeline_level.INFO,
  43200. version: defaults.VERSION
  43201. });
  43202. if (!this.config.disableStats) {
  43203. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43204. host: this.config.statsHost,
  43205. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43206. });
  43207. }
  43208. var getStrategy = function (options) {
  43209. var config = extend({}, _this.config, options);
  43210. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43211. };
  43212. this.connection = factory.createConnectionManager(this.key, extend({
  43213. getStrategy: getStrategy,
  43214. timeline: this.timeline,
  43215. activityTimeout: this.config.activity_timeout,
  43216. pongTimeout: this.config.pong_timeout,
  43217. unavailableTimeout: this.config.unavailable_timeout
  43218. }, this.config, { useTLS: this.shouldUseTLS() }));
  43219. this.connection.bind('connected', function () {
  43220. _this.subscribeAll();
  43221. if (_this.timelineSender) {
  43222. _this.timelineSender.send(_this.connection.isUsingTLS());
  43223. }
  43224. });
  43225. this.connection.bind('message', function (event) {
  43226. var eventName = event.event;
  43227. var internal = eventName.indexOf('pusher_internal:') === 0;
  43228. if (event.channel) {
  43229. var channel = _this.channel(event.channel);
  43230. if (channel) {
  43231. channel.handleEvent(event);
  43232. }
  43233. }
  43234. if (!internal) {
  43235. _this.global_emitter.emit(event.event, event.data);
  43236. }
  43237. });
  43238. this.connection.bind('connecting', function () {
  43239. _this.channels.disconnect();
  43240. });
  43241. this.connection.bind('disconnected', function () {
  43242. _this.channels.disconnect();
  43243. });
  43244. this.connection.bind('error', function (err) {
  43245. logger.warn(err);
  43246. });
  43247. Pusher.instances.push(this);
  43248. this.timeline.info({ instances: Pusher.instances.length });
  43249. if (Pusher.isReady) {
  43250. this.connect();
  43251. }
  43252. }
  43253. Pusher.ready = function () {
  43254. Pusher.isReady = true;
  43255. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43256. Pusher.instances[i].connect();
  43257. }
  43258. };
  43259. Pusher.getClientFeatures = function () {
  43260. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43261. return t.isSupported({});
  43262. }));
  43263. };
  43264. Pusher.prototype.channel = function (name) {
  43265. return this.channels.find(name);
  43266. };
  43267. Pusher.prototype.allChannels = function () {
  43268. return this.channels.all();
  43269. };
  43270. Pusher.prototype.connect = function () {
  43271. this.connection.connect();
  43272. if (this.timelineSender) {
  43273. if (!this.timelineSenderTimer) {
  43274. var usingTLS = this.connection.isUsingTLS();
  43275. var timelineSender = this.timelineSender;
  43276. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43277. timelineSender.send(usingTLS);
  43278. });
  43279. }
  43280. }
  43281. };
  43282. Pusher.prototype.disconnect = function () {
  43283. this.connection.disconnect();
  43284. if (this.timelineSenderTimer) {
  43285. this.timelineSenderTimer.ensureAborted();
  43286. this.timelineSenderTimer = null;
  43287. }
  43288. };
  43289. Pusher.prototype.bind = function (event_name, callback, context) {
  43290. this.global_emitter.bind(event_name, callback, context);
  43291. return this;
  43292. };
  43293. Pusher.prototype.unbind = function (event_name, callback, context) {
  43294. this.global_emitter.unbind(event_name, callback, context);
  43295. return this;
  43296. };
  43297. Pusher.prototype.bind_global = function (callback) {
  43298. this.global_emitter.bind_global(callback);
  43299. return this;
  43300. };
  43301. Pusher.prototype.unbind_global = function (callback) {
  43302. this.global_emitter.unbind_global(callback);
  43303. return this;
  43304. };
  43305. Pusher.prototype.unbind_all = function (callback) {
  43306. this.global_emitter.unbind_all();
  43307. return this;
  43308. };
  43309. Pusher.prototype.subscribeAll = function () {
  43310. var channelName;
  43311. for (channelName in this.channels.channels) {
  43312. if (this.channels.channels.hasOwnProperty(channelName)) {
  43313. this.subscribe(channelName);
  43314. }
  43315. }
  43316. };
  43317. Pusher.prototype.subscribe = function (channel_name) {
  43318. var channel = this.channels.add(channel_name, this);
  43319. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43320. channel.reinstateSubscription();
  43321. }
  43322. else if (!channel.subscriptionPending &&
  43323. this.connection.state === 'connected') {
  43324. channel.subscribe();
  43325. }
  43326. return channel;
  43327. };
  43328. Pusher.prototype.unsubscribe = function (channel_name) {
  43329. var channel = this.channels.find(channel_name);
  43330. if (channel && channel.subscriptionPending) {
  43331. channel.cancelSubscription();
  43332. }
  43333. else {
  43334. channel = this.channels.remove(channel_name);
  43335. if (channel && this.connection.state === 'connected') {
  43336. channel.unsubscribe();
  43337. }
  43338. }
  43339. };
  43340. Pusher.prototype.send_event = function (event_name, data, channel) {
  43341. return this.connection.send_event(event_name, data, channel);
  43342. };
  43343. Pusher.prototype.shouldUseTLS = function () {
  43344. if (runtime.getProtocol() === 'https:') {
  43345. return true;
  43346. }
  43347. else if (this.config.forceTLS === true) {
  43348. return true;
  43349. }
  43350. else {
  43351. return Boolean(this.config.encrypted);
  43352. }
  43353. };
  43354. Pusher.instances = [];
  43355. Pusher.isReady = false;
  43356. Pusher.logToConsole = false;
  43357. Pusher.Runtime = runtime;
  43358. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43359. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43360. Pusher.auth_callbacks = runtime.auth_callbacks;
  43361. return Pusher;
  43362. }());
  43363. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43364. function checkAppKey(key) {
  43365. if (key === null || key === undefined) {
  43366. throw 'You must pass your app key when you instantiate Pusher.';
  43367. }
  43368. }
  43369. runtime.setup(pusher_Pusher);
  43370. /***/ })
  43371. /******/ ]);
  43372. });
  43373. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43374. /***/ }),
  43375. /***/ "./node_modules/setimmediate/setImmediate.js":
  43376. /*!***************************************************!*\
  43377. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43378. \***************************************************/
  43379. /*! no static exports found */
  43380. /***/ (function(module, exports, __webpack_require__) {
  43381. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43382. "use strict";
  43383. if (global.setImmediate) {
  43384. return;
  43385. }
  43386. var nextHandle = 1; // Spec says greater than zero
  43387. var tasksByHandle = {};
  43388. var currentlyRunningATask = false;
  43389. var doc = global.document;
  43390. var registerImmediate;
  43391. function setImmediate(callback) {
  43392. // Callback can either be a function or a string
  43393. if (typeof callback !== "function") {
  43394. callback = new Function("" + callback);
  43395. }
  43396. // Copy function arguments
  43397. var args = new Array(arguments.length - 1);
  43398. for (var i = 0; i < args.length; i++) {
  43399. args[i] = arguments[i + 1];
  43400. }
  43401. // Store and register the task
  43402. var task = { callback: callback, args: args };
  43403. tasksByHandle[nextHandle] = task;
  43404. registerImmediate(nextHandle);
  43405. return nextHandle++;
  43406. }
  43407. function clearImmediate(handle) {
  43408. delete tasksByHandle[handle];
  43409. }
  43410. function run(task) {
  43411. var callback = task.callback;
  43412. var args = task.args;
  43413. switch (args.length) {
  43414. case 0:
  43415. callback();
  43416. break;
  43417. case 1:
  43418. callback(args[0]);
  43419. break;
  43420. case 2:
  43421. callback(args[0], args[1]);
  43422. break;
  43423. case 3:
  43424. callback(args[0], args[1], args[2]);
  43425. break;
  43426. default:
  43427. callback.apply(undefined, args);
  43428. break;
  43429. }
  43430. }
  43431. function runIfPresent(handle) {
  43432. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43433. // So if we're currently running a task, we'll need to delay this invocation.
  43434. if (currentlyRunningATask) {
  43435. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43436. // "too much recursion" error.
  43437. setTimeout(runIfPresent, 0, handle);
  43438. } else {
  43439. var task = tasksByHandle[handle];
  43440. if (task) {
  43441. currentlyRunningATask = true;
  43442. try {
  43443. run(task);
  43444. } finally {
  43445. clearImmediate(handle);
  43446. currentlyRunningATask = false;
  43447. }
  43448. }
  43449. }
  43450. }
  43451. function installNextTickImplementation() {
  43452. registerImmediate = function(handle) {
  43453. process.nextTick(function () { runIfPresent(handle); });
  43454. };
  43455. }
  43456. function canUsePostMessage() {
  43457. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43458. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43459. if (global.postMessage && !global.importScripts) {
  43460. var postMessageIsAsynchronous = true;
  43461. var oldOnMessage = global.onmessage;
  43462. global.onmessage = function() {
  43463. postMessageIsAsynchronous = false;
  43464. };
  43465. global.postMessage("", "*");
  43466. global.onmessage = oldOnMessage;
  43467. return postMessageIsAsynchronous;
  43468. }
  43469. }
  43470. function installPostMessageImplementation() {
  43471. // Installs an event handler on `global` for the `message` event: see
  43472. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43473. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43474. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43475. var onGlobalMessage = function(event) {
  43476. if (event.source === global &&
  43477. typeof event.data === "string" &&
  43478. event.data.indexOf(messagePrefix) === 0) {
  43479. runIfPresent(+event.data.slice(messagePrefix.length));
  43480. }
  43481. };
  43482. if (global.addEventListener) {
  43483. global.addEventListener("message", onGlobalMessage, false);
  43484. } else {
  43485. global.attachEvent("onmessage", onGlobalMessage);
  43486. }
  43487. registerImmediate = function(handle) {
  43488. global.postMessage(messagePrefix + handle, "*");
  43489. };
  43490. }
  43491. function installMessageChannelImplementation() {
  43492. var channel = new MessageChannel();
  43493. channel.port1.onmessage = function(event) {
  43494. var handle = event.data;
  43495. runIfPresent(handle);
  43496. };
  43497. registerImmediate = function(handle) {
  43498. channel.port2.postMessage(handle);
  43499. };
  43500. }
  43501. function installReadyStateChangeImplementation() {
  43502. var html = doc.documentElement;
  43503. registerImmediate = function(handle) {
  43504. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43505. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43506. var script = doc.createElement("script");
  43507. script.onreadystatechange = function () {
  43508. runIfPresent(handle);
  43509. script.onreadystatechange = null;
  43510. html.removeChild(script);
  43511. script = null;
  43512. };
  43513. html.appendChild(script);
  43514. };
  43515. }
  43516. function installSetTimeoutImplementation() {
  43517. registerImmediate = function(handle) {
  43518. setTimeout(runIfPresent, 0, handle);
  43519. };
  43520. }
  43521. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43522. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43523. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43524. // Don't get fooled by e.g. browserify environments.
  43525. if ({}.toString.call(global.process) === "[object process]") {
  43526. // For Node.js before 0.9
  43527. installNextTickImplementation();
  43528. } else if (canUsePostMessage()) {
  43529. // For non-IE10 modern browsers
  43530. installPostMessageImplementation();
  43531. } else if (global.MessageChannel) {
  43532. // For web workers, where supported
  43533. installMessageChannelImplementation();
  43534. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43535. // For IE 6–8
  43536. installReadyStateChangeImplementation();
  43537. } else {
  43538. // For older browsers
  43539. installSetTimeoutImplementation();
  43540. }
  43541. attachTo.setImmediate = setImmediate;
  43542. attachTo.clearImmediate = clearImmediate;
  43543. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43544. /* 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")))
  43545. /***/ }),
  43546. /***/ "./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&":
  43547. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43548. !*** ./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& ***!
  43549. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43550. /*! no static exports found */
  43551. /***/ (function(module, exports, __webpack_require__) {
  43552. 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&");
  43553. if(typeof content === 'string') content = [[module.i, content, '']];
  43554. var transform;
  43555. var insertInto;
  43556. var options = {"hmr":true}
  43557. options.transform = transform
  43558. options.insertInto = undefined;
  43559. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43560. if(content.locals) module.exports = content.locals;
  43561. if(false) {}
  43562. /***/ }),
  43563. /***/ "./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&":
  43564. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43565. !*** ./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& ***!
  43566. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43567. /*! no static exports found */
  43568. /***/ (function(module, exports, __webpack_require__) {
  43569. 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&");
  43570. if(typeof content === 'string') content = [[module.i, content, '']];
  43571. var transform;
  43572. var insertInto;
  43573. var options = {"hmr":true}
  43574. options.transform = transform
  43575. options.insertInto = undefined;
  43576. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43577. if(content.locals) module.exports = content.locals;
  43578. if(false) {}
  43579. /***/ }),
  43580. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43581. /*!****************************************************!*\
  43582. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43583. \****************************************************/
  43584. /*! no static exports found */
  43585. /***/ (function(module, exports, __webpack_require__) {
  43586. /*
  43587. MIT License http://www.opensource.org/licenses/mit-license.php
  43588. Author Tobias Koppers @sokra
  43589. */
  43590. var stylesInDom = {};
  43591. var memoize = function (fn) {
  43592. var memo;
  43593. return function () {
  43594. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43595. return memo;
  43596. };
  43597. };
  43598. var isOldIE = memoize(function () {
  43599. // Test for IE <= 9 as proposed by Browserhacks
  43600. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43601. // Tests for existence of standard globals is to allow style-loader
  43602. // to operate correctly into non-standard environments
  43603. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43604. return window && document && document.all && !window.atob;
  43605. });
  43606. var getTarget = function (target, parent) {
  43607. if (parent){
  43608. return parent.querySelector(target);
  43609. }
  43610. return document.querySelector(target);
  43611. };
  43612. var getElement = (function (fn) {
  43613. var memo = {};
  43614. return function(target, parent) {
  43615. // If passing function in options, then use it for resolve "head" element.
  43616. // Useful for Shadow Root style i.e
  43617. // {
  43618. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43619. // }
  43620. if (typeof target === 'function') {
  43621. return target();
  43622. }
  43623. if (typeof memo[target] === "undefined") {
  43624. var styleTarget = getTarget.call(this, target, parent);
  43625. // Special case to return head of iframe instead of iframe itself
  43626. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43627. try {
  43628. // This will throw an exception if access to iframe is blocked
  43629. // due to cross-origin restrictions
  43630. styleTarget = styleTarget.contentDocument.head;
  43631. } catch(e) {
  43632. styleTarget = null;
  43633. }
  43634. }
  43635. memo[target] = styleTarget;
  43636. }
  43637. return memo[target]
  43638. };
  43639. })();
  43640. var singleton = null;
  43641. var singletonCounter = 0;
  43642. var stylesInsertedAtTop = [];
  43643. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43644. module.exports = function(list, options) {
  43645. if (typeof DEBUG !== "undefined" && DEBUG) {
  43646. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43647. }
  43648. options = options || {};
  43649. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43650. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43651. // tags it will allow on a page
  43652. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43653. // By default, add <style> tags to the <head> element
  43654. if (!options.insertInto) options.insertInto = "head";
  43655. // By default, add <style> tags to the bottom of the target
  43656. if (!options.insertAt) options.insertAt = "bottom";
  43657. var styles = listToStyles(list, options);
  43658. addStylesToDom(styles, options);
  43659. return function update (newList) {
  43660. var mayRemove = [];
  43661. for (var i = 0; i < styles.length; i++) {
  43662. var item = styles[i];
  43663. var domStyle = stylesInDom[item.id];
  43664. domStyle.refs--;
  43665. mayRemove.push(domStyle);
  43666. }
  43667. if(newList) {
  43668. var newStyles = listToStyles(newList, options);
  43669. addStylesToDom(newStyles, options);
  43670. }
  43671. for (var i = 0; i < mayRemove.length; i++) {
  43672. var domStyle = mayRemove[i];
  43673. if(domStyle.refs === 0) {
  43674. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43675. delete stylesInDom[domStyle.id];
  43676. }
  43677. }
  43678. };
  43679. };
  43680. function addStylesToDom (styles, options) {
  43681. for (var i = 0; i < styles.length; i++) {
  43682. var item = styles[i];
  43683. var domStyle = stylesInDom[item.id];
  43684. if(domStyle) {
  43685. domStyle.refs++;
  43686. for(var j = 0; j < domStyle.parts.length; j++) {
  43687. domStyle.parts[j](item.parts[j]);
  43688. }
  43689. for(; j < item.parts.length; j++) {
  43690. domStyle.parts.push(addStyle(item.parts[j], options));
  43691. }
  43692. } else {
  43693. var parts = [];
  43694. for(var j = 0; j < item.parts.length; j++) {
  43695. parts.push(addStyle(item.parts[j], options));
  43696. }
  43697. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43698. }
  43699. }
  43700. }
  43701. function listToStyles (list, options) {
  43702. var styles = [];
  43703. var newStyles = {};
  43704. for (var i = 0; i < list.length; i++) {
  43705. var item = list[i];
  43706. var id = options.base ? item[0] + options.base : item[0];
  43707. var css = item[1];
  43708. var media = item[2];
  43709. var sourceMap = item[3];
  43710. var part = {css: css, media: media, sourceMap: sourceMap};
  43711. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43712. else newStyles[id].parts.push(part);
  43713. }
  43714. return styles;
  43715. }
  43716. function insertStyleElement (options, style) {
  43717. var target = getElement(options.insertInto)
  43718. if (!target) {
  43719. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43720. }
  43721. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43722. if (options.insertAt === "top") {
  43723. if (!lastStyleElementInsertedAtTop) {
  43724. target.insertBefore(style, target.firstChild);
  43725. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43726. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43727. } else {
  43728. target.appendChild(style);
  43729. }
  43730. stylesInsertedAtTop.push(style);
  43731. } else if (options.insertAt === "bottom") {
  43732. target.appendChild(style);
  43733. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43734. var nextSibling = getElement(options.insertAt.before, target);
  43735. target.insertBefore(style, nextSibling);
  43736. } else {
  43737. 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");
  43738. }
  43739. }
  43740. function removeStyleElement (style) {
  43741. if (style.parentNode === null) return false;
  43742. style.parentNode.removeChild(style);
  43743. var idx = stylesInsertedAtTop.indexOf(style);
  43744. if(idx >= 0) {
  43745. stylesInsertedAtTop.splice(idx, 1);
  43746. }
  43747. }
  43748. function createStyleElement (options) {
  43749. var style = document.createElement("style");
  43750. if(options.attrs.type === undefined) {
  43751. options.attrs.type = "text/css";
  43752. }
  43753. if(options.attrs.nonce === undefined) {
  43754. var nonce = getNonce();
  43755. if (nonce) {
  43756. options.attrs.nonce = nonce;
  43757. }
  43758. }
  43759. addAttrs(style, options.attrs);
  43760. insertStyleElement(options, style);
  43761. return style;
  43762. }
  43763. function createLinkElement (options) {
  43764. var link = document.createElement("link");
  43765. if(options.attrs.type === undefined) {
  43766. options.attrs.type = "text/css";
  43767. }
  43768. options.attrs.rel = "stylesheet";
  43769. addAttrs(link, options.attrs);
  43770. insertStyleElement(options, link);
  43771. return link;
  43772. }
  43773. function addAttrs (el, attrs) {
  43774. Object.keys(attrs).forEach(function (key) {
  43775. el.setAttribute(key, attrs[key]);
  43776. });
  43777. }
  43778. function getNonce() {
  43779. if (false) {}
  43780. return __webpack_require__.nc;
  43781. }
  43782. function addStyle (obj, options) {
  43783. var style, update, remove, result;
  43784. // If a transform function was defined, run it on the css
  43785. if (options.transform && obj.css) {
  43786. result = typeof options.transform === 'function'
  43787. ? options.transform(obj.css)
  43788. : options.transform.default(obj.css);
  43789. if (result) {
  43790. // If transform returns a value, use that instead of the original css.
  43791. // This allows running runtime transformations on the css.
  43792. obj.css = result;
  43793. } else {
  43794. // If the transform function returns a falsy value, don't add this css.
  43795. // This allows conditional loading of css
  43796. return function() {
  43797. // noop
  43798. };
  43799. }
  43800. }
  43801. if (options.singleton) {
  43802. var styleIndex = singletonCounter++;
  43803. style = singleton || (singleton = createStyleElement(options));
  43804. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43805. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43806. } else if (
  43807. obj.sourceMap &&
  43808. typeof URL === "function" &&
  43809. typeof URL.createObjectURL === "function" &&
  43810. typeof URL.revokeObjectURL === "function" &&
  43811. typeof Blob === "function" &&
  43812. typeof btoa === "function"
  43813. ) {
  43814. style = createLinkElement(options);
  43815. update = updateLink.bind(null, style, options);
  43816. remove = function () {
  43817. removeStyleElement(style);
  43818. if(style.href) URL.revokeObjectURL(style.href);
  43819. };
  43820. } else {
  43821. style = createStyleElement(options);
  43822. update = applyToTag.bind(null, style);
  43823. remove = function () {
  43824. removeStyleElement(style);
  43825. };
  43826. }
  43827. update(obj);
  43828. return function updateStyle (newObj) {
  43829. if (newObj) {
  43830. if (
  43831. newObj.css === obj.css &&
  43832. newObj.media === obj.media &&
  43833. newObj.sourceMap === obj.sourceMap
  43834. ) {
  43835. return;
  43836. }
  43837. update(obj = newObj);
  43838. } else {
  43839. remove();
  43840. }
  43841. };
  43842. }
  43843. var replaceText = (function () {
  43844. var textStore = [];
  43845. return function (index, replacement) {
  43846. textStore[index] = replacement;
  43847. return textStore.filter(Boolean).join('\n');
  43848. };
  43849. })();
  43850. function applyToSingletonTag (style, index, remove, obj) {
  43851. var css = remove ? "" : obj.css;
  43852. if (style.styleSheet) {
  43853. style.styleSheet.cssText = replaceText(index, css);
  43854. } else {
  43855. var cssNode = document.createTextNode(css);
  43856. var childNodes = style.childNodes;
  43857. if (childNodes[index]) style.removeChild(childNodes[index]);
  43858. if (childNodes.length) {
  43859. style.insertBefore(cssNode, childNodes[index]);
  43860. } else {
  43861. style.appendChild(cssNode);
  43862. }
  43863. }
  43864. }
  43865. function applyToTag (style, obj) {
  43866. var css = obj.css;
  43867. var media = obj.media;
  43868. if(media) {
  43869. style.setAttribute("media", media)
  43870. }
  43871. if(style.styleSheet) {
  43872. style.styleSheet.cssText = css;
  43873. } else {
  43874. while(style.firstChild) {
  43875. style.removeChild(style.firstChild);
  43876. }
  43877. style.appendChild(document.createTextNode(css));
  43878. }
  43879. }
  43880. function updateLink (link, options, obj) {
  43881. var css = obj.css;
  43882. var sourceMap = obj.sourceMap;
  43883. /*
  43884. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43885. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43886. on by default. Otherwise default to the convertToAbsoluteUrls option
  43887. directly
  43888. */
  43889. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43890. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43891. css = fixUrls(css);
  43892. }
  43893. if (sourceMap) {
  43894. // http://stackoverflow.com/a/26603875
  43895. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43896. }
  43897. var blob = new Blob([css], { type: "text/css" });
  43898. var oldSrc = link.href;
  43899. link.href = URL.createObjectURL(blob);
  43900. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43901. }
  43902. /***/ }),
  43903. /***/ "./node_modules/style-loader/lib/urls.js":
  43904. /*!***********************************************!*\
  43905. !*** ./node_modules/style-loader/lib/urls.js ***!
  43906. \***********************************************/
  43907. /*! no static exports found */
  43908. /***/ (function(module, exports) {
  43909. /**
  43910. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43911. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43912. * bundle instead of the current page.
  43913. *
  43914. * One solution is to only use full urls, but that may be impossible.
  43915. *
  43916. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43917. *
  43918. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43919. *
  43920. */
  43921. module.exports = function (css) {
  43922. // get current location
  43923. var location = typeof window !== "undefined" && window.location;
  43924. if (!location) {
  43925. throw new Error("fixUrls requires window.location");
  43926. }
  43927. // blank or null?
  43928. if (!css || typeof css !== "string") {
  43929. return css;
  43930. }
  43931. var baseUrl = location.protocol + "//" + location.host;
  43932. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43933. // convert each url(...)
  43934. /*
  43935. This regular expression is just a way to recursively match brackets within
  43936. a string.
  43937. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43938. ( = Start a capturing group
  43939. (?: = Start a non-capturing group
  43940. [^)(] = Match anything that isn't a parentheses
  43941. | = OR
  43942. \( = Match a start parentheses
  43943. (?: = Start another non-capturing groups
  43944. [^)(]+ = Match anything that isn't a parentheses
  43945. | = OR
  43946. \( = Match a start parentheses
  43947. [^)(]* = Match anything that isn't a parentheses
  43948. \) = Match a end parentheses
  43949. ) = End Group
  43950. *\) = Match anything and then a close parens
  43951. ) = Close non-capturing group
  43952. * = Match anything
  43953. ) = Close capturing group
  43954. \) = Match a close parens
  43955. /gi = Get all matches, not the first. Be case insensitive.
  43956. */
  43957. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43958. // strip quotes (if they exist)
  43959. var unquotedOrigUrl = origUrl
  43960. .trim()
  43961. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43962. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43963. // already a full url? no change
  43964. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43965. return fullMatch;
  43966. }
  43967. // convert the url to a full url
  43968. var newUrl;
  43969. if (unquotedOrigUrl.indexOf("//") === 0) {
  43970. //TODO: should we add protocol?
  43971. newUrl = unquotedOrigUrl;
  43972. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43973. // path should be relative to the base url
  43974. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43975. } else {
  43976. // path should be relative to current directory
  43977. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43978. }
  43979. // send back the fixed url(...)
  43980. return "url(" + JSON.stringify(newUrl) + ")";
  43981. });
  43982. // send back the fixed css
  43983. return fixedCss;
  43984. };
  43985. /***/ }),
  43986. /***/ "./node_modules/timers-browserify/main.js":
  43987. /*!************************************************!*\
  43988. !*** ./node_modules/timers-browserify/main.js ***!
  43989. \************************************************/
  43990. /*! no static exports found */
  43991. /***/ (function(module, exports, __webpack_require__) {
  43992. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43993. (typeof self !== "undefined" && self) ||
  43994. window;
  43995. var apply = Function.prototype.apply;
  43996. // DOM APIs, for completeness
  43997. exports.setTimeout = function() {
  43998. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43999. };
  44000. exports.setInterval = function() {
  44001. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44002. };
  44003. exports.clearTimeout =
  44004. exports.clearInterval = function(timeout) {
  44005. if (timeout) {
  44006. timeout.close();
  44007. }
  44008. };
  44009. function Timeout(id, clearFn) {
  44010. this._id = id;
  44011. this._clearFn = clearFn;
  44012. }
  44013. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44014. Timeout.prototype.close = function() {
  44015. this._clearFn.call(scope, this._id);
  44016. };
  44017. // Does not start the time, just sets up the members needed.
  44018. exports.enroll = function(item, msecs) {
  44019. clearTimeout(item._idleTimeoutId);
  44020. item._idleTimeout = msecs;
  44021. };
  44022. exports.unenroll = function(item) {
  44023. clearTimeout(item._idleTimeoutId);
  44024. item._idleTimeout = -1;
  44025. };
  44026. exports._unrefActive = exports.active = function(item) {
  44027. clearTimeout(item._idleTimeoutId);
  44028. var msecs = item._idleTimeout;
  44029. if (msecs >= 0) {
  44030. item._idleTimeoutId = setTimeout(function onTimeout() {
  44031. if (item._onTimeout)
  44032. item._onTimeout();
  44033. }, msecs);
  44034. }
  44035. };
  44036. // setimmediate attaches itself to the global object
  44037. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44038. // On some exotic environments, it's not clear which object `setimmediate` was
  44039. // able to install onto. Search each possibility in the same order as the
  44040. // `setimmediate` library.
  44041. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44042. (typeof global !== "undefined" && global.setImmediate) ||
  44043. (this && this.setImmediate);
  44044. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44045. (typeof global !== "undefined" && global.clearImmediate) ||
  44046. (this && this.clearImmediate);
  44047. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44048. /***/ }),
  44049. /***/ "./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&":
  44050. /*!************************************************************************************************************************************************************************************************************!*\
  44051. !*** ./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& ***!
  44052. \************************************************************************************************************************************************************************************************************/
  44053. /*! exports provided: render, staticRenderFns */
  44054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44055. "use strict";
  44056. __webpack_require__.r(__webpack_exports__);
  44057. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44059. var render = function() {
  44060. var _vm = this
  44061. var _h = _vm.$createElement
  44062. var _c = _vm._self._c || _h
  44063. return _c(
  44064. "div",
  44065. [
  44066. _c("asset-info-edit-modal", {
  44067. attrs: {
  44068. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44069. "populate-with": _vm.asset
  44070. }
  44071. }),
  44072. _vm._v(" "),
  44073. _c("h4", { staticClass: "text-center" }, [
  44074. _vm._v(
  44075. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44076. ),
  44077. _c("small", { staticClass: "text-muted" }, [
  44078. _vm._v(_vm._s(this.asset.pcnickname))
  44079. ])
  44080. ]),
  44081. _vm._v(" "),
  44082. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44083. _vm._v(" "),
  44084. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44085. _vm._v(" "),
  44086. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44087. _vm._v(" "),
  44088. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44089. _vm._v(" "),
  44090. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44091. _vm._v(" "),
  44092. _c(
  44093. "button",
  44094. {
  44095. staticClass: "btn btn-primary",
  44096. attrs: {
  44097. type: "button",
  44098. "data-toggle": "modal",
  44099. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44100. }
  44101. },
  44102. [_vm._v("Edit")]
  44103. )
  44104. ],
  44105. 1
  44106. )
  44107. }
  44108. var staticRenderFns = []
  44109. render._withStripped = true
  44110. /***/ }),
  44111. /***/ "./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&":
  44112. /*!*********************************************************************************************************************************************************************************************************************!*\
  44113. !*** ./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& ***!
  44114. \*********************************************************************************************************************************************************************************************************************/
  44115. /*! exports provided: render, staticRenderFns */
  44116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44117. "use strict";
  44118. __webpack_require__.r(__webpack_exports__);
  44119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44120. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44121. var render = function() {
  44122. var _vm = this
  44123. var _h = _vm.$createElement
  44124. var _c = _vm._self._c || _h
  44125. return _c(
  44126. "modal",
  44127. {
  44128. attrs: {
  44129. id: _vm.modalId,
  44130. tabindex: "-1",
  44131. role: "dialog",
  44132. "aria-labelledby": _vm.modalId + "Label"
  44133. }
  44134. },
  44135. [
  44136. _c(
  44137. "h5",
  44138. {
  44139. staticClass: "modal-title",
  44140. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44141. slot: "header"
  44142. },
  44143. [_vm._v("\n Edit Work Order Information\n ")]
  44144. ),
  44145. _vm._v(" "),
  44146. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44147. _c("div", { staticClass: "form-group" }, [
  44148. _c("label", { attrs: { for: "manufacturer" } }, [
  44149. _vm._v("Manufacturer")
  44150. ]),
  44151. _vm._v(" "),
  44152. _c("input", {
  44153. directives: [
  44154. {
  44155. name: "model",
  44156. rawName: "v-model",
  44157. value: _vm.asset.pcmanu,
  44158. expression: "asset.pcmanu"
  44159. }
  44160. ],
  44161. staticClass: "form-control",
  44162. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44163. domProps: { value: _vm.asset.pcmanu },
  44164. on: {
  44165. input: function($event) {
  44166. if ($event.target.composing) {
  44167. return
  44168. }
  44169. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44170. }
  44171. }
  44172. })
  44173. ]),
  44174. _vm._v(" "),
  44175. _c("div", { staticClass: "form-group" }, [
  44176. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44177. _vm._v(" "),
  44178. _c("input", {
  44179. directives: [
  44180. {
  44181. name: "model",
  44182. rawName: "v-model",
  44183. value: _vm.asset.pcmake,
  44184. expression: "asset.pcmake"
  44185. }
  44186. ],
  44187. staticClass: "form-control",
  44188. attrs: { type: "text", name: "make", id: "make" },
  44189. domProps: { value: _vm.asset.pcmake },
  44190. on: {
  44191. input: function($event) {
  44192. if ($event.target.composing) {
  44193. return
  44194. }
  44195. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44196. }
  44197. }
  44198. })
  44199. ]),
  44200. _vm._v(" "),
  44201. _c("div", { staticClass: "form-group" }, [
  44202. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44203. _vm._v(" "),
  44204. _c("input", {
  44205. directives: [
  44206. {
  44207. name: "model",
  44208. rawName: "v-model",
  44209. value: _vm.asset.pcnickname,
  44210. expression: "asset.pcnickname"
  44211. }
  44212. ],
  44213. staticClass: "form-control",
  44214. attrs: { type: "text", name: "nickname", id: "nickname" },
  44215. domProps: { value: _vm.asset.pcnickname },
  44216. on: {
  44217. input: function($event) {
  44218. if ($event.target.composing) {
  44219. return
  44220. }
  44221. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44222. }
  44223. }
  44224. })
  44225. ]),
  44226. _vm._v(" "),
  44227. _c("div", { staticClass: "form-group" }, [
  44228. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44229. _vm._v(" "),
  44230. _c("input", {
  44231. directives: [
  44232. {
  44233. name: "model",
  44234. rawName: "v-model",
  44235. value: _vm.asset.pcextra[2],
  44236. expression: "asset.pcextra[2]"
  44237. }
  44238. ],
  44239. staticClass: "form-control",
  44240. attrs: { type: "text", name: "os", id: "os" },
  44241. domProps: { value: _vm.asset.pcextra[2] },
  44242. on: {
  44243. input: function($event) {
  44244. if ($event.target.composing) {
  44245. return
  44246. }
  44247. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44248. }
  44249. }
  44250. })
  44251. ]),
  44252. _vm._v(" "),
  44253. _c("div", { staticClass: "form-group" }, [
  44254. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44255. _vm._v(" "),
  44256. _c("input", {
  44257. directives: [
  44258. {
  44259. name: "model",
  44260. rawName: "v-model",
  44261. value: _vm.asset.pcextra[104],
  44262. expression: "asset.pcextra[104]"
  44263. }
  44264. ],
  44265. staticClass: "form-control",
  44266. attrs: { type: "text", id: "serial", name: "serial" },
  44267. domProps: { value: _vm.asset.pcextra[104] },
  44268. on: {
  44269. input: function($event) {
  44270. if ($event.target.composing) {
  44271. return
  44272. }
  44273. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44274. }
  44275. }
  44276. })
  44277. ]),
  44278. _vm._v(" "),
  44279. _c("div", { staticClass: "form-group" }, [
  44280. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44281. _vm._v(" "),
  44282. _c("input", {
  44283. directives: [
  44284. {
  44285. name: "model",
  44286. rawName: "v-model",
  44287. value: _vm.asset.pcextra[101],
  44288. expression: "asset.pcextra[101]"
  44289. }
  44290. ],
  44291. staticClass: "form-control",
  44292. attrs: { type: "text", id: "cpu", name: "cpu" },
  44293. domProps: { value: _vm.asset.pcextra[101] },
  44294. on: {
  44295. input: function($event) {
  44296. if ($event.target.composing) {
  44297. return
  44298. }
  44299. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44300. }
  44301. }
  44302. })
  44303. ]),
  44304. _vm._v(" "),
  44305. _c("div", { staticClass: "form-group" }, [
  44306. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44307. _vm._v(" "),
  44308. _c("input", {
  44309. directives: [
  44310. {
  44311. name: "model",
  44312. rawName: "v-model",
  44313. value: _vm.asset.pcextra[100],
  44314. expression: "asset.pcextra[100]"
  44315. }
  44316. ],
  44317. staticClass: "form-control",
  44318. attrs: { type: "text", name: "ram", id: "ram" },
  44319. domProps: { value: _vm.asset.pcextra[100] },
  44320. on: {
  44321. input: function($event) {
  44322. if ($event.target.composing) {
  44323. return
  44324. }
  44325. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44326. }
  44327. }
  44328. })
  44329. ]),
  44330. _vm._v(" "),
  44331. _c("div", { staticClass: "form-group" }, [
  44332. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44333. _vm._v(" "),
  44334. _c("input", {
  44335. directives: [
  44336. {
  44337. name: "model",
  44338. rawName: "v-model",
  44339. value: _vm.asset.pcextra[4],
  44340. expression: "asset.pcextra[4]"
  44341. }
  44342. ],
  44343. staticClass: "form-control",
  44344. attrs: { type: "text", name: "graphics", id: "grapics" },
  44345. domProps: { value: _vm.asset.pcextra[4] },
  44346. on: {
  44347. input: function($event) {
  44348. if ($event.target.composing) {
  44349. return
  44350. }
  44351. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44352. }
  44353. }
  44354. })
  44355. ])
  44356. ]),
  44357. _vm._v(" "),
  44358. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44359. _c(
  44360. "button",
  44361. {
  44362. staticClass: "btn btn-secondary",
  44363. attrs: { type: "button", "data-dismiss": "modal" }
  44364. },
  44365. [_vm._v("Close")]
  44366. ),
  44367. _vm._v(" "),
  44368. _c(
  44369. "button",
  44370. {
  44371. staticClass: "btn btn-primary",
  44372. attrs: { type: "button" },
  44373. on: {
  44374. click: function($event) {
  44375. return _vm.updateAsset()
  44376. }
  44377. }
  44378. },
  44379. [
  44380. !_vm.assetSaving
  44381. ? _c("div", [_vm._v("Save")])
  44382. : _c("circle-spinner", { attrs: { size: 2 } })
  44383. ],
  44384. 1
  44385. )
  44386. ])
  44387. ]
  44388. )
  44389. }
  44390. var staticRenderFns = []
  44391. render._withStripped = true
  44392. /***/ }),
  44393. /***/ "./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&":
  44394. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44395. !*** ./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& ***!
  44396. \*****************************************************************************************************************************************************************************************************************************/
  44397. /*! exports provided: render, staticRenderFns */
  44398. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44399. "use strict";
  44400. __webpack_require__.r(__webpack_exports__);
  44401. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44402. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44403. var render = function() {
  44404. var _vm = this
  44405. var _h = _vm.$createElement
  44406. var _c = _vm._self._c || _h
  44407. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44408. _c("div", { staticClass: "input-group" }, [
  44409. _c("input", {
  44410. directives: [
  44411. {
  44412. name: "model",
  44413. rawName: "v-model",
  44414. value: _vm.searchText,
  44415. expression: "searchText"
  44416. }
  44417. ],
  44418. staticClass: "form-control",
  44419. attrs: { type: "text" },
  44420. domProps: { value: _vm.searchText },
  44421. on: {
  44422. input: [
  44423. function($event) {
  44424. if ($event.target.composing) {
  44425. return
  44426. }
  44427. _vm.searchText = $event.target.value
  44428. },
  44429. _vm.searchChanged
  44430. ]
  44431. }
  44432. }),
  44433. _vm._v(" "),
  44434. _c("div", { staticClass: "form-group-append" }, [
  44435. _c(
  44436. "a",
  44437. {
  44438. staticClass: "toggle input-group-text bg-primary text-light",
  44439. on: {
  44440. mousedown: function($event) {
  44441. $event.preventDefault()
  44442. },
  44443. click: function($event) {
  44444. return _vm.setOpen(!_vm.open)
  44445. }
  44446. }
  44447. },
  44448. [
  44449. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44450. _vm._v(" "),
  44451. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44452. ]
  44453. )
  44454. ])
  44455. ]),
  44456. _vm._v(" "),
  44457. _c(
  44458. "ul",
  44459. { staticClass: "suggestion-list list-unstyled" },
  44460. _vm._l(_vm.matches, function(suggestion, index) {
  44461. return _c(
  44462. "li",
  44463. {
  44464. key: index,
  44465. on: {
  44466. mousedown: function($event) {
  44467. $event.preventDefault()
  44468. },
  44469. click: function($event) {
  44470. return _vm.suggestionSelected(suggestion)
  44471. }
  44472. }
  44473. },
  44474. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44475. )
  44476. }),
  44477. 0
  44478. )
  44479. ])
  44480. }
  44481. var staticRenderFns = []
  44482. render._withStripped = true
  44483. /***/ }),
  44484. /***/ "./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&":
  44485. /*!****************************************************************************************************************************************************************************************************************************!*\
  44486. !*** ./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& ***!
  44487. \****************************************************************************************************************************************************************************************************************************/
  44488. /*! exports provided: render, staticRenderFns */
  44489. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44490. "use strict";
  44491. __webpack_require__.r(__webpack_exports__);
  44492. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44493. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44494. var render = function() {
  44495. var _vm = this
  44496. var _h = _vm.$createElement
  44497. var _c = _vm._self._c || _h
  44498. return _c(
  44499. "div",
  44500. {
  44501. staticClass: "loader",
  44502. style: {
  44503. fontSize: _vm.size + "px",
  44504. borderLeft: "1.1em solid " + _vm.color
  44505. }
  44506. },
  44507. [_vm._v("Loading...")]
  44508. )
  44509. }
  44510. var staticRenderFns = []
  44511. render._withStripped = true
  44512. /***/ }),
  44513. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  44514. /*!*************************************************************************************************************************************************************************************************************!*\
  44515. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  44516. \*************************************************************************************************************************************************************************************************************/
  44517. /*! exports provided: render, staticRenderFns */
  44518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44519. "use strict";
  44520. __webpack_require__.r(__webpack_exports__);
  44521. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44522. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44523. var render = function() {
  44524. var _vm = this
  44525. var _h = _vm.$createElement
  44526. var _c = _vm._self._c || _h
  44527. return _c(
  44528. "div",
  44529. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44530. [
  44531. _c("credential-form-modal", {
  44532. attrs: {
  44533. descriptions: _vm.creddescList,
  44534. "modal-id": "credential" + this.data.credid + "editModal",
  44535. populateWith: this.data
  44536. }
  44537. }),
  44538. _vm._v(" "),
  44539. _c(
  44540. "modal",
  44541. {
  44542. attrs: {
  44543. id: "credential" + this.data.credid + "deleteModal",
  44544. tabindex: "-1"
  44545. }
  44546. },
  44547. [
  44548. _c(
  44549. "h5",
  44550. {
  44551. staticClass: "modal-title",
  44552. attrs: {
  44553. slot: "header",
  44554. id: "credential" + this.data.credid + "deleteModalLabel"
  44555. },
  44556. slot: "header"
  44557. },
  44558. [_vm._v("\r\n Delete Credential\r\n ")]
  44559. ),
  44560. _vm._v(" "),
  44561. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44562. _vm._v("\r\n Are you sure?\r\n ")
  44563. ]),
  44564. _vm._v(" "),
  44565. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44566. _c(
  44567. "button",
  44568. {
  44569. staticClass: "btn btn-secondary",
  44570. attrs: { type: "button", "data-dismiss": "modal" }
  44571. },
  44572. [_vm._v("Cancel")]
  44573. ),
  44574. _vm._v(" "),
  44575. _c(
  44576. "button",
  44577. {
  44578. staticClass: "btn btn-danger",
  44579. attrs: { type: "button" },
  44580. on: {
  44581. click: function($event) {
  44582. return _vm.deleteCredential()
  44583. }
  44584. }
  44585. },
  44586. [_vm._v("Confirm")]
  44587. )
  44588. ])
  44589. ]
  44590. ),
  44591. _vm._v(" "),
  44592. _c("div", { staticClass: "row no-gutters" }, [
  44593. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44594. _vm._v(_vm._s(this.data.creddesc))
  44595. ]),
  44596. _vm._v(" "),
  44597. _c("div", { staticClass: "col-9 text-right" }, [
  44598. _vm._v(_vm._s(this.data.creddate))
  44599. ])
  44600. ]),
  44601. _vm._v(" "),
  44602. _c("div", { staticClass: "row" }, [
  44603. _c("div", { staticClass: "col-lg-9" }, [
  44604. _c("div", [
  44605. _vm._m(0),
  44606. _vm._v(" "),
  44607. _c("input", {
  44608. staticClass: "border-0 credential",
  44609. attrs: {
  44610. type: "text",
  44611. id: "username" + this.data.credid,
  44612. readonly: ""
  44613. },
  44614. domProps: { value: this.data.creduser }
  44615. }),
  44616. _vm._v(" "),
  44617. _c(
  44618. "button",
  44619. {
  44620. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44621. attrs: {
  44622. id: "btn-username" + this.data.credid,
  44623. "data-clipboard-target": "#username" + this.data.credid
  44624. }
  44625. },
  44626. [_c("i", { staticClass: "far fa-clone" })]
  44627. )
  44628. ]),
  44629. _vm._v(" "),
  44630. _c("div", [
  44631. _vm._m(1),
  44632. _vm._v(" "),
  44633. _c("input", {
  44634. staticClass: "border-0 credential",
  44635. attrs: {
  44636. type: "text",
  44637. id: "password" + this.data.credid,
  44638. readonly: ""
  44639. },
  44640. domProps: { value: this.data.credpass }
  44641. }),
  44642. _vm._v(" "),
  44643. _c(
  44644. "button",
  44645. {
  44646. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44647. attrs: {
  44648. id: "btn-password" + this.data.credid,
  44649. "data-clipboard-target": "#password" + this.data.credid
  44650. }
  44651. },
  44652. [_c("i", { staticClass: "far fa-clone" })]
  44653. )
  44654. ])
  44655. ]),
  44656. _vm._v(" "),
  44657. _c(
  44658. "div",
  44659. {
  44660. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44661. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44662. },
  44663. [
  44664. _c(
  44665. "button",
  44666. {
  44667. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44668. attrs: {
  44669. type: "button",
  44670. "data-toggle": "modal",
  44671. "data-target": "#credential" + this.data.credid + "editModal"
  44672. }
  44673. },
  44674. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44675. ),
  44676. _vm._v(" "),
  44677. _c(
  44678. "button",
  44679. {
  44680. staticClass: "btn btn-sm btn-danger p-lg-1",
  44681. attrs: {
  44682. type: "button",
  44683. "data-toggle": "modal",
  44684. "data-target":
  44685. "#credential" + this.data.credid + "deleteModal"
  44686. }
  44687. },
  44688. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44689. )
  44690. ]
  44691. )
  44692. ])
  44693. ],
  44694. 1
  44695. )
  44696. }
  44697. var staticRenderFns = [
  44698. function() {
  44699. var _vm = this
  44700. var _h = _vm.$createElement
  44701. var _c = _vm._self._c || _h
  44702. return _c("label", { attrs: { for: "username" } }, [
  44703. _c("i", { staticClass: "fas fa-fw fa-user" })
  44704. ])
  44705. },
  44706. function() {
  44707. var _vm = this
  44708. var _h = _vm.$createElement
  44709. var _c = _vm._self._c || _h
  44710. return _c("label", { attrs: { for: "password" } }, [
  44711. _c("i", { staticClass: "fas fa-fw fa-key" })
  44712. ])
  44713. }
  44714. ]
  44715. render._withStripped = true
  44716. /***/ }),
  44717. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  44718. /*!**********************************************************************************************************************************************************************************************************************!*\
  44719. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  44720. \**********************************************************************************************************************************************************************************************************************/
  44721. /*! exports provided: render, staticRenderFns */
  44722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44723. "use strict";
  44724. __webpack_require__.r(__webpack_exports__);
  44725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44727. var render = function() {
  44728. var _vm = this
  44729. var _h = _vm.$createElement
  44730. var _c = _vm._self._c || _h
  44731. return _c(
  44732. "modal",
  44733. {
  44734. attrs: {
  44735. id: _vm.id,
  44736. tabindex: "-1",
  44737. role: "dialog",
  44738. "aria-labelledby": _vm.id + "Label"
  44739. }
  44740. },
  44741. [
  44742. _c(
  44743. "h5",
  44744. {
  44745. staticClass: "modal-title",
  44746. attrs: { slot: "header", id: _vm.id + "Label" },
  44747. slot: "header"
  44748. },
  44749. [_vm._v("\n Edit Credential\n ")]
  44750. ),
  44751. _vm._v(" "),
  44752. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44753. _c(
  44754. "div",
  44755. { staticClass: "form" },
  44756. [
  44757. _c("autocomplete-custom-dropdown", {
  44758. attrs: {
  44759. options: _vm.descriptions,
  44760. value: _vm.creddesc,
  44761. "allow-custom": true
  44762. },
  44763. model: {
  44764. value: _vm.creddesc,
  44765. callback: function($$v) {
  44766. _vm.creddesc = $$v
  44767. },
  44768. expression: "creddesc"
  44769. }
  44770. })
  44771. ],
  44772. 1
  44773. ),
  44774. _vm._v(" "),
  44775. _c("div", { staticClass: "form-group" }, [
  44776. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  44777. _vm._v(" "),
  44778. _c("input", {
  44779. directives: [
  44780. {
  44781. name: "model",
  44782. rawName: "v-model",
  44783. value: _vm.data.creduser,
  44784. expression: "data.creduser"
  44785. }
  44786. ],
  44787. staticClass: "form-control credential",
  44788. attrs: {
  44789. type: "text",
  44790. name: "newusername" + _vm.data.credid,
  44791. id: "newusername" + _vm.data.credid
  44792. },
  44793. domProps: { value: _vm.data.creduser },
  44794. on: {
  44795. input: function($event) {
  44796. if ($event.target.composing) {
  44797. return
  44798. }
  44799. _vm.$set(_vm.data, "creduser", $event.target.value)
  44800. }
  44801. }
  44802. })
  44803. ]),
  44804. _vm._v(" "),
  44805. _c("div", { staticClass: "form-group" }, [
  44806. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  44807. _vm._v(" "),
  44808. _c("input", {
  44809. directives: [
  44810. {
  44811. name: "model",
  44812. rawName: "v-model",
  44813. value: _vm.data.credpass,
  44814. expression: "data.credpass"
  44815. }
  44816. ],
  44817. staticClass: "form-control credential",
  44818. attrs: {
  44819. type: "text",
  44820. name: "newpassword" + _vm.data.credid,
  44821. id: "newpassword" + _vm.data.credid
  44822. },
  44823. domProps: { value: _vm.data.credpass },
  44824. on: {
  44825. input: function($event) {
  44826. if ($event.target.composing) {
  44827. return
  44828. }
  44829. _vm.$set(_vm.data, "credpass", $event.target.value)
  44830. }
  44831. }
  44832. }),
  44833. _vm._v(" "),
  44834. _c(
  44835. "button",
  44836. {
  44837. staticClass: "btn btn-secondary",
  44838. attrs: { type: "button" },
  44839. on: {
  44840. click: function($event) {
  44841. return _vm.getRandomPassword(_vm.data.credid)
  44842. }
  44843. }
  44844. },
  44845. [_vm._v("Generate Random")]
  44846. )
  44847. ]),
  44848. _vm._v(" "),
  44849. _c("div", { staticClass: "form-group" })
  44850. ]),
  44851. _vm._v(" "),
  44852. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44853. _c(
  44854. "button",
  44855. {
  44856. staticClass: "btn btn-secondary",
  44857. attrs: { type: "button", "data-dismiss": "modal" }
  44858. },
  44859. [_vm._v("Close")]
  44860. ),
  44861. _vm._v(" "),
  44862. _c(
  44863. "button",
  44864. {
  44865. staticClass: "btn btn-primary",
  44866. attrs: { type: "button" },
  44867. on: {
  44868. click: function($event) {
  44869. return _vm.updateCredential()
  44870. }
  44871. }
  44872. },
  44873. [_vm._v("Save")]
  44874. )
  44875. ])
  44876. ]
  44877. )
  44878. }
  44879. var staticRenderFns = []
  44880. render._withStripped = true
  44881. /***/ }),
  44882. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  44883. /*!*****************************************************************************************************************************************************************************************************************!*\
  44884. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  44885. \*****************************************************************************************************************************************************************************************************************/
  44886. /*! exports provided: render, staticRenderFns */
  44887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44888. "use strict";
  44889. __webpack_require__.r(__webpack_exports__);
  44890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44891. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44892. var render = function() {
  44893. var _vm = this
  44894. var _h = _vm.$createElement
  44895. var _c = _vm._self._c || _h
  44896. return _c(
  44897. "div",
  44898. [
  44899. _c("credential-form-modal", {
  44900. attrs: {
  44901. "modal-id": "newCredentialModal",
  44902. descriptions: _vm.creddescList,
  44903. create: true,
  44904. pcid: _vm.pcid
  44905. }
  44906. }),
  44907. _vm._v(" "),
  44908. _c(
  44909. "button",
  44910. {
  44911. staticClass: "btn btn-primary",
  44912. attrs: {
  44913. type: "button",
  44914. "data-toggle": "modal",
  44915. "data-target": "#newCredentialModal"
  44916. }
  44917. },
  44918. [_vm._v("New Credential")]
  44919. ),
  44920. _vm._v(" "),
  44921. _vm._l(_vm.credentials, function(credential) {
  44922. return _c(
  44923. "div",
  44924. { key: credential.credid },
  44925. [
  44926. _c("credential", {
  44927. attrs: { credential: credential, descriptions: _vm.creddescList }
  44928. })
  44929. ],
  44930. 1
  44931. )
  44932. })
  44933. ],
  44934. 2
  44935. )
  44936. }
  44937. var staticRenderFns = []
  44938. render._withStripped = true
  44939. /***/ }),
  44940. /***/ "./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&":
  44941. /*!********************************************************************************************************************************************************************************************************!*\
  44942. !*** ./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& ***!
  44943. \********************************************************************************************************************************************************************************************************/
  44944. /*! exports provided: render, staticRenderFns */
  44945. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44946. "use strict";
  44947. __webpack_require__.r(__webpack_exports__);
  44948. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44949. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44950. var render = function() {
  44951. var _vm = this
  44952. var _h = _vm.$createElement
  44953. var _c = _vm._self._c || _h
  44954. return _c("div", { staticClass: "modal fade" }, [
  44955. _c(
  44956. "div",
  44957. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44958. [
  44959. _c("div", { staticClass: "modal-content" }, [
  44960. _c(
  44961. "div",
  44962. { staticClass: "modal-header" },
  44963. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44964. 2
  44965. ),
  44966. _vm._v(" "),
  44967. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44968. _vm._v(" "),
  44969. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44970. ])
  44971. ]
  44972. )
  44973. ])
  44974. }
  44975. var staticRenderFns = [
  44976. function() {
  44977. var _vm = this
  44978. var _h = _vm.$createElement
  44979. var _c = _vm._self._c || _h
  44980. return _c(
  44981. "button",
  44982. {
  44983. staticClass: "close",
  44984. attrs: {
  44985. type: "button",
  44986. "data-dismiss": "modal",
  44987. "aria-label": "Close"
  44988. }
  44989. },
  44990. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44991. )
  44992. }
  44993. ]
  44994. render._withStripped = true
  44995. /***/ }),
  44996. /***/ "./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&":
  44997. /*!******************************************************************************************************************************************************************************************************************!*\
  44998. !*** ./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& ***!
  44999. \******************************************************************************************************************************************************************************************************************/
  45000. /*! exports provided: render, staticRenderFns */
  45001. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45002. "use strict";
  45003. __webpack_require__.r(__webpack_exports__);
  45004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45005. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45006. var render = function() {
  45007. var _vm = this
  45008. var _h = _vm.$createElement
  45009. var _c = _vm._self._c || _h
  45010. return _c(
  45011. "modal",
  45012. {
  45013. attrs: {
  45014. id: _vm.id,
  45015. tabindex: "-1",
  45016. role: "dialog",
  45017. "aria-labelledby": _vm.id + "Label"
  45018. }
  45019. },
  45020. [
  45021. _c(
  45022. "h5",
  45023. {
  45024. staticClass: "modal-title",
  45025. attrs: { slot: "header", id: _vm.id + "Label" },
  45026. slot: "header"
  45027. },
  45028. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45029. ),
  45030. _vm._v(" "),
  45031. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45032. _c(
  45033. "div",
  45034. { staticClass: "form-group" },
  45035. [
  45036. _c("label", { attrs: { for: "probdesc" } }, [
  45037. _vm._v("Problem Description")
  45038. ]),
  45039. _vm._v(" "),
  45040. _c("textarea", {
  45041. directives: [
  45042. {
  45043. name: "model",
  45044. rawName: "v-model",
  45045. value: _vm.data.probdesc,
  45046. expression: "data.probdesc"
  45047. }
  45048. ],
  45049. class: {
  45050. "form-control": true,
  45051. "is-invalid": _vm.errors.probdesc
  45052. },
  45053. attrs: { id: "probdesc", name: "probdesc" },
  45054. domProps: { value: _vm.data.probdesc },
  45055. on: {
  45056. input: function($event) {
  45057. if ($event.target.composing) {
  45058. return
  45059. }
  45060. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45061. }
  45062. }
  45063. }),
  45064. _vm._v(" "),
  45065. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  45066. ],
  45067. 1
  45068. ),
  45069. _vm._v(" "),
  45070. _c(
  45071. "div",
  45072. { staticClass: "form-group" },
  45073. [
  45074. _c("label", { attrs: { for: "suggested" } }, [
  45075. _vm._v("Suggested Solution")
  45076. ]),
  45077. _vm._v(" "),
  45078. _c("textarea", {
  45079. directives: [
  45080. {
  45081. name: "model",
  45082. rawName: "v-model",
  45083. value: _vm.data.suggested,
  45084. expression: "data.suggested"
  45085. }
  45086. ],
  45087. class: {
  45088. "form-control": true,
  45089. "is-invalid": _vm.errors.suggested
  45090. },
  45091. attrs: { id: "suggested", name: "suggested" },
  45092. domProps: { value: _vm.data.suggested },
  45093. on: {
  45094. input: function($event) {
  45095. if ($event.target.composing) {
  45096. return
  45097. }
  45098. _vm.$set(_vm.data, "suggested", $event.target.value)
  45099. }
  45100. }
  45101. }),
  45102. _vm._v(" "),
  45103. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  45104. ],
  45105. 1
  45106. ),
  45107. _vm._v(" "),
  45108. _c(
  45109. "div",
  45110. { staticClass: "form-group" },
  45111. [
  45112. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45113. _vm._v(" "),
  45114. _c("autocomplete-custom-dropdown", {
  45115. attrs: { options: _vm.storeList, value: this.store },
  45116. model: {
  45117. value: _vm.store,
  45118. callback: function($$v) {
  45119. _vm.store = $$v
  45120. },
  45121. expression: "store"
  45122. }
  45123. })
  45124. ],
  45125. 1
  45126. )
  45127. ]),
  45128. _vm._v(" "),
  45129. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45130. _c(
  45131. "button",
  45132. {
  45133. staticClass: "btn btn-secondary",
  45134. attrs: { type: "button", "data-dismiss": "modal" }
  45135. },
  45136. [_vm._v("Close")]
  45137. ),
  45138. _vm._v(" "),
  45139. _c(
  45140. "button",
  45141. {
  45142. staticClass: "btn btn-primary",
  45143. attrs: { type: "button" },
  45144. on: {
  45145. click: function($event) {
  45146. return _vm.updateWorkOrder()
  45147. }
  45148. }
  45149. },
  45150. [_vm._v("Save")]
  45151. )
  45152. ])
  45153. ]
  45154. )
  45155. }
  45156. var staticRenderFns = []
  45157. render._withStripped = true
  45158. /***/ }),
  45159. /***/ "./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&":
  45160. /*!****************************************************************************************************************************************************************************************************************!*\
  45161. !*** ./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& ***!
  45162. \****************************************************************************************************************************************************************************************************************/
  45163. /*! exports provided: render, staticRenderFns */
  45164. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45165. "use strict";
  45166. __webpack_require__.r(__webpack_exports__);
  45167. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45168. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45169. var render = function() {
  45170. var _vm = this
  45171. var _h = _vm.$createElement
  45172. var _c = _vm._self._c || _h
  45173. return _c(
  45174. "div",
  45175. [
  45176. _c("wo-info-edit-modal", {
  45177. attrs: {
  45178. "modal-id": "workordereditModal",
  45179. "populate-with": _vm.workOrder,
  45180. "store-list": this.storeList
  45181. }
  45182. }),
  45183. _vm._v(" "),
  45184. _c("p", [
  45185. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45186. _vm._v(" "),
  45187. _c("span", {
  45188. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45189. })
  45190. ]),
  45191. _vm._v(" "),
  45192. _c("p", [
  45193. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45194. _vm._v(" "),
  45195. _c("span", {
  45196. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45197. })
  45198. ]),
  45199. _vm._v(" "),
  45200. _c("p", [
  45201. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45202. _vm._v(" "),
  45203. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45204. ]),
  45205. _vm._v(" "),
  45206. _c("p", [
  45207. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45208. _vm._v(" "),
  45209. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45210. ]),
  45211. _vm._v(" "),
  45212. _c("p", [
  45213. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45214. _vm._v(" "),
  45215. _c(
  45216. "span",
  45217. {
  45218. staticClass: "dashed-underline",
  45219. attrs: {
  45220. "data-toggle": "tooltip",
  45221. "data-placement": "bottom",
  45222. title: this.getHRDate(_vm.workOrder.dropdate)
  45223. }
  45224. },
  45225. [
  45226. _vm._v(
  45227. "\n " +
  45228. _vm._s(
  45229. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45230. ) +
  45231. " days ago\n "
  45232. )
  45233. ]
  45234. )
  45235. ]),
  45236. _vm._v(" "),
  45237. _c("p", [
  45238. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45239. _vm._v(" "),
  45240. !this.isZero(_vm.workOrder.pickupdate)
  45241. ? _c(
  45242. "span",
  45243. {
  45244. staticClass: "dashed-underline",
  45245. attrs: {
  45246. "data-toggle": "tooltip",
  45247. "data-placement": "bottom",
  45248. title: this.getHRDate(_vm.workOrder.pickupdate)
  45249. }
  45250. },
  45251. [
  45252. _vm._v(
  45253. "\n " +
  45254. _vm._s(
  45255. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45256. ) +
  45257. " days ago\n "
  45258. )
  45259. ]
  45260. )
  45261. : _vm._e()
  45262. ]),
  45263. _vm._v(" "),
  45264. _c(
  45265. "button",
  45266. {
  45267. staticClass: "btn btn-primary",
  45268. attrs: {
  45269. type: "button",
  45270. "data-toggle": "modal",
  45271. "data-target": "#workordereditModal"
  45272. }
  45273. },
  45274. [_vm._v("Edit")]
  45275. )
  45276. ],
  45277. 1
  45278. )
  45279. }
  45280. var staticRenderFns = []
  45281. render._withStripped = true
  45282. /***/ }),
  45283. /***/ "./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&":
  45284. /*!*************************************************************************************************************************************************************************************************!*\
  45285. !*** ./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& ***!
  45286. \*************************************************************************************************************************************************************************************************/
  45287. /*! exports provided: render, staticRenderFns */
  45288. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45289. "use strict";
  45290. __webpack_require__.r(__webpack_exports__);
  45291. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45293. var render = function() {
  45294. var _vm = this
  45295. var _h = _vm.$createElement
  45296. var _c = _vm._self._c || _h
  45297. return _c("div", [
  45298. _c(
  45299. "nav",
  45300. {
  45301. staticClass:
  45302. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45303. },
  45304. [
  45305. _c(
  45306. "div",
  45307. { staticClass: "container-fluid" },
  45308. [
  45309. _c(
  45310. "router-link",
  45311. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45312. [_vm._v("\n UPCCRT\n ")]
  45313. ),
  45314. _vm._v(" "),
  45315. _vm._m(0),
  45316. _vm._v(" "),
  45317. _c(
  45318. "div",
  45319. {
  45320. staticClass: "collapse navbar-collapse",
  45321. attrs: { id: "navbarSupportedContent" }
  45322. },
  45323. [
  45324. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45325. _vm._m(1),
  45326. _vm._v(" "),
  45327. _vm._m(2),
  45328. _vm._v(" "),
  45329. _c(
  45330. "li",
  45331. { staticClass: "nav-item" },
  45332. [
  45333. _c(
  45334. "router-link",
  45335. {
  45336. staticClass: "nav-link",
  45337. attrs: { to: { name: "dashboard" } }
  45338. },
  45339. [
  45340. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45341. _vm._v(" "),
  45342. _c(
  45343. "span",
  45344. { staticClass: "d-none d-sm-block d-md-inline" },
  45345. [_vm._v("Dashboard")]
  45346. )
  45347. ]
  45348. )
  45349. ],
  45350. 1
  45351. ),
  45352. _vm._v(" "),
  45353. _vm._m(3)
  45354. ]),
  45355. _vm._v(" "),
  45356. _c(
  45357. "ul",
  45358. { staticClass: "navbar-nav ml-auto" },
  45359. [
  45360. !_vm.isLoggedIn
  45361. ? _c(
  45362. "router-link",
  45363. {
  45364. staticClass: "nav-link",
  45365. attrs: { to: { name: "login" } }
  45366. },
  45367. [_vm._v("Login")]
  45368. )
  45369. : _vm._e(),
  45370. _vm._v(" "),
  45371. _vm.isLoggedIn
  45372. ? _c("li", { staticClass: "nav-link" }, [
  45373. _vm._v(_vm._s(_vm.username))
  45374. ])
  45375. : _vm._e(),
  45376. _vm._v(" "),
  45377. _vm.isLoggedIn
  45378. ? _c(
  45379. "router-link",
  45380. {
  45381. staticClass: "nav-link",
  45382. attrs: { to: { name: "home" } }
  45383. },
  45384. [_vm._v("Home")]
  45385. )
  45386. : _vm._e()
  45387. ],
  45388. 1
  45389. )
  45390. ]
  45391. )
  45392. ],
  45393. 1
  45394. )
  45395. ]
  45396. ),
  45397. _vm._v(" "),
  45398. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  45399. ])
  45400. }
  45401. var staticRenderFns = [
  45402. function() {
  45403. var _vm = this
  45404. var _h = _vm.$createElement
  45405. var _c = _vm._self._c || _h
  45406. return _c(
  45407. "button",
  45408. {
  45409. staticClass: "navbar-toggler",
  45410. attrs: {
  45411. type: "button",
  45412. "data-toggle": "collapse",
  45413. "data-target": "#navbarSupportedContent",
  45414. "aria-controls": "navbarSupportedContent",
  45415. "aria-expanded": "false"
  45416. }
  45417. },
  45418. [_c("span", { staticClass: "navbar-toggler-icon" })]
  45419. )
  45420. },
  45421. function() {
  45422. var _vm = this
  45423. var _h = _vm.$createElement
  45424. var _c = _vm._self._c || _h
  45425. return _c("li", { staticClass: "nav-item" }, [
  45426. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45427. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  45428. _vm._v(" "),
  45429. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45430. _vm._v("Check-In")
  45431. ])
  45432. ])
  45433. ])
  45434. },
  45435. function() {
  45436. var _vm = this
  45437. var _h = _vm.$createElement
  45438. var _c = _vm._self._c || _h
  45439. return _c("li", { staticClass: "nav-item" }, [
  45440. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45441. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45442. _vm._v(" "),
  45443. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45444. _vm._v("Check-Out")
  45445. ])
  45446. ])
  45447. ])
  45448. },
  45449. function() {
  45450. var _vm = this
  45451. var _h = _vm.$createElement
  45452. var _c = _vm._self._c || _h
  45453. return _c("li", { staticClass: "nav-item" }, [
  45454. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45455. _c("i", { staticClass: "fas fa-chart-bar" }),
  45456. _vm._v(" "),
  45457. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45458. _vm._v("Reports")
  45459. ])
  45460. ])
  45461. ])
  45462. }
  45463. ]
  45464. render._withStripped = true
  45465. /***/ }),
  45466. /***/ "./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&":
  45467. /*!*******************************************************************************************************************************************************************************************************!*\
  45468. !*** ./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& ***!
  45469. \*******************************************************************************************************************************************************************************************************/
  45470. /*! exports provided: render, staticRenderFns */
  45471. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45472. "use strict";
  45473. __webpack_require__.r(__webpack_exports__);
  45474. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45475. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45476. var render = function() {
  45477. var _vm = this
  45478. var _h = _vm.$createElement
  45479. var _c = _vm._self._c || _h
  45480. return _c("div", { staticClass: "container" }, [
  45481. _c("div", { staticClass: "row justify-content-center" }, [
  45482. !_vm.isLoading
  45483. ? _c(
  45484. "div",
  45485. { staticClass: "col-md-12" },
  45486. _vm._l(_vm.workOrders, function(workOrder, index) {
  45487. return _c(
  45488. "div",
  45489. { key: workOrder.woid, staticClass: "col-md-4" },
  45490. [
  45491. _c("div", { staticClass: "card" }, [
  45492. _c(
  45493. "div",
  45494. { staticClass: "card-header" },
  45495. [
  45496. _c(
  45497. "router-link",
  45498. {
  45499. staticClass: "h4 card-title",
  45500. attrs: {
  45501. to: {
  45502. name: "workorders",
  45503. params: { id: workOrder.woid }
  45504. }
  45505. }
  45506. },
  45507. [_vm._v(_vm._s(workOrder.woid))]
  45508. )
  45509. ],
  45510. 1
  45511. ),
  45512. _vm._v(" "),
  45513. _c("div", { staticClass: "card-body card-body-dark" }, [
  45514. _c("div", [
  45515. _vm._v(
  45516. "\n " +
  45517. _vm._s(workOrder.probdesc) +
  45518. "\n "
  45519. )
  45520. ]),
  45521. _vm._v(" "),
  45522. _c("div", [
  45523. _vm._v(
  45524. "\n " +
  45525. _vm._s(workOrder.suggested) +
  45526. "\n "
  45527. )
  45528. ])
  45529. ])
  45530. ])
  45531. ]
  45532. )
  45533. }),
  45534. 0
  45535. )
  45536. : _c(
  45537. "div",
  45538. { staticClass: "col-md-12" },
  45539. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  45540. 1
  45541. )
  45542. ])
  45543. ])
  45544. }
  45545. var staticRenderFns = []
  45546. render._withStripped = true
  45547. /***/ }),
  45548. /***/ "./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&":
  45549. /*!***************************************************************************************************************************************************************************************************!*\
  45550. !*** ./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& ***!
  45551. \***************************************************************************************************************************************************************************************************/
  45552. /*! exports provided: render, staticRenderFns */
  45553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45554. "use strict";
  45555. __webpack_require__.r(__webpack_exports__);
  45556. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45557. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45558. var render = function() {
  45559. var _vm = this
  45560. var _h = _vm.$createElement
  45561. var _c = _vm._self._c || _h
  45562. return _c("div", { staticClass: "container" }, [
  45563. _c("div", { staticClass: "row justify-content-center" }, [
  45564. _c("div", { staticClass: "col-md-8" }, [
  45565. _c("div", { staticClass: "card card-default" }, [
  45566. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  45567. _vm._v(" "),
  45568. _c("div", { staticClass: "card-body" }, [
  45569. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  45570. _c("div", { staticClass: "form-group row" }, [
  45571. _c(
  45572. "label",
  45573. {
  45574. staticClass: "col-sm-4 col-form-label text-md-right",
  45575. attrs: { for: "username" }
  45576. },
  45577. [_vm._v("Username")]
  45578. ),
  45579. _vm._v(" "),
  45580. _c("div", { staticClass: "col-md-6" }, [
  45581. _c("input", {
  45582. directives: [
  45583. {
  45584. name: "model",
  45585. rawName: "v-model",
  45586. value: _vm.username,
  45587. expression: "username"
  45588. }
  45589. ],
  45590. staticClass: "form-control",
  45591. attrs: {
  45592. id: "username",
  45593. type: "username",
  45594. required: "",
  45595. autofocus: ""
  45596. },
  45597. domProps: { value: _vm.username },
  45598. on: {
  45599. input: function($event) {
  45600. if ($event.target.composing) {
  45601. return
  45602. }
  45603. _vm.username = $event.target.value
  45604. }
  45605. }
  45606. })
  45607. ])
  45608. ]),
  45609. _vm._v(" "),
  45610. _c("div", { staticClass: "form-group row" }, [
  45611. _c(
  45612. "label",
  45613. {
  45614. staticClass: "col-md-4 col-form-label text-md-right",
  45615. attrs: { for: "password" }
  45616. },
  45617. [_vm._v("Password")]
  45618. ),
  45619. _vm._v(" "),
  45620. _c("div", { staticClass: "col-md-6" }, [
  45621. _c("input", {
  45622. directives: [
  45623. {
  45624. name: "model",
  45625. rawName: "v-model",
  45626. value: _vm.password,
  45627. expression: "password"
  45628. }
  45629. ],
  45630. staticClass: "form-control",
  45631. attrs: { id: "password", type: "password", required: "" },
  45632. domProps: { value: _vm.password },
  45633. on: {
  45634. input: function($event) {
  45635. if ($event.target.composing) {
  45636. return
  45637. }
  45638. _vm.password = $event.target.value
  45639. }
  45640. }
  45641. })
  45642. ])
  45643. ]),
  45644. _vm._v(" "),
  45645. _c("div", { staticClass: "form-group row mb-0" }, [
  45646. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  45647. _c(
  45648. "button",
  45649. {
  45650. staticClass: "btn btn-primary",
  45651. attrs: { type: "submit" },
  45652. on: { click: _vm.handleSubmit }
  45653. },
  45654. [
  45655. _vm._v(
  45656. "\n Login\n "
  45657. )
  45658. ]
  45659. )
  45660. ])
  45661. ])
  45662. ])
  45663. ])
  45664. ])
  45665. ])
  45666. ])
  45667. ])
  45668. }
  45669. var staticRenderFns = []
  45670. render._withStripped = true
  45671. /***/ }),
  45672. /***/ "./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&":
  45673. /*!*****************************************************************************************************************************************************************************************************************!*\
  45674. !*** ./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& ***!
  45675. \*****************************************************************************************************************************************************************************************************************/
  45676. /*! exports provided: render, staticRenderFns */
  45677. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45678. "use strict";
  45679. __webpack_require__.r(__webpack_exports__);
  45680. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45682. var render = function() {
  45683. var _vm = this
  45684. var _h = _vm.$createElement
  45685. var _c = _vm._self._c || _h
  45686. return _vm._m(0)
  45687. }
  45688. var staticRenderFns = [
  45689. function() {
  45690. var _vm = this
  45691. var _h = _vm.$createElement
  45692. var _c = _vm._self._c || _h
  45693. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  45694. _c("div", { staticClass: "content" }, [
  45695. _c("div", { staticClass: "m-b-md" }, [
  45696. _c("h2", { staticClass: "title m-b-md" }, [
  45697. _vm._v("\n UPCCRT\n ")
  45698. ]),
  45699. _vm._v(" "),
  45700. _c("h3", [
  45701. _vm._v(
  45702. "\n University PC Care Repair Tracker\n "
  45703. )
  45704. ])
  45705. ])
  45706. ])
  45707. ])
  45708. }
  45709. ]
  45710. render._withStripped = true
  45711. /***/ }),
  45712. /***/ "./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&":
  45713. /*!*******************************************************************************************************************************************************************************************************!*\
  45714. !*** ./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& ***!
  45715. \*******************************************************************************************************************************************************************************************************/
  45716. /*! exports provided: render, staticRenderFns */
  45717. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45718. "use strict";
  45719. __webpack_require__.r(__webpack_exports__);
  45720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45722. var render = function() {
  45723. var _vm = this
  45724. var _h = _vm.$createElement
  45725. var _c = _vm._self._c || _h
  45726. return _c("div", { staticClass: "container-fluid" }, [
  45727. _c("div", { staticClass: "row my-3" }, [
  45728. _c("div", { staticClass: "col-lg-6" }, [
  45729. _c("div", { staticClass: "card h-100" }, [
  45730. _vm._m(0),
  45731. _vm._v(" "),
  45732. _c("div", { staticClass: "card-body" }, [
  45733. _c("div", { staticClass: "tab-content" }, [
  45734. _c(
  45735. "div",
  45736. {
  45737. staticClass: "tab-pane active",
  45738. attrs: {
  45739. id: "assetinfo",
  45740. role: "tabpanel",
  45741. "aria-labelledby": "assetinfo-tab"
  45742. }
  45743. },
  45744. [
  45745. !_vm.assetLoading
  45746. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  45747. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45748. ],
  45749. 1
  45750. ),
  45751. _vm._v(" "),
  45752. _c(
  45753. "div",
  45754. {
  45755. staticClass: "tab-pane",
  45756. attrs: {
  45757. id: "credentials",
  45758. role: "tabpanel",
  45759. "aria-labelledby": "credentials-tab"
  45760. }
  45761. },
  45762. [
  45763. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  45764. ? _c("credential-list", {
  45765. attrs: {
  45766. credentials: _vm.credentials,
  45767. descriptions: _vm.credentialDescriptions,
  45768. pcid: _vm.asset.pcid
  45769. }
  45770. })
  45771. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45772. ],
  45773. 1
  45774. )
  45775. ])
  45776. ])
  45777. ])
  45778. ]),
  45779. _vm._v(" "),
  45780. _c("div", { staticClass: "col-lg-6" }, [
  45781. _c("div", { staticClass: "card h-100" }, [
  45782. _vm._m(1),
  45783. _vm._v(" "),
  45784. _c("div", { staticClass: "card-body" }, [
  45785. _c("div", { staticClass: "tab-content" }, [
  45786. _c(
  45787. "div",
  45788. {
  45789. staticClass: "tab-pane active",
  45790. attrs: {
  45791. id: "workordersumm",
  45792. role: "tabpanel",
  45793. "aria-labelledby": "workordersumm-tab"
  45794. }
  45795. },
  45796. [
  45797. !_vm.woLoading && !_vm.storesLoading
  45798. ? _c("work-order-info", {
  45799. attrs: {
  45800. "work-order": _vm.workOrder,
  45801. stores: _vm.stores
  45802. }
  45803. })
  45804. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45805. ],
  45806. 1
  45807. ),
  45808. _vm._v(" "),
  45809. _c(
  45810. "div",
  45811. {
  45812. staticClass: "tab-pane",
  45813. attrs: {
  45814. id: "attachments",
  45815. role: "tabpanel",
  45816. "aria-labelledby": "attachments-tab"
  45817. }
  45818. },
  45819. [
  45820. _vm._v(
  45821. "\n TODO 2\n "
  45822. )
  45823. ]
  45824. )
  45825. ])
  45826. ])
  45827. ])
  45828. ])
  45829. ])
  45830. ])
  45831. }
  45832. var staticRenderFns = [
  45833. function() {
  45834. var _vm = this
  45835. var _h = _vm.$createElement
  45836. var _c = _vm._self._c || _h
  45837. return _c("div", { staticClass: "card-header text-right" }, [
  45838. _c(
  45839. "button",
  45840. {
  45841. staticClass: "btn btn-default xs-toggle",
  45842. attrs: {
  45843. type: "button",
  45844. "data-toggle": "collapse",
  45845. "data-target": "#assetTab"
  45846. }
  45847. },
  45848. [
  45849. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45850. _vm._v(" "),
  45851. _c("span", { staticClass: "icon-bar" }),
  45852. _vm._v(" "),
  45853. _c("span", { staticClass: "icon-bar" }),
  45854. _vm._v(" "),
  45855. _c("span", { staticClass: "icon-bar" })
  45856. ]
  45857. ),
  45858. _vm._v(" "),
  45859. _c(
  45860. "ul",
  45861. {
  45862. staticClass:
  45863. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45864. attrs: { id: "assetTab", role: "tablist" }
  45865. },
  45866. [
  45867. _c("li", { staticClass: "nav-item" }, [
  45868. _c(
  45869. "a",
  45870. {
  45871. staticClass: "nav-link active",
  45872. attrs: {
  45873. id: "assetinfo-tab",
  45874. "data-toggle": "pill",
  45875. href: "#assetinfo",
  45876. role: "tab",
  45877. "aria-controls": "assetinfo",
  45878. "aria-selected": "true"
  45879. }
  45880. },
  45881. [_vm._v("Hardware")]
  45882. )
  45883. ]),
  45884. _vm._v(" "),
  45885. _c("li", { staticClass: "nav-item" }, [
  45886. _c(
  45887. "a",
  45888. {
  45889. staticClass: "nav-link",
  45890. attrs: {
  45891. id: "credentials-tab",
  45892. "data-toggle": "pill",
  45893. href: "#credentials",
  45894. role: "tab",
  45895. "aria-controls": "credentials",
  45896. "aria-selected": "false"
  45897. }
  45898. },
  45899. [_vm._v("Credentials")]
  45900. )
  45901. ])
  45902. ]
  45903. )
  45904. ])
  45905. },
  45906. function() {
  45907. var _vm = this
  45908. var _h = _vm.$createElement
  45909. var _c = _vm._self._c || _h
  45910. return _c("div", { staticClass: "card-header text-right" }, [
  45911. _c(
  45912. "button",
  45913. {
  45914. staticClass: "btn btn-default xs-toggle",
  45915. attrs: {
  45916. type: "button",
  45917. "data-toggle": "collapse",
  45918. "data-target": "#workorderTab"
  45919. }
  45920. },
  45921. [
  45922. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45923. _vm._v(" "),
  45924. _c("span", { staticClass: "icon-bar" }),
  45925. _vm._v(" "),
  45926. _c("span", { staticClass: "icon-bar" }),
  45927. _vm._v(" "),
  45928. _c("span", { staticClass: "icon-bar" })
  45929. ]
  45930. ),
  45931. _vm._v(" "),
  45932. _c(
  45933. "ul",
  45934. {
  45935. staticClass:
  45936. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45937. attrs: { id: "workorderTab", role: "tablist" }
  45938. },
  45939. [
  45940. _c("li", { staticClass: "nav-item" }, [
  45941. _c(
  45942. "a",
  45943. {
  45944. staticClass: "nav-link active",
  45945. attrs: {
  45946. id: "workordersumm-tab",
  45947. "data-toggle": "pill",
  45948. href: "#workordersumm",
  45949. role: "tab",
  45950. "aria-controls": "workordersumm",
  45951. "aria-selected": "true"
  45952. }
  45953. },
  45954. [_vm._v("Summary")]
  45955. )
  45956. ]),
  45957. _vm._v(" "),
  45958. _c("li", { staticClass: "nav-item" }, [
  45959. _c(
  45960. "a",
  45961. {
  45962. staticClass: "nav-link",
  45963. attrs: {
  45964. id: "attachments-tab",
  45965. "data-toggle": "pill",
  45966. href: "#attachments",
  45967. role: "tab",
  45968. "aria-controls": "attachments",
  45969. "aria-selected": "false"
  45970. }
  45971. },
  45972. [_vm._v("Attachments")]
  45973. )
  45974. ])
  45975. ]
  45976. )
  45977. ])
  45978. }
  45979. ]
  45980. render._withStripped = true
  45981. /***/ }),
  45982. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  45983. /*!********************************************************************!*\
  45984. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  45985. \********************************************************************/
  45986. /*! exports provided: default */
  45987. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45988. "use strict";
  45989. __webpack_require__.r(__webpack_exports__);
  45990. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  45991. /* globals __VUE_SSR_CONTEXT__ */
  45992. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  45993. // This module is a runtime utility for cleaner component module output and will
  45994. // be included in the final webpack user bundle.
  45995. function normalizeComponent (
  45996. scriptExports,
  45997. render,
  45998. staticRenderFns,
  45999. functionalTemplate,
  46000. injectStyles,
  46001. scopeId,
  46002. moduleIdentifier, /* server only */
  46003. shadowMode /* vue-cli only */
  46004. ) {
  46005. // Vue.extend constructor export interop
  46006. var options = typeof scriptExports === 'function'
  46007. ? scriptExports.options
  46008. : scriptExports
  46009. // render functions
  46010. if (render) {
  46011. options.render = render
  46012. options.staticRenderFns = staticRenderFns
  46013. options._compiled = true
  46014. }
  46015. // functional template
  46016. if (functionalTemplate) {
  46017. options.functional = true
  46018. }
  46019. // scopedId
  46020. if (scopeId) {
  46021. options._scopeId = 'data-v-' + scopeId
  46022. }
  46023. var hook
  46024. if (moduleIdentifier) { // server build
  46025. hook = function (context) {
  46026. // 2.3 injection
  46027. context =
  46028. context || // cached call
  46029. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46030. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46031. // 2.2 with runInNewContext: true
  46032. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46033. context = __VUE_SSR_CONTEXT__
  46034. }
  46035. // inject component styles
  46036. if (injectStyles) {
  46037. injectStyles.call(this, context)
  46038. }
  46039. // register component module identifier for async chunk inferrence
  46040. if (context && context._registeredComponents) {
  46041. context._registeredComponents.add(moduleIdentifier)
  46042. }
  46043. }
  46044. // used by ssr in case component is cached and beforeCreate
  46045. // never gets called
  46046. options._ssrRegister = hook
  46047. } else if (injectStyles) {
  46048. hook = shadowMode
  46049. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46050. : injectStyles
  46051. }
  46052. if (hook) {
  46053. if (options.functional) {
  46054. // for template-only hot-reload because in that case the render fn doesn't
  46055. // go through the normalizer
  46056. options._injectStyles = hook
  46057. // register for functioal component in vue file
  46058. var originalRender = options.render
  46059. options.render = function renderWithStyleInjection (h, context) {
  46060. hook.call(context)
  46061. return originalRender(h, context)
  46062. }
  46063. } else {
  46064. // inject component registration as beforeCreate hook
  46065. var existing = options.beforeCreate
  46066. options.beforeCreate = existing
  46067. ? [].concat(existing, hook)
  46068. : [hook]
  46069. }
  46070. }
  46071. return {
  46072. exports: scriptExports,
  46073. options: options
  46074. }
  46075. }
  46076. /***/ }),
  46077. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46078. /*!********************************************************!*\
  46079. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46080. \********************************************************/
  46081. /*! exports provided: default */
  46082. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46083. "use strict";
  46084. __webpack_require__.r(__webpack_exports__);
  46085. /*!
  46086. * vue-router v3.1.6
  46087. * (c) 2020 Evan You
  46088. * @license MIT
  46089. */
  46090. /* */
  46091. function assert (condition, message) {
  46092. if (!condition) {
  46093. throw new Error(("[vue-router] " + message))
  46094. }
  46095. }
  46096. function warn (condition, message) {
  46097. if ( true && !condition) {
  46098. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46099. }
  46100. }
  46101. function isError (err) {
  46102. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46103. }
  46104. function isExtendedError (constructor, err) {
  46105. return (
  46106. err instanceof constructor ||
  46107. // _name is to support IE9 too
  46108. (err && (err.name === constructor.name || err._name === constructor._name))
  46109. )
  46110. }
  46111. function extend (a, b) {
  46112. for (var key in b) {
  46113. a[key] = b[key];
  46114. }
  46115. return a
  46116. }
  46117. var View = {
  46118. name: 'RouterView',
  46119. functional: true,
  46120. props: {
  46121. name: {
  46122. type: String,
  46123. default: 'default'
  46124. }
  46125. },
  46126. render: function render (_, ref) {
  46127. var props = ref.props;
  46128. var children = ref.children;
  46129. var parent = ref.parent;
  46130. var data = ref.data;
  46131. // used by devtools to display a router-view badge
  46132. data.routerView = true;
  46133. // directly use parent context's createElement() function
  46134. // so that components rendered by router-view can resolve named slots
  46135. var h = parent.$createElement;
  46136. var name = props.name;
  46137. var route = parent.$route;
  46138. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46139. // determine current view depth, also check to see if the tree
  46140. // has been toggled inactive but kept-alive.
  46141. var depth = 0;
  46142. var inactive = false;
  46143. while (parent && parent._routerRoot !== parent) {
  46144. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46145. if (vnodeData.routerView) {
  46146. depth++;
  46147. }
  46148. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46149. inactive = true;
  46150. }
  46151. parent = parent.$parent;
  46152. }
  46153. data.routerViewDepth = depth;
  46154. // render previous view if the tree is inactive and kept-alive
  46155. if (inactive) {
  46156. var cachedData = cache[name];
  46157. var cachedComponent = cachedData && cachedData.component;
  46158. if (cachedComponent) {
  46159. // #2301
  46160. // pass props
  46161. if (cachedData.configProps) {
  46162. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46163. }
  46164. return h(cachedComponent, data, children)
  46165. } else {
  46166. // render previous empty view
  46167. return h()
  46168. }
  46169. }
  46170. var matched = route.matched[depth];
  46171. var component = matched && matched.components[name];
  46172. // render empty node if no matched route or no config component
  46173. if (!matched || !component) {
  46174. cache[name] = null;
  46175. return h()
  46176. }
  46177. // cache component
  46178. cache[name] = { component: component };
  46179. // attach instance registration hook
  46180. // this will be called in the instance's injected lifecycle hooks
  46181. data.registerRouteInstance = function (vm, val) {
  46182. // val could be undefined for unregistration
  46183. var current = matched.instances[name];
  46184. if (
  46185. (val && current !== vm) ||
  46186. (!val && current === vm)
  46187. ) {
  46188. matched.instances[name] = val;
  46189. }
  46190. }
  46191. // also register instance in prepatch hook
  46192. // in case the same component instance is reused across different routes
  46193. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46194. matched.instances[name] = vnode.componentInstance;
  46195. };
  46196. // register instance in init hook
  46197. // in case kept-alive component be actived when routes changed
  46198. data.hook.init = function (vnode) {
  46199. if (vnode.data.keepAlive &&
  46200. vnode.componentInstance &&
  46201. vnode.componentInstance !== matched.instances[name]
  46202. ) {
  46203. matched.instances[name] = vnode.componentInstance;
  46204. }
  46205. };
  46206. var configProps = matched.props && matched.props[name];
  46207. // save route and configProps in cachce
  46208. if (configProps) {
  46209. extend(cache[name], {
  46210. route: route,
  46211. configProps: configProps
  46212. });
  46213. fillPropsinData(component, data, route, configProps);
  46214. }
  46215. return h(component, data, children)
  46216. }
  46217. };
  46218. function fillPropsinData (component, data, route, configProps) {
  46219. // resolve props
  46220. var propsToPass = data.props = resolveProps(route, configProps);
  46221. if (propsToPass) {
  46222. // clone to prevent mutation
  46223. propsToPass = data.props = extend({}, propsToPass);
  46224. // pass non-declared props as attrs
  46225. var attrs = data.attrs = data.attrs || {};
  46226. for (var key in propsToPass) {
  46227. if (!component.props || !(key in component.props)) {
  46228. attrs[key] = propsToPass[key];
  46229. delete propsToPass[key];
  46230. }
  46231. }
  46232. }
  46233. }
  46234. function resolveProps (route, config) {
  46235. switch (typeof config) {
  46236. case 'undefined':
  46237. return
  46238. case 'object':
  46239. return config
  46240. case 'function':
  46241. return config(route)
  46242. case 'boolean':
  46243. return config ? route.params : undefined
  46244. default:
  46245. if (true) {
  46246. warn(
  46247. false,
  46248. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46249. "expecting an object, function or boolean."
  46250. );
  46251. }
  46252. }
  46253. }
  46254. /* */
  46255. var encodeReserveRE = /[!'()*]/g;
  46256. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46257. var commaRE = /%2C/g;
  46258. // fixed encodeURIComponent which is more conformant to RFC3986:
  46259. // - escapes [!'()*]
  46260. // - preserve commas
  46261. var encode = function (str) { return encodeURIComponent(str)
  46262. .replace(encodeReserveRE, encodeReserveReplacer)
  46263. .replace(commaRE, ','); };
  46264. var decode = decodeURIComponent;
  46265. function resolveQuery (
  46266. query,
  46267. extraQuery,
  46268. _parseQuery
  46269. ) {
  46270. if ( extraQuery === void 0 ) extraQuery = {};
  46271. var parse = _parseQuery || parseQuery;
  46272. var parsedQuery;
  46273. try {
  46274. parsedQuery = parse(query || '');
  46275. } catch (e) {
  46276. true && warn(false, e.message);
  46277. parsedQuery = {};
  46278. }
  46279. for (var key in extraQuery) {
  46280. parsedQuery[key] = extraQuery[key];
  46281. }
  46282. return parsedQuery
  46283. }
  46284. function parseQuery (query) {
  46285. var res = {};
  46286. query = query.trim().replace(/^(\?|#|&)/, '');
  46287. if (!query) {
  46288. return res
  46289. }
  46290. query.split('&').forEach(function (param) {
  46291. var parts = param.replace(/\+/g, ' ').split('=');
  46292. var key = decode(parts.shift());
  46293. var val = parts.length > 0
  46294. ? decode(parts.join('='))
  46295. : null;
  46296. if (res[key] === undefined) {
  46297. res[key] = val;
  46298. } else if (Array.isArray(res[key])) {
  46299. res[key].push(val);
  46300. } else {
  46301. res[key] = [res[key], val];
  46302. }
  46303. });
  46304. return res
  46305. }
  46306. function stringifyQuery (obj) {
  46307. var res = obj ? Object.keys(obj).map(function (key) {
  46308. var val = obj[key];
  46309. if (val === undefined) {
  46310. return ''
  46311. }
  46312. if (val === null) {
  46313. return encode(key)
  46314. }
  46315. if (Array.isArray(val)) {
  46316. var result = [];
  46317. val.forEach(function (val2) {
  46318. if (val2 === undefined) {
  46319. return
  46320. }
  46321. if (val2 === null) {
  46322. result.push(encode(key));
  46323. } else {
  46324. result.push(encode(key) + '=' + encode(val2));
  46325. }
  46326. });
  46327. return result.join('&')
  46328. }
  46329. return encode(key) + '=' + encode(val)
  46330. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  46331. return res ? ("?" + res) : ''
  46332. }
  46333. /* */
  46334. var trailingSlashRE = /\/?$/;
  46335. function createRoute (
  46336. record,
  46337. location,
  46338. redirectedFrom,
  46339. router
  46340. ) {
  46341. var stringifyQuery = router && router.options.stringifyQuery;
  46342. var query = location.query || {};
  46343. try {
  46344. query = clone(query);
  46345. } catch (e) {}
  46346. var route = {
  46347. name: location.name || (record && record.name),
  46348. meta: (record && record.meta) || {},
  46349. path: location.path || '/',
  46350. hash: location.hash || '',
  46351. query: query,
  46352. params: location.params || {},
  46353. fullPath: getFullPath(location, stringifyQuery),
  46354. matched: record ? formatMatch(record) : []
  46355. };
  46356. if (redirectedFrom) {
  46357. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  46358. }
  46359. return Object.freeze(route)
  46360. }
  46361. function clone (value) {
  46362. if (Array.isArray(value)) {
  46363. return value.map(clone)
  46364. } else if (value && typeof value === 'object') {
  46365. var res = {};
  46366. for (var key in value) {
  46367. res[key] = clone(value[key]);
  46368. }
  46369. return res
  46370. } else {
  46371. return value
  46372. }
  46373. }
  46374. // the starting route that represents the initial state
  46375. var START = createRoute(null, {
  46376. path: '/'
  46377. });
  46378. function formatMatch (record) {
  46379. var res = [];
  46380. while (record) {
  46381. res.unshift(record);
  46382. record = record.parent;
  46383. }
  46384. return res
  46385. }
  46386. function getFullPath (
  46387. ref,
  46388. _stringifyQuery
  46389. ) {
  46390. var path = ref.path;
  46391. var query = ref.query; if ( query === void 0 ) query = {};
  46392. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  46393. var stringify = _stringifyQuery || stringifyQuery;
  46394. return (path || '/') + stringify(query) + hash
  46395. }
  46396. function isSameRoute (a, b) {
  46397. if (b === START) {
  46398. return a === b
  46399. } else if (!b) {
  46400. return false
  46401. } else if (a.path && b.path) {
  46402. return (
  46403. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  46404. a.hash === b.hash &&
  46405. isObjectEqual(a.query, b.query)
  46406. )
  46407. } else if (a.name && b.name) {
  46408. return (
  46409. a.name === b.name &&
  46410. a.hash === b.hash &&
  46411. isObjectEqual(a.query, b.query) &&
  46412. isObjectEqual(a.params, b.params)
  46413. )
  46414. } else {
  46415. return false
  46416. }
  46417. }
  46418. function isObjectEqual (a, b) {
  46419. if ( a === void 0 ) a = {};
  46420. if ( b === void 0 ) b = {};
  46421. // handle null value #1566
  46422. if (!a || !b) { return a === b }
  46423. var aKeys = Object.keys(a);
  46424. var bKeys = Object.keys(b);
  46425. if (aKeys.length !== bKeys.length) {
  46426. return false
  46427. }
  46428. return aKeys.every(function (key) {
  46429. var aVal = a[key];
  46430. var bVal = b[key];
  46431. // check nested equality
  46432. if (typeof aVal === 'object' && typeof bVal === 'object') {
  46433. return isObjectEqual(aVal, bVal)
  46434. }
  46435. return String(aVal) === String(bVal)
  46436. })
  46437. }
  46438. function isIncludedRoute (current, target) {
  46439. return (
  46440. current.path.replace(trailingSlashRE, '/').indexOf(
  46441. target.path.replace(trailingSlashRE, '/')
  46442. ) === 0 &&
  46443. (!target.hash || current.hash === target.hash) &&
  46444. queryIncludes(current.query, target.query)
  46445. )
  46446. }
  46447. function queryIncludes (current, target) {
  46448. for (var key in target) {
  46449. if (!(key in current)) {
  46450. return false
  46451. }
  46452. }
  46453. return true
  46454. }
  46455. /* */
  46456. function resolvePath (
  46457. relative,
  46458. base,
  46459. append
  46460. ) {
  46461. var firstChar = relative.charAt(0);
  46462. if (firstChar === '/') {
  46463. return relative
  46464. }
  46465. if (firstChar === '?' || firstChar === '#') {
  46466. return base + relative
  46467. }
  46468. var stack = base.split('/');
  46469. // remove trailing segment if:
  46470. // - not appending
  46471. // - appending to trailing slash (last segment is empty)
  46472. if (!append || !stack[stack.length - 1]) {
  46473. stack.pop();
  46474. }
  46475. // resolve relative path
  46476. var segments = relative.replace(/^\//, '').split('/');
  46477. for (var i = 0; i < segments.length; i++) {
  46478. var segment = segments[i];
  46479. if (segment === '..') {
  46480. stack.pop();
  46481. } else if (segment !== '.') {
  46482. stack.push(segment);
  46483. }
  46484. }
  46485. // ensure leading slash
  46486. if (stack[0] !== '') {
  46487. stack.unshift('');
  46488. }
  46489. return stack.join('/')
  46490. }
  46491. function parsePath (path) {
  46492. var hash = '';
  46493. var query = '';
  46494. var hashIndex = path.indexOf('#');
  46495. if (hashIndex >= 0) {
  46496. hash = path.slice(hashIndex);
  46497. path = path.slice(0, hashIndex);
  46498. }
  46499. var queryIndex = path.indexOf('?');
  46500. if (queryIndex >= 0) {
  46501. query = path.slice(queryIndex + 1);
  46502. path = path.slice(0, queryIndex);
  46503. }
  46504. return {
  46505. path: path,
  46506. query: query,
  46507. hash: hash
  46508. }
  46509. }
  46510. function cleanPath (path) {
  46511. return path.replace(/\/\//g, '/')
  46512. }
  46513. var isarray = Array.isArray || function (arr) {
  46514. return Object.prototype.toString.call(arr) == '[object Array]';
  46515. };
  46516. /**
  46517. * Expose `pathToRegexp`.
  46518. */
  46519. var pathToRegexp_1 = pathToRegexp;
  46520. var parse_1 = parse;
  46521. var compile_1 = compile;
  46522. var tokensToFunction_1 = tokensToFunction;
  46523. var tokensToRegExp_1 = tokensToRegExp;
  46524. /**
  46525. * The main path matching regexp utility.
  46526. *
  46527. * @type {RegExp}
  46528. */
  46529. var PATH_REGEXP = new RegExp([
  46530. // Match escaped characters that would otherwise appear in future matches.
  46531. // This allows the user to escape special characters that won't transform.
  46532. '(\\\\.)',
  46533. // Match Express-style parameters and un-named parameters with a prefix
  46534. // and optional suffixes. Matches appear as:
  46535. //
  46536. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  46537. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  46538. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  46539. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  46540. ].join('|'), 'g');
  46541. /**
  46542. * Parse a string for the raw tokens.
  46543. *
  46544. * @param {string} str
  46545. * @param {Object=} options
  46546. * @return {!Array}
  46547. */
  46548. function parse (str, options) {
  46549. var tokens = [];
  46550. var key = 0;
  46551. var index = 0;
  46552. var path = '';
  46553. var defaultDelimiter = options && options.delimiter || '/';
  46554. var res;
  46555. while ((res = PATH_REGEXP.exec(str)) != null) {
  46556. var m = res[0];
  46557. var escaped = res[1];
  46558. var offset = res.index;
  46559. path += str.slice(index, offset);
  46560. index = offset + m.length;
  46561. // Ignore already escaped sequences.
  46562. if (escaped) {
  46563. path += escaped[1];
  46564. continue
  46565. }
  46566. var next = str[index];
  46567. var prefix = res[2];
  46568. var name = res[3];
  46569. var capture = res[4];
  46570. var group = res[5];
  46571. var modifier = res[6];
  46572. var asterisk = res[7];
  46573. // Push the current path onto the tokens.
  46574. if (path) {
  46575. tokens.push(path);
  46576. path = '';
  46577. }
  46578. var partial = prefix != null && next != null && next !== prefix;
  46579. var repeat = modifier === '+' || modifier === '*';
  46580. var optional = modifier === '?' || modifier === '*';
  46581. var delimiter = res[2] || defaultDelimiter;
  46582. var pattern = capture || group;
  46583. tokens.push({
  46584. name: name || key++,
  46585. prefix: prefix || '',
  46586. delimiter: delimiter,
  46587. optional: optional,
  46588. repeat: repeat,
  46589. partial: partial,
  46590. asterisk: !!asterisk,
  46591. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  46592. });
  46593. }
  46594. // Match any characters still remaining.
  46595. if (index < str.length) {
  46596. path += str.substr(index);
  46597. }
  46598. // If the path exists, push it onto the end.
  46599. if (path) {
  46600. tokens.push(path);
  46601. }
  46602. return tokens
  46603. }
  46604. /**
  46605. * Compile a string to a template function for the path.
  46606. *
  46607. * @param {string} str
  46608. * @param {Object=} options
  46609. * @return {!function(Object=, Object=)}
  46610. */
  46611. function compile (str, options) {
  46612. return tokensToFunction(parse(str, options))
  46613. }
  46614. /**
  46615. * Prettier encoding of URI path segments.
  46616. *
  46617. * @param {string}
  46618. * @return {string}
  46619. */
  46620. function encodeURIComponentPretty (str) {
  46621. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  46622. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  46623. })
  46624. }
  46625. /**
  46626. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  46627. *
  46628. * @param {string}
  46629. * @return {string}
  46630. */
  46631. function encodeAsterisk (str) {
  46632. return encodeURI(str).replace(/[?#]/g, function (c) {
  46633. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  46634. })
  46635. }
  46636. /**
  46637. * Expose a method for transforming tokens into the path function.
  46638. */
  46639. function tokensToFunction (tokens) {
  46640. // Compile all the tokens into regexps.
  46641. var matches = new Array(tokens.length);
  46642. // Compile all the patterns before compilation.
  46643. for (var i = 0; i < tokens.length; i++) {
  46644. if (typeof tokens[i] === 'object') {
  46645. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  46646. }
  46647. }
  46648. return function (obj, opts) {
  46649. var path = '';
  46650. var data = obj || {};
  46651. var options = opts || {};
  46652. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  46653. for (var i = 0; i < tokens.length; i++) {
  46654. var token = tokens[i];
  46655. if (typeof token === 'string') {
  46656. path += token;
  46657. continue
  46658. }
  46659. var value = data[token.name];
  46660. var segment;
  46661. if (value == null) {
  46662. if (token.optional) {
  46663. // Prepend partial segment prefixes.
  46664. if (token.partial) {
  46665. path += token.prefix;
  46666. }
  46667. continue
  46668. } else {
  46669. throw new TypeError('Expected "' + token.name + '" to be defined')
  46670. }
  46671. }
  46672. if (isarray(value)) {
  46673. if (!token.repeat) {
  46674. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  46675. }
  46676. if (value.length === 0) {
  46677. if (token.optional) {
  46678. continue
  46679. } else {
  46680. throw new TypeError('Expected "' + token.name + '" to not be empty')
  46681. }
  46682. }
  46683. for (var j = 0; j < value.length; j++) {
  46684. segment = encode(value[j]);
  46685. if (!matches[i].test(segment)) {
  46686. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  46687. }
  46688. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  46689. }
  46690. continue
  46691. }
  46692. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  46693. if (!matches[i].test(segment)) {
  46694. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  46695. }
  46696. path += token.prefix + segment;
  46697. }
  46698. return path
  46699. }
  46700. }
  46701. /**
  46702. * Escape a regular expression string.
  46703. *
  46704. * @param {string} str
  46705. * @return {string}
  46706. */
  46707. function escapeString (str) {
  46708. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  46709. }
  46710. /**
  46711. * Escape the capturing group by escaping special characters and meaning.
  46712. *
  46713. * @param {string} group
  46714. * @return {string}
  46715. */
  46716. function escapeGroup (group) {
  46717. return group.replace(/([=!:$\/()])/g, '\\$1')
  46718. }
  46719. /**
  46720. * Attach the keys as a property of the regexp.
  46721. *
  46722. * @param {!RegExp} re
  46723. * @param {Array} keys
  46724. * @return {!RegExp}
  46725. */
  46726. function attachKeys (re, keys) {
  46727. re.keys = keys;
  46728. return re
  46729. }
  46730. /**
  46731. * Get the flags for a regexp from the options.
  46732. *
  46733. * @param {Object} options
  46734. * @return {string}
  46735. */
  46736. function flags (options) {
  46737. return options.sensitive ? '' : 'i'
  46738. }
  46739. /**
  46740. * Pull out keys from a regexp.
  46741. *
  46742. * @param {!RegExp} path
  46743. * @param {!Array} keys
  46744. * @return {!RegExp}
  46745. */
  46746. function regexpToRegexp (path, keys) {
  46747. // Use a negative lookahead to match only capturing groups.
  46748. var groups = path.source.match(/\((?!\?)/g);
  46749. if (groups) {
  46750. for (var i = 0; i < groups.length; i++) {
  46751. keys.push({
  46752. name: i,
  46753. prefix: null,
  46754. delimiter: null,
  46755. optional: false,
  46756. repeat: false,
  46757. partial: false,
  46758. asterisk: false,
  46759. pattern: null
  46760. });
  46761. }
  46762. }
  46763. return attachKeys(path, keys)
  46764. }
  46765. /**
  46766. * Transform an array into a regexp.
  46767. *
  46768. * @param {!Array} path
  46769. * @param {Array} keys
  46770. * @param {!Object} options
  46771. * @return {!RegExp}
  46772. */
  46773. function arrayToRegexp (path, keys, options) {
  46774. var parts = [];
  46775. for (var i = 0; i < path.length; i++) {
  46776. parts.push(pathToRegexp(path[i], keys, options).source);
  46777. }
  46778. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  46779. return attachKeys(regexp, keys)
  46780. }
  46781. /**
  46782. * Create a path regexp from string input.
  46783. *
  46784. * @param {string} path
  46785. * @param {!Array} keys
  46786. * @param {!Object} options
  46787. * @return {!RegExp}
  46788. */
  46789. function stringToRegexp (path, keys, options) {
  46790. return tokensToRegExp(parse(path, options), keys, options)
  46791. }
  46792. /**
  46793. * Expose a function for taking tokens and returning a RegExp.
  46794. *
  46795. * @param {!Array} tokens
  46796. * @param {(Array|Object)=} keys
  46797. * @param {Object=} options
  46798. * @return {!RegExp}
  46799. */
  46800. function tokensToRegExp (tokens, keys, options) {
  46801. if (!isarray(keys)) {
  46802. options = /** @type {!Object} */ (keys || options);
  46803. keys = [];
  46804. }
  46805. options = options || {};
  46806. var strict = options.strict;
  46807. var end = options.end !== false;
  46808. var route = '';
  46809. // Iterate over the tokens and create our regexp string.
  46810. for (var i = 0; i < tokens.length; i++) {
  46811. var token = tokens[i];
  46812. if (typeof token === 'string') {
  46813. route += escapeString(token);
  46814. } else {
  46815. var prefix = escapeString(token.prefix);
  46816. var capture = '(?:' + token.pattern + ')';
  46817. keys.push(token);
  46818. if (token.repeat) {
  46819. capture += '(?:' + prefix + capture + ')*';
  46820. }
  46821. if (token.optional) {
  46822. if (!token.partial) {
  46823. capture = '(?:' + prefix + '(' + capture + '))?';
  46824. } else {
  46825. capture = prefix + '(' + capture + ')?';
  46826. }
  46827. } else {
  46828. capture = prefix + '(' + capture + ')';
  46829. }
  46830. route += capture;
  46831. }
  46832. }
  46833. var delimiter = escapeString(options.delimiter || '/');
  46834. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  46835. // In non-strict mode we allow a slash at the end of match. If the path to
  46836. // match already ends with a slash, we remove it for consistency. The slash
  46837. // is valid at the end of a path match, not in the middle. This is important
  46838. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  46839. if (!strict) {
  46840. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  46841. }
  46842. if (end) {
  46843. route += '$';
  46844. } else {
  46845. // In non-ending mode, we need the capturing groups to match as much as
  46846. // possible by using a positive lookahead to the end or next path segment.
  46847. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  46848. }
  46849. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  46850. }
  46851. /**
  46852. * Normalize the given path string, returning a regular expression.
  46853. *
  46854. * An empty array can be passed in for the keys, which will hold the
  46855. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  46856. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  46857. *
  46858. * @param {(string|RegExp|Array)} path
  46859. * @param {(Array|Object)=} keys
  46860. * @param {Object=} options
  46861. * @return {!RegExp}
  46862. */
  46863. function pathToRegexp (path, keys, options) {
  46864. if (!isarray(keys)) {
  46865. options = /** @type {!Object} */ (keys || options);
  46866. keys = [];
  46867. }
  46868. options = options || {};
  46869. if (path instanceof RegExp) {
  46870. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  46871. }
  46872. if (isarray(path)) {
  46873. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  46874. }
  46875. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  46876. }
  46877. pathToRegexp_1.parse = parse_1;
  46878. pathToRegexp_1.compile = compile_1;
  46879. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  46880. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  46881. /* */
  46882. // $flow-disable-line
  46883. var regexpCompileCache = Object.create(null);
  46884. function fillParams (
  46885. path,
  46886. params,
  46887. routeMsg
  46888. ) {
  46889. params = params || {};
  46890. try {
  46891. var filler =
  46892. regexpCompileCache[path] ||
  46893. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  46894. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  46895. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  46896. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  46897. return filler(params, { pretty: true })
  46898. } catch (e) {
  46899. if (true) {
  46900. // Fix #3072 no warn if `pathMatch` is string
  46901. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  46902. }
  46903. return ''
  46904. } finally {
  46905. // delete the 0 if it was added
  46906. delete params[0];
  46907. }
  46908. }
  46909. /* */
  46910. function normalizeLocation (
  46911. raw,
  46912. current,
  46913. append,
  46914. router
  46915. ) {
  46916. var next = typeof raw === 'string' ? { path: raw } : raw;
  46917. // named target
  46918. if (next._normalized) {
  46919. return next
  46920. } else if (next.name) {
  46921. next = extend({}, raw);
  46922. var params = next.params;
  46923. if (params && typeof params === 'object') {
  46924. next.params = extend({}, params);
  46925. }
  46926. return next
  46927. }
  46928. // relative params
  46929. if (!next.path && next.params && current) {
  46930. next = extend({}, next);
  46931. next._normalized = true;
  46932. var params$1 = extend(extend({}, current.params), next.params);
  46933. if (current.name) {
  46934. next.name = current.name;
  46935. next.params = params$1;
  46936. } else if (current.matched.length) {
  46937. var rawPath = current.matched[current.matched.length - 1].path;
  46938. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  46939. } else if (true) {
  46940. warn(false, "relative params navigation requires a current route.");
  46941. }
  46942. return next
  46943. }
  46944. var parsedPath = parsePath(next.path || '');
  46945. var basePath = (current && current.path) || '/';
  46946. var path = parsedPath.path
  46947. ? resolvePath(parsedPath.path, basePath, append || next.append)
  46948. : basePath;
  46949. var query = resolveQuery(
  46950. parsedPath.query,
  46951. next.query,
  46952. router && router.options.parseQuery
  46953. );
  46954. var hash = next.hash || parsedPath.hash;
  46955. if (hash && hash.charAt(0) !== '#') {
  46956. hash = "#" + hash;
  46957. }
  46958. return {
  46959. _normalized: true,
  46960. path: path,
  46961. query: query,
  46962. hash: hash
  46963. }
  46964. }
  46965. /* */
  46966. // work around weird flow bug
  46967. var toTypes = [String, Object];
  46968. var eventTypes = [String, Array];
  46969. var noop = function () {};
  46970. var Link = {
  46971. name: 'RouterLink',
  46972. props: {
  46973. to: {
  46974. type: toTypes,
  46975. required: true
  46976. },
  46977. tag: {
  46978. type: String,
  46979. default: 'a'
  46980. },
  46981. exact: Boolean,
  46982. append: Boolean,
  46983. replace: Boolean,
  46984. activeClass: String,
  46985. exactActiveClass: String,
  46986. event: {
  46987. type: eventTypes,
  46988. default: 'click'
  46989. }
  46990. },
  46991. render: function render (h) {
  46992. var this$1 = this;
  46993. var router = this.$router;
  46994. var current = this.$route;
  46995. var ref = router.resolve(
  46996. this.to,
  46997. current,
  46998. this.append
  46999. );
  47000. var location = ref.location;
  47001. var route = ref.route;
  47002. var href = ref.href;
  47003. var classes = {};
  47004. var globalActiveClass = router.options.linkActiveClass;
  47005. var globalExactActiveClass = router.options.linkExactActiveClass;
  47006. // Support global empty active class
  47007. var activeClassFallback =
  47008. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47009. var exactActiveClassFallback =
  47010. globalExactActiveClass == null
  47011. ? 'router-link-exact-active'
  47012. : globalExactActiveClass;
  47013. var activeClass =
  47014. this.activeClass == null ? activeClassFallback : this.activeClass;
  47015. var exactActiveClass =
  47016. this.exactActiveClass == null
  47017. ? exactActiveClassFallback
  47018. : this.exactActiveClass;
  47019. var compareTarget = route.redirectedFrom
  47020. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47021. : route;
  47022. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47023. classes[activeClass] = this.exact
  47024. ? classes[exactActiveClass]
  47025. : isIncludedRoute(current, compareTarget);
  47026. var handler = function (e) {
  47027. if (guardEvent(e)) {
  47028. if (this$1.replace) {
  47029. router.replace(location, noop);
  47030. } else {
  47031. router.push(location, noop);
  47032. }
  47033. }
  47034. };
  47035. var on = { click: guardEvent };
  47036. if (Array.isArray(this.event)) {
  47037. this.event.forEach(function (e) {
  47038. on[e] = handler;
  47039. });
  47040. } else {
  47041. on[this.event] = handler;
  47042. }
  47043. var data = { class: classes };
  47044. var scopedSlot =
  47045. !this.$scopedSlots.$hasNormal &&
  47046. this.$scopedSlots.default &&
  47047. this.$scopedSlots.default({
  47048. href: href,
  47049. route: route,
  47050. navigate: handler,
  47051. isActive: classes[activeClass],
  47052. isExactActive: classes[exactActiveClass]
  47053. });
  47054. if (scopedSlot) {
  47055. if (scopedSlot.length === 1) {
  47056. return scopedSlot[0]
  47057. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47058. if (true) {
  47059. warn(
  47060. false,
  47061. ("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.")
  47062. );
  47063. }
  47064. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47065. }
  47066. }
  47067. if (this.tag === 'a') {
  47068. data.on = on;
  47069. data.attrs = { href: href };
  47070. } else {
  47071. // find the first <a> child and apply listener and href
  47072. var a = findAnchor(this.$slots.default);
  47073. if (a) {
  47074. // in case the <a> is a static node
  47075. a.isStatic = false;
  47076. var aData = (a.data = extend({}, a.data));
  47077. aData.on = aData.on || {};
  47078. // transform existing events in both objects into arrays so we can push later
  47079. for (var event in aData.on) {
  47080. var handler$1 = aData.on[event];
  47081. if (event in on) {
  47082. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47083. }
  47084. }
  47085. // append new listeners for router-link
  47086. for (var event$1 in on) {
  47087. if (event$1 in aData.on) {
  47088. // on[event] is always a function
  47089. aData.on[event$1].push(on[event$1]);
  47090. } else {
  47091. aData.on[event$1] = handler;
  47092. }
  47093. }
  47094. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47095. aAttrs.href = href;
  47096. } else {
  47097. // doesn't have <a> child, apply listener to self
  47098. data.on = on;
  47099. }
  47100. }
  47101. return h(this.tag, data, this.$slots.default)
  47102. }
  47103. };
  47104. function guardEvent (e) {
  47105. // don't redirect with control keys
  47106. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47107. // don't redirect when preventDefault called
  47108. if (e.defaultPrevented) { return }
  47109. // don't redirect on right click
  47110. if (e.button !== undefined && e.button !== 0) { return }
  47111. // don't redirect if `target="_blank"`
  47112. if (e.currentTarget && e.currentTarget.getAttribute) {
  47113. var target = e.currentTarget.getAttribute('target');
  47114. if (/\b_blank\b/i.test(target)) { return }
  47115. }
  47116. // this may be a Weex event which doesn't have this method
  47117. if (e.preventDefault) {
  47118. e.preventDefault();
  47119. }
  47120. return true
  47121. }
  47122. function findAnchor (children) {
  47123. if (children) {
  47124. var child;
  47125. for (var i = 0; i < children.length; i++) {
  47126. child = children[i];
  47127. if (child.tag === 'a') {
  47128. return child
  47129. }
  47130. if (child.children && (child = findAnchor(child.children))) {
  47131. return child
  47132. }
  47133. }
  47134. }
  47135. }
  47136. var _Vue;
  47137. function install (Vue) {
  47138. if (install.installed && _Vue === Vue) { return }
  47139. install.installed = true;
  47140. _Vue = Vue;
  47141. var isDef = function (v) { return v !== undefined; };
  47142. var registerInstance = function (vm, callVal) {
  47143. var i = vm.$options._parentVnode;
  47144. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47145. i(vm, callVal);
  47146. }
  47147. };
  47148. Vue.mixin({
  47149. beforeCreate: function beforeCreate () {
  47150. if (isDef(this.$options.router)) {
  47151. this._routerRoot = this;
  47152. this._router = this.$options.router;
  47153. this._router.init(this);
  47154. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47155. } else {
  47156. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47157. }
  47158. registerInstance(this, this);
  47159. },
  47160. destroyed: function destroyed () {
  47161. registerInstance(this);
  47162. }
  47163. });
  47164. Object.defineProperty(Vue.prototype, '$router', {
  47165. get: function get () { return this._routerRoot._router }
  47166. });
  47167. Object.defineProperty(Vue.prototype, '$route', {
  47168. get: function get () { return this._routerRoot._route }
  47169. });
  47170. Vue.component('RouterView', View);
  47171. Vue.component('RouterLink', Link);
  47172. var strats = Vue.config.optionMergeStrategies;
  47173. // use the same hook merging strategy for route hooks
  47174. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47175. }
  47176. /* */
  47177. var inBrowser = typeof window !== 'undefined';
  47178. /* */
  47179. function createRouteMap (
  47180. routes,
  47181. oldPathList,
  47182. oldPathMap,
  47183. oldNameMap
  47184. ) {
  47185. // the path list is used to control path matching priority
  47186. var pathList = oldPathList || [];
  47187. // $flow-disable-line
  47188. var pathMap = oldPathMap || Object.create(null);
  47189. // $flow-disable-line
  47190. var nameMap = oldNameMap || Object.create(null);
  47191. routes.forEach(function (route) {
  47192. addRouteRecord(pathList, pathMap, nameMap, route);
  47193. });
  47194. // ensure wildcard routes are always at the end
  47195. for (var i = 0, l = pathList.length; i < l; i++) {
  47196. if (pathList[i] === '*') {
  47197. pathList.push(pathList.splice(i, 1)[0]);
  47198. l--;
  47199. i--;
  47200. }
  47201. }
  47202. if (true) {
  47203. // warn if routes do not include leading slashes
  47204. var found = pathList
  47205. // check for missing leading slash
  47206. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47207. if (found.length > 0) {
  47208. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47209. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47210. }
  47211. }
  47212. return {
  47213. pathList: pathList,
  47214. pathMap: pathMap,
  47215. nameMap: nameMap
  47216. }
  47217. }
  47218. function addRouteRecord (
  47219. pathList,
  47220. pathMap,
  47221. nameMap,
  47222. route,
  47223. parent,
  47224. matchAs
  47225. ) {
  47226. var path = route.path;
  47227. var name = route.name;
  47228. if (true) {
  47229. assert(path != null, "\"path\" is required in a route configuration.");
  47230. assert(
  47231. typeof route.component !== 'string',
  47232. "route config \"component\" for path: " + (String(
  47233. path || name
  47234. )) + " cannot be a " + "string id. Use an actual component instead."
  47235. );
  47236. }
  47237. var pathToRegexpOptions =
  47238. route.pathToRegexpOptions || {};
  47239. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47240. if (typeof route.caseSensitive === 'boolean') {
  47241. pathToRegexpOptions.sensitive = route.caseSensitive;
  47242. }
  47243. var record = {
  47244. path: normalizedPath,
  47245. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47246. components: route.components || { default: route.component },
  47247. instances: {},
  47248. name: name,
  47249. parent: parent,
  47250. matchAs: matchAs,
  47251. redirect: route.redirect,
  47252. beforeEnter: route.beforeEnter,
  47253. meta: route.meta || {},
  47254. props:
  47255. route.props == null
  47256. ? {}
  47257. : route.components
  47258. ? route.props
  47259. : { default: route.props }
  47260. };
  47261. if (route.children) {
  47262. // Warn if route is named, does not redirect and has a default child route.
  47263. // If users navigate to this route by name, the default child will
  47264. // not be rendered (GH Issue #629)
  47265. if (true) {
  47266. if (
  47267. route.name &&
  47268. !route.redirect &&
  47269. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47270. ) {
  47271. warn(
  47272. false,
  47273. "Named Route '" + (route.name) + "' has a default child route. " +
  47274. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47275. "the default child route will not be rendered. Remove the name from " +
  47276. "this route and use the name of the default child route for named " +
  47277. "links instead."
  47278. );
  47279. }
  47280. }
  47281. route.children.forEach(function (child) {
  47282. var childMatchAs = matchAs
  47283. ? cleanPath((matchAs + "/" + (child.path)))
  47284. : undefined;
  47285. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47286. });
  47287. }
  47288. if (!pathMap[record.path]) {
  47289. pathList.push(record.path);
  47290. pathMap[record.path] = record;
  47291. }
  47292. if (route.alias !== undefined) {
  47293. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47294. for (var i = 0; i < aliases.length; ++i) {
  47295. var alias = aliases[i];
  47296. if ( true && alias === path) {
  47297. warn(
  47298. false,
  47299. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47300. );
  47301. // skip in dev to make it work
  47302. continue
  47303. }
  47304. var aliasRoute = {
  47305. path: alias,
  47306. children: route.children
  47307. };
  47308. addRouteRecord(
  47309. pathList,
  47310. pathMap,
  47311. nameMap,
  47312. aliasRoute,
  47313. parent,
  47314. record.path || '/' // matchAs
  47315. );
  47316. }
  47317. }
  47318. if (name) {
  47319. if (!nameMap[name]) {
  47320. nameMap[name] = record;
  47321. } else if ( true && !matchAs) {
  47322. warn(
  47323. false,
  47324. "Duplicate named routes definition: " +
  47325. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  47326. );
  47327. }
  47328. }
  47329. }
  47330. function compileRouteRegex (
  47331. path,
  47332. pathToRegexpOptions
  47333. ) {
  47334. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  47335. if (true) {
  47336. var keys = Object.create(null);
  47337. regex.keys.forEach(function (key) {
  47338. warn(
  47339. !keys[key.name],
  47340. ("Duplicate param keys in route with path: \"" + path + "\"")
  47341. );
  47342. keys[key.name] = true;
  47343. });
  47344. }
  47345. return regex
  47346. }
  47347. function normalizePath (
  47348. path,
  47349. parent,
  47350. strict
  47351. ) {
  47352. if (!strict) { path = path.replace(/\/$/, ''); }
  47353. if (path[0] === '/') { return path }
  47354. if (parent == null) { return path }
  47355. return cleanPath(((parent.path) + "/" + path))
  47356. }
  47357. /* */
  47358. function createMatcher (
  47359. routes,
  47360. router
  47361. ) {
  47362. var ref = createRouteMap(routes);
  47363. var pathList = ref.pathList;
  47364. var pathMap = ref.pathMap;
  47365. var nameMap = ref.nameMap;
  47366. function addRoutes (routes) {
  47367. createRouteMap(routes, pathList, pathMap, nameMap);
  47368. }
  47369. function match (
  47370. raw,
  47371. currentRoute,
  47372. redirectedFrom
  47373. ) {
  47374. var location = normalizeLocation(raw, currentRoute, false, router);
  47375. var name = location.name;
  47376. if (name) {
  47377. var record = nameMap[name];
  47378. if (true) {
  47379. warn(record, ("Route with name '" + name + "' does not exist"));
  47380. }
  47381. if (!record) { return _createRoute(null, location) }
  47382. var paramNames = record.regex.keys
  47383. .filter(function (key) { return !key.optional; })
  47384. .map(function (key) { return key.name; });
  47385. if (typeof location.params !== 'object') {
  47386. location.params = {};
  47387. }
  47388. if (currentRoute && typeof currentRoute.params === 'object') {
  47389. for (var key in currentRoute.params) {
  47390. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  47391. location.params[key] = currentRoute.params[key];
  47392. }
  47393. }
  47394. }
  47395. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  47396. return _createRoute(record, location, redirectedFrom)
  47397. } else if (location.path) {
  47398. location.params = {};
  47399. for (var i = 0; i < pathList.length; i++) {
  47400. var path = pathList[i];
  47401. var record$1 = pathMap[path];
  47402. if (matchRoute(record$1.regex, location.path, location.params)) {
  47403. return _createRoute(record$1, location, redirectedFrom)
  47404. }
  47405. }
  47406. }
  47407. // no match
  47408. return _createRoute(null, location)
  47409. }
  47410. function redirect (
  47411. record,
  47412. location
  47413. ) {
  47414. var originalRedirect = record.redirect;
  47415. var redirect = typeof originalRedirect === 'function'
  47416. ? originalRedirect(createRoute(record, location, null, router))
  47417. : originalRedirect;
  47418. if (typeof redirect === 'string') {
  47419. redirect = { path: redirect };
  47420. }
  47421. if (!redirect || typeof redirect !== 'object') {
  47422. if (true) {
  47423. warn(
  47424. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  47425. );
  47426. }
  47427. return _createRoute(null, location)
  47428. }
  47429. var re = redirect;
  47430. var name = re.name;
  47431. var path = re.path;
  47432. var query = location.query;
  47433. var hash = location.hash;
  47434. var params = location.params;
  47435. query = re.hasOwnProperty('query') ? re.query : query;
  47436. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  47437. params = re.hasOwnProperty('params') ? re.params : params;
  47438. if (name) {
  47439. // resolved named direct
  47440. var targetRecord = nameMap[name];
  47441. if (true) {
  47442. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  47443. }
  47444. return match({
  47445. _normalized: true,
  47446. name: name,
  47447. query: query,
  47448. hash: hash,
  47449. params: params
  47450. }, undefined, location)
  47451. } else if (path) {
  47452. // 1. resolve relative redirect
  47453. var rawPath = resolveRecordPath(path, record);
  47454. // 2. resolve params
  47455. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  47456. // 3. rematch with existing query and hash
  47457. return match({
  47458. _normalized: true,
  47459. path: resolvedPath,
  47460. query: query,
  47461. hash: hash
  47462. }, undefined, location)
  47463. } else {
  47464. if (true) {
  47465. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  47466. }
  47467. return _createRoute(null, location)
  47468. }
  47469. }
  47470. function alias (
  47471. record,
  47472. location,
  47473. matchAs
  47474. ) {
  47475. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  47476. var aliasedMatch = match({
  47477. _normalized: true,
  47478. path: aliasedPath
  47479. });
  47480. if (aliasedMatch) {
  47481. var matched = aliasedMatch.matched;
  47482. var aliasedRecord = matched[matched.length - 1];
  47483. location.params = aliasedMatch.params;
  47484. return _createRoute(aliasedRecord, location)
  47485. }
  47486. return _createRoute(null, location)
  47487. }
  47488. function _createRoute (
  47489. record,
  47490. location,
  47491. redirectedFrom
  47492. ) {
  47493. if (record && record.redirect) {
  47494. return redirect(record, redirectedFrom || location)
  47495. }
  47496. if (record && record.matchAs) {
  47497. return alias(record, location, record.matchAs)
  47498. }
  47499. return createRoute(record, location, redirectedFrom, router)
  47500. }
  47501. return {
  47502. match: match,
  47503. addRoutes: addRoutes
  47504. }
  47505. }
  47506. function matchRoute (
  47507. regex,
  47508. path,
  47509. params
  47510. ) {
  47511. var m = path.match(regex);
  47512. if (!m) {
  47513. return false
  47514. } else if (!params) {
  47515. return true
  47516. }
  47517. for (var i = 1, len = m.length; i < len; ++i) {
  47518. var key = regex.keys[i - 1];
  47519. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  47520. if (key) {
  47521. // Fix #1994: using * with props: true generates a param named 0
  47522. params[key.name || 'pathMatch'] = val;
  47523. }
  47524. }
  47525. return true
  47526. }
  47527. function resolveRecordPath (path, record) {
  47528. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  47529. }
  47530. /* */
  47531. // use User Timing api (if present) for more accurate key precision
  47532. var Time =
  47533. inBrowser && window.performance && window.performance.now
  47534. ? window.performance
  47535. : Date;
  47536. function genStateKey () {
  47537. return Time.now().toFixed(3)
  47538. }
  47539. var _key = genStateKey();
  47540. function getStateKey () {
  47541. return _key
  47542. }
  47543. function setStateKey (key) {
  47544. return (_key = key)
  47545. }
  47546. /* */
  47547. var positionStore = Object.create(null);
  47548. function setupScroll () {
  47549. // Fix for #1585 for Firefox
  47550. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  47551. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  47552. // window.location.protocol + '//' + window.location.host
  47553. // location.host contains the port and location.hostname doesn't
  47554. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  47555. var absolutePath = window.location.href.replace(protocolAndPath, '');
  47556. // preserve existing history state as it could be overriden by the user
  47557. var stateCopy = extend({}, window.history.state);
  47558. stateCopy.key = getStateKey();
  47559. window.history.replaceState(stateCopy, '', absolutePath);
  47560. window.addEventListener('popstate', function (e) {
  47561. saveScrollPosition();
  47562. if (e.state && e.state.key) {
  47563. setStateKey(e.state.key);
  47564. }
  47565. });
  47566. }
  47567. function handleScroll (
  47568. router,
  47569. to,
  47570. from,
  47571. isPop
  47572. ) {
  47573. if (!router.app) {
  47574. return
  47575. }
  47576. var behavior = router.options.scrollBehavior;
  47577. if (!behavior) {
  47578. return
  47579. }
  47580. if (true) {
  47581. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  47582. }
  47583. // wait until re-render finishes before scrolling
  47584. router.app.$nextTick(function () {
  47585. var position = getScrollPosition();
  47586. var shouldScroll = behavior.call(
  47587. router,
  47588. to,
  47589. from,
  47590. isPop ? position : null
  47591. );
  47592. if (!shouldScroll) {
  47593. return
  47594. }
  47595. if (typeof shouldScroll.then === 'function') {
  47596. shouldScroll
  47597. .then(function (shouldScroll) {
  47598. scrollToPosition((shouldScroll), position);
  47599. })
  47600. .catch(function (err) {
  47601. if (true) {
  47602. assert(false, err.toString());
  47603. }
  47604. });
  47605. } else {
  47606. scrollToPosition(shouldScroll, position);
  47607. }
  47608. });
  47609. }
  47610. function saveScrollPosition () {
  47611. var key = getStateKey();
  47612. if (key) {
  47613. positionStore[key] = {
  47614. x: window.pageXOffset,
  47615. y: window.pageYOffset
  47616. };
  47617. }
  47618. }
  47619. function getScrollPosition () {
  47620. var key = getStateKey();
  47621. if (key) {
  47622. return positionStore[key]
  47623. }
  47624. }
  47625. function getElementPosition (el, offset) {
  47626. var docEl = document.documentElement;
  47627. var docRect = docEl.getBoundingClientRect();
  47628. var elRect = el.getBoundingClientRect();
  47629. return {
  47630. x: elRect.left - docRect.left - offset.x,
  47631. y: elRect.top - docRect.top - offset.y
  47632. }
  47633. }
  47634. function isValidPosition (obj) {
  47635. return isNumber(obj.x) || isNumber(obj.y)
  47636. }
  47637. function normalizePosition (obj) {
  47638. return {
  47639. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  47640. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  47641. }
  47642. }
  47643. function normalizeOffset (obj) {
  47644. return {
  47645. x: isNumber(obj.x) ? obj.x : 0,
  47646. y: isNumber(obj.y) ? obj.y : 0
  47647. }
  47648. }
  47649. function isNumber (v) {
  47650. return typeof v === 'number'
  47651. }
  47652. var hashStartsWithNumberRE = /^#\d/;
  47653. function scrollToPosition (shouldScroll, position) {
  47654. var isObject = typeof shouldScroll === 'object';
  47655. if (isObject && typeof shouldScroll.selector === 'string') {
  47656. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  47657. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  47658. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  47659. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  47660. : document.querySelector(shouldScroll.selector);
  47661. if (el) {
  47662. var offset =
  47663. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  47664. ? shouldScroll.offset
  47665. : {};
  47666. offset = normalizeOffset(offset);
  47667. position = getElementPosition(el, offset);
  47668. } else if (isValidPosition(shouldScroll)) {
  47669. position = normalizePosition(shouldScroll);
  47670. }
  47671. } else if (isObject && isValidPosition(shouldScroll)) {
  47672. position = normalizePosition(shouldScroll);
  47673. }
  47674. if (position) {
  47675. window.scrollTo(position.x, position.y);
  47676. }
  47677. }
  47678. /* */
  47679. var supportsPushState =
  47680. inBrowser &&
  47681. (function () {
  47682. var ua = window.navigator.userAgent;
  47683. if (
  47684. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  47685. ua.indexOf('Mobile Safari') !== -1 &&
  47686. ua.indexOf('Chrome') === -1 &&
  47687. ua.indexOf('Windows Phone') === -1
  47688. ) {
  47689. return false
  47690. }
  47691. return window.history && 'pushState' in window.history
  47692. })();
  47693. function pushState (url, replace) {
  47694. saveScrollPosition();
  47695. // try...catch the pushState call to get around Safari
  47696. // DOM Exception 18 where it limits to 100 pushState calls
  47697. var history = window.history;
  47698. try {
  47699. if (replace) {
  47700. // preserve existing history state as it could be overriden by the user
  47701. var stateCopy = extend({}, history.state);
  47702. stateCopy.key = getStateKey();
  47703. history.replaceState(stateCopy, '', url);
  47704. } else {
  47705. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  47706. }
  47707. } catch (e) {
  47708. window.location[replace ? 'replace' : 'assign'](url);
  47709. }
  47710. }
  47711. function replaceState (url) {
  47712. pushState(url, true);
  47713. }
  47714. /* */
  47715. function runQueue (queue, fn, cb) {
  47716. var step = function (index) {
  47717. if (index >= queue.length) {
  47718. cb();
  47719. } else {
  47720. if (queue[index]) {
  47721. fn(queue[index], function () {
  47722. step(index + 1);
  47723. });
  47724. } else {
  47725. step(index + 1);
  47726. }
  47727. }
  47728. };
  47729. step(0);
  47730. }
  47731. /* */
  47732. function resolveAsyncComponents (matched) {
  47733. return function (to, from, next) {
  47734. var hasAsync = false;
  47735. var pending = 0;
  47736. var error = null;
  47737. flatMapComponents(matched, function (def, _, match, key) {
  47738. // if it's a function and doesn't have cid attached,
  47739. // assume it's an async component resolve function.
  47740. // we are not using Vue's default async resolving mechanism because
  47741. // we want to halt the navigation until the incoming component has been
  47742. // resolved.
  47743. if (typeof def === 'function' && def.cid === undefined) {
  47744. hasAsync = true;
  47745. pending++;
  47746. var resolve = once(function (resolvedDef) {
  47747. if (isESModule(resolvedDef)) {
  47748. resolvedDef = resolvedDef.default;
  47749. }
  47750. // save resolved on async factory in case it's used elsewhere
  47751. def.resolved = typeof resolvedDef === 'function'
  47752. ? resolvedDef
  47753. : _Vue.extend(resolvedDef);
  47754. match.components[key] = resolvedDef;
  47755. pending--;
  47756. if (pending <= 0) {
  47757. next();
  47758. }
  47759. });
  47760. var reject = once(function (reason) {
  47761. var msg = "Failed to resolve async component " + key + ": " + reason;
  47762. true && warn(false, msg);
  47763. if (!error) {
  47764. error = isError(reason)
  47765. ? reason
  47766. : new Error(msg);
  47767. next(error);
  47768. }
  47769. });
  47770. var res;
  47771. try {
  47772. res = def(resolve, reject);
  47773. } catch (e) {
  47774. reject(e);
  47775. }
  47776. if (res) {
  47777. if (typeof res.then === 'function') {
  47778. res.then(resolve, reject);
  47779. } else {
  47780. // new syntax in Vue 2.3
  47781. var comp = res.component;
  47782. if (comp && typeof comp.then === 'function') {
  47783. comp.then(resolve, reject);
  47784. }
  47785. }
  47786. }
  47787. }
  47788. });
  47789. if (!hasAsync) { next(); }
  47790. }
  47791. }
  47792. function flatMapComponents (
  47793. matched,
  47794. fn
  47795. ) {
  47796. return flatten(matched.map(function (m) {
  47797. return Object.keys(m.components).map(function (key) { return fn(
  47798. m.components[key],
  47799. m.instances[key],
  47800. m, key
  47801. ); })
  47802. }))
  47803. }
  47804. function flatten (arr) {
  47805. return Array.prototype.concat.apply([], arr)
  47806. }
  47807. var hasSymbol =
  47808. typeof Symbol === 'function' &&
  47809. typeof Symbol.toStringTag === 'symbol';
  47810. function isESModule (obj) {
  47811. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  47812. }
  47813. // in Webpack 2, require.ensure now also returns a Promise
  47814. // so the resolve/reject functions may get called an extra time
  47815. // if the user uses an arrow function shorthand that happens to
  47816. // return that Promise.
  47817. function once (fn) {
  47818. var called = false;
  47819. return function () {
  47820. var args = [], len = arguments.length;
  47821. while ( len-- ) args[ len ] = arguments[ len ];
  47822. if (called) { return }
  47823. called = true;
  47824. return fn.apply(this, args)
  47825. }
  47826. }
  47827. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  47828. function NavigationDuplicated (normalizedLocation) {
  47829. Error.call(this);
  47830. this.name = this._name = 'NavigationDuplicated';
  47831. // passing the message to super() doesn't seem to work in the transpiled version
  47832. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  47833. // add a stack property so services like Sentry can correctly display it
  47834. Object.defineProperty(this, 'stack', {
  47835. value: new Error().stack,
  47836. writable: true,
  47837. configurable: true
  47838. });
  47839. // we could also have used
  47840. // Error.captureStackTrace(this, this.constructor)
  47841. // but it only exists on node and chrome
  47842. }
  47843. if ( Error ) NavigationDuplicated.__proto__ = Error;
  47844. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  47845. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  47846. return NavigationDuplicated;
  47847. }(Error));
  47848. // support IE9
  47849. NavigationDuplicated._name = 'NavigationDuplicated';
  47850. /* */
  47851. var History = function History (router, base) {
  47852. this.router = router;
  47853. this.base = normalizeBase(base);
  47854. // start with a route object that stands for "nowhere"
  47855. this.current = START;
  47856. this.pending = null;
  47857. this.ready = false;
  47858. this.readyCbs = [];
  47859. this.readyErrorCbs = [];
  47860. this.errorCbs = [];
  47861. };
  47862. History.prototype.listen = function listen (cb) {
  47863. this.cb = cb;
  47864. };
  47865. History.prototype.onReady = function onReady (cb, errorCb) {
  47866. if (this.ready) {
  47867. cb();
  47868. } else {
  47869. this.readyCbs.push(cb);
  47870. if (errorCb) {
  47871. this.readyErrorCbs.push(errorCb);
  47872. }
  47873. }
  47874. };
  47875. History.prototype.onError = function onError (errorCb) {
  47876. this.errorCbs.push(errorCb);
  47877. };
  47878. History.prototype.transitionTo = function transitionTo (
  47879. location,
  47880. onComplete,
  47881. onAbort
  47882. ) {
  47883. var this$1 = this;
  47884. var route = this.router.match(location, this.current);
  47885. this.confirmTransition(
  47886. route,
  47887. function () {
  47888. this$1.updateRoute(route);
  47889. onComplete && onComplete(route);
  47890. this$1.ensureURL();
  47891. // fire ready cbs once
  47892. if (!this$1.ready) {
  47893. this$1.ready = true;
  47894. this$1.readyCbs.forEach(function (cb) {
  47895. cb(route);
  47896. });
  47897. }
  47898. },
  47899. function (err) {
  47900. if (onAbort) {
  47901. onAbort(err);
  47902. }
  47903. if (err && !this$1.ready) {
  47904. this$1.ready = true;
  47905. this$1.readyErrorCbs.forEach(function (cb) {
  47906. cb(err);
  47907. });
  47908. }
  47909. }
  47910. );
  47911. };
  47912. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  47913. var this$1 = this;
  47914. var current = this.current;
  47915. var abort = function (err) {
  47916. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  47917. // When the user navigates through history through back/forward buttons
  47918. // we do not want to throw the error. We only throw it if directly calling
  47919. // push/replace. That's why it's not included in isError
  47920. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  47921. if (this$1.errorCbs.length) {
  47922. this$1.errorCbs.forEach(function (cb) {
  47923. cb(err);
  47924. });
  47925. } else {
  47926. warn(false, 'uncaught error during route navigation:');
  47927. console.error(err);
  47928. }
  47929. }
  47930. onAbort && onAbort(err);
  47931. };
  47932. if (
  47933. isSameRoute(route, current) &&
  47934. // in the case the route map has been dynamically appended to
  47935. route.matched.length === current.matched.length
  47936. ) {
  47937. this.ensureURL();
  47938. return abort(new NavigationDuplicated(route))
  47939. }
  47940. var ref = resolveQueue(
  47941. this.current.matched,
  47942. route.matched
  47943. );
  47944. var updated = ref.updated;
  47945. var deactivated = ref.deactivated;
  47946. var activated = ref.activated;
  47947. var queue = [].concat(
  47948. // in-component leave guards
  47949. extractLeaveGuards(deactivated),
  47950. // global before hooks
  47951. this.router.beforeHooks,
  47952. // in-component update hooks
  47953. extractUpdateHooks(updated),
  47954. // in-config enter guards
  47955. activated.map(function (m) { return m.beforeEnter; }),
  47956. // async components
  47957. resolveAsyncComponents(activated)
  47958. );
  47959. this.pending = route;
  47960. var iterator = function (hook, next) {
  47961. if (this$1.pending !== route) {
  47962. return abort()
  47963. }
  47964. try {
  47965. hook(route, current, function (to) {
  47966. if (to === false || isError(to)) {
  47967. // next(false) -> abort navigation, ensure current URL
  47968. this$1.ensureURL(true);
  47969. abort(to);
  47970. } else if (
  47971. typeof to === 'string' ||
  47972. (typeof to === 'object' &&
  47973. (typeof to.path === 'string' || typeof to.name === 'string'))
  47974. ) {
  47975. // next('/') or next({ path: '/' }) -> redirect
  47976. abort();
  47977. if (typeof to === 'object' && to.replace) {
  47978. this$1.replace(to);
  47979. } else {
  47980. this$1.push(to);
  47981. }
  47982. } else {
  47983. // confirm transition and pass on the value
  47984. next(to);
  47985. }
  47986. });
  47987. } catch (e) {
  47988. abort(e);
  47989. }
  47990. };
  47991. runQueue(queue, iterator, function () {
  47992. var postEnterCbs = [];
  47993. var isValid = function () { return this$1.current === route; };
  47994. // wait until async components are resolved before
  47995. // extracting in-component enter guards
  47996. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  47997. var queue = enterGuards.concat(this$1.router.resolveHooks);
  47998. runQueue(queue, iterator, function () {
  47999. if (this$1.pending !== route) {
  48000. return abort()
  48001. }
  48002. this$1.pending = null;
  48003. onComplete(route);
  48004. if (this$1.router.app) {
  48005. this$1.router.app.$nextTick(function () {
  48006. postEnterCbs.forEach(function (cb) {
  48007. cb();
  48008. });
  48009. });
  48010. }
  48011. });
  48012. });
  48013. };
  48014. History.prototype.updateRoute = function updateRoute (route) {
  48015. var prev = this.current;
  48016. this.current = route;
  48017. this.cb && this.cb(route);
  48018. this.router.afterHooks.forEach(function (hook) {
  48019. hook && hook(route, prev);
  48020. });
  48021. };
  48022. function normalizeBase (base) {
  48023. if (!base) {
  48024. if (inBrowser) {
  48025. // respect <base> tag
  48026. var baseEl = document.querySelector('base');
  48027. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48028. // strip full URL origin
  48029. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48030. } else {
  48031. base = '/';
  48032. }
  48033. }
  48034. // make sure there's the starting slash
  48035. if (base.charAt(0) !== '/') {
  48036. base = '/' + base;
  48037. }
  48038. // remove trailing slash
  48039. return base.replace(/\/$/, '')
  48040. }
  48041. function resolveQueue (
  48042. current,
  48043. next
  48044. ) {
  48045. var i;
  48046. var max = Math.max(current.length, next.length);
  48047. for (i = 0; i < max; i++) {
  48048. if (current[i] !== next[i]) {
  48049. break
  48050. }
  48051. }
  48052. return {
  48053. updated: next.slice(0, i),
  48054. activated: next.slice(i),
  48055. deactivated: current.slice(i)
  48056. }
  48057. }
  48058. function extractGuards (
  48059. records,
  48060. name,
  48061. bind,
  48062. reverse
  48063. ) {
  48064. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48065. var guard = extractGuard(def, name);
  48066. if (guard) {
  48067. return Array.isArray(guard)
  48068. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48069. : bind(guard, instance, match, key)
  48070. }
  48071. });
  48072. return flatten(reverse ? guards.reverse() : guards)
  48073. }
  48074. function extractGuard (
  48075. def,
  48076. key
  48077. ) {
  48078. if (typeof def !== 'function') {
  48079. // extend now so that global mixins are applied.
  48080. def = _Vue.extend(def);
  48081. }
  48082. return def.options[key]
  48083. }
  48084. function extractLeaveGuards (deactivated) {
  48085. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48086. }
  48087. function extractUpdateHooks (updated) {
  48088. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48089. }
  48090. function bindGuard (guard, instance) {
  48091. if (instance) {
  48092. return function boundRouteGuard () {
  48093. return guard.apply(instance, arguments)
  48094. }
  48095. }
  48096. }
  48097. function extractEnterGuards (
  48098. activated,
  48099. cbs,
  48100. isValid
  48101. ) {
  48102. return extractGuards(
  48103. activated,
  48104. 'beforeRouteEnter',
  48105. function (guard, _, match, key) {
  48106. return bindEnterGuard(guard, match, key, cbs, isValid)
  48107. }
  48108. )
  48109. }
  48110. function bindEnterGuard (
  48111. guard,
  48112. match,
  48113. key,
  48114. cbs,
  48115. isValid
  48116. ) {
  48117. return function routeEnterGuard (to, from, next) {
  48118. return guard(to, from, function (cb) {
  48119. if (typeof cb === 'function') {
  48120. cbs.push(function () {
  48121. // #750
  48122. // if a router-view is wrapped with an out-in transition,
  48123. // the instance may not have been registered at this time.
  48124. // we will need to poll for registration until current route
  48125. // is no longer valid.
  48126. poll(cb, match.instances, key, isValid);
  48127. });
  48128. }
  48129. next(cb);
  48130. })
  48131. }
  48132. }
  48133. function poll (
  48134. cb, // somehow flow cannot infer this is a function
  48135. instances,
  48136. key,
  48137. isValid
  48138. ) {
  48139. if (
  48140. instances[key] &&
  48141. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48142. ) {
  48143. cb(instances[key]);
  48144. } else if (isValid()) {
  48145. setTimeout(function () {
  48146. poll(cb, instances, key, isValid);
  48147. }, 16);
  48148. }
  48149. }
  48150. /* */
  48151. var HTML5History = /*@__PURE__*/(function (History) {
  48152. function HTML5History (router, base) {
  48153. var this$1 = this;
  48154. History.call(this, router, base);
  48155. var expectScroll = router.options.scrollBehavior;
  48156. var supportsScroll = supportsPushState && expectScroll;
  48157. if (supportsScroll) {
  48158. setupScroll();
  48159. }
  48160. var initLocation = getLocation(this.base);
  48161. window.addEventListener('popstate', function (e) {
  48162. var current = this$1.current;
  48163. // Avoiding first `popstate` event dispatched in some browsers but first
  48164. // history route not updated since async guard at the same time.
  48165. var location = getLocation(this$1.base);
  48166. if (this$1.current === START && location === initLocation) {
  48167. return
  48168. }
  48169. this$1.transitionTo(location, function (route) {
  48170. if (supportsScroll) {
  48171. handleScroll(router, route, current, true);
  48172. }
  48173. });
  48174. });
  48175. }
  48176. if ( History ) HTML5History.__proto__ = History;
  48177. HTML5History.prototype = Object.create( History && History.prototype );
  48178. HTML5History.prototype.constructor = HTML5History;
  48179. HTML5History.prototype.go = function go (n) {
  48180. window.history.go(n);
  48181. };
  48182. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48183. var this$1 = this;
  48184. var ref = this;
  48185. var fromRoute = ref.current;
  48186. this.transitionTo(location, function (route) {
  48187. pushState(cleanPath(this$1.base + route.fullPath));
  48188. handleScroll(this$1.router, route, fromRoute, false);
  48189. onComplete && onComplete(route);
  48190. }, onAbort);
  48191. };
  48192. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48193. var this$1 = this;
  48194. var ref = this;
  48195. var fromRoute = ref.current;
  48196. this.transitionTo(location, function (route) {
  48197. replaceState(cleanPath(this$1.base + route.fullPath));
  48198. handleScroll(this$1.router, route, fromRoute, false);
  48199. onComplete && onComplete(route);
  48200. }, onAbort);
  48201. };
  48202. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48203. if (getLocation(this.base) !== this.current.fullPath) {
  48204. var current = cleanPath(this.base + this.current.fullPath);
  48205. push ? pushState(current) : replaceState(current);
  48206. }
  48207. };
  48208. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48209. return getLocation(this.base)
  48210. };
  48211. return HTML5History;
  48212. }(History));
  48213. function getLocation (base) {
  48214. var path = decodeURI(window.location.pathname);
  48215. if (base && path.indexOf(base) === 0) {
  48216. path = path.slice(base.length);
  48217. }
  48218. return (path || '/') + window.location.search + window.location.hash
  48219. }
  48220. /* */
  48221. var HashHistory = /*@__PURE__*/(function (History) {
  48222. function HashHistory (router, base, fallback) {
  48223. History.call(this, router, base);
  48224. // check history fallback deeplinking
  48225. if (fallback && checkFallback(this.base)) {
  48226. return
  48227. }
  48228. ensureSlash();
  48229. }
  48230. if ( History ) HashHistory.__proto__ = History;
  48231. HashHistory.prototype = Object.create( History && History.prototype );
  48232. HashHistory.prototype.constructor = HashHistory;
  48233. // this is delayed until the app mounts
  48234. // to avoid the hashchange listener being fired too early
  48235. HashHistory.prototype.setupListeners = function setupListeners () {
  48236. var this$1 = this;
  48237. var router = this.router;
  48238. var expectScroll = router.options.scrollBehavior;
  48239. var supportsScroll = supportsPushState && expectScroll;
  48240. if (supportsScroll) {
  48241. setupScroll();
  48242. }
  48243. window.addEventListener(
  48244. supportsPushState ? 'popstate' : 'hashchange',
  48245. function () {
  48246. var current = this$1.current;
  48247. if (!ensureSlash()) {
  48248. return
  48249. }
  48250. this$1.transitionTo(getHash(), function (route) {
  48251. if (supportsScroll) {
  48252. handleScroll(this$1.router, route, current, true);
  48253. }
  48254. if (!supportsPushState) {
  48255. replaceHash(route.fullPath);
  48256. }
  48257. });
  48258. }
  48259. );
  48260. };
  48261. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48262. var this$1 = this;
  48263. var ref = this;
  48264. var fromRoute = ref.current;
  48265. this.transitionTo(
  48266. location,
  48267. function (route) {
  48268. pushHash(route.fullPath);
  48269. handleScroll(this$1.router, route, fromRoute, false);
  48270. onComplete && onComplete(route);
  48271. },
  48272. onAbort
  48273. );
  48274. };
  48275. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48276. var this$1 = this;
  48277. var ref = this;
  48278. var fromRoute = ref.current;
  48279. this.transitionTo(
  48280. location,
  48281. function (route) {
  48282. replaceHash(route.fullPath);
  48283. handleScroll(this$1.router, route, fromRoute, false);
  48284. onComplete && onComplete(route);
  48285. },
  48286. onAbort
  48287. );
  48288. };
  48289. HashHistory.prototype.go = function go (n) {
  48290. window.history.go(n);
  48291. };
  48292. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48293. var current = this.current.fullPath;
  48294. if (getHash() !== current) {
  48295. push ? pushHash(current) : replaceHash(current);
  48296. }
  48297. };
  48298. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48299. return getHash()
  48300. };
  48301. return HashHistory;
  48302. }(History));
  48303. function checkFallback (base) {
  48304. var location = getLocation(base);
  48305. if (!/^\/#/.test(location)) {
  48306. window.location.replace(cleanPath(base + '/#' + location));
  48307. return true
  48308. }
  48309. }
  48310. function ensureSlash () {
  48311. var path = getHash();
  48312. if (path.charAt(0) === '/') {
  48313. return true
  48314. }
  48315. replaceHash('/' + path);
  48316. return false
  48317. }
  48318. function getHash () {
  48319. // We can't use window.location.hash here because it's not
  48320. // consistent across browsers - Firefox will pre-decode it!
  48321. var href = window.location.href;
  48322. var index = href.indexOf('#');
  48323. // empty path
  48324. if (index < 0) { return '' }
  48325. href = href.slice(index + 1);
  48326. // decode the hash but not the search or hash
  48327. // as search(query) is already decoded
  48328. // https://github.com/vuejs/vue-router/issues/2708
  48329. var searchIndex = href.indexOf('?');
  48330. if (searchIndex < 0) {
  48331. var hashIndex = href.indexOf('#');
  48332. if (hashIndex > -1) {
  48333. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  48334. } else { href = decodeURI(href); }
  48335. } else {
  48336. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  48337. }
  48338. return href
  48339. }
  48340. function getUrl (path) {
  48341. var href = window.location.href;
  48342. var i = href.indexOf('#');
  48343. var base = i >= 0 ? href.slice(0, i) : href;
  48344. return (base + "#" + path)
  48345. }
  48346. function pushHash (path) {
  48347. if (supportsPushState) {
  48348. pushState(getUrl(path));
  48349. } else {
  48350. window.location.hash = path;
  48351. }
  48352. }
  48353. function replaceHash (path) {
  48354. if (supportsPushState) {
  48355. replaceState(getUrl(path));
  48356. } else {
  48357. window.location.replace(getUrl(path));
  48358. }
  48359. }
  48360. /* */
  48361. var AbstractHistory = /*@__PURE__*/(function (History) {
  48362. function AbstractHistory (router, base) {
  48363. History.call(this, router, base);
  48364. this.stack = [];
  48365. this.index = -1;
  48366. }
  48367. if ( History ) AbstractHistory.__proto__ = History;
  48368. AbstractHistory.prototype = Object.create( History && History.prototype );
  48369. AbstractHistory.prototype.constructor = AbstractHistory;
  48370. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  48371. var this$1 = this;
  48372. this.transitionTo(
  48373. location,
  48374. function (route) {
  48375. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  48376. this$1.index++;
  48377. onComplete && onComplete(route);
  48378. },
  48379. onAbort
  48380. );
  48381. };
  48382. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48383. var this$1 = this;
  48384. this.transitionTo(
  48385. location,
  48386. function (route) {
  48387. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  48388. onComplete && onComplete(route);
  48389. },
  48390. onAbort
  48391. );
  48392. };
  48393. AbstractHistory.prototype.go = function go (n) {
  48394. var this$1 = this;
  48395. var targetIndex = this.index + n;
  48396. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  48397. return
  48398. }
  48399. var route = this.stack[targetIndex];
  48400. this.confirmTransition(
  48401. route,
  48402. function () {
  48403. this$1.index = targetIndex;
  48404. this$1.updateRoute(route);
  48405. },
  48406. function (err) {
  48407. if (isExtendedError(NavigationDuplicated, err)) {
  48408. this$1.index = targetIndex;
  48409. }
  48410. }
  48411. );
  48412. };
  48413. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48414. var current = this.stack[this.stack.length - 1];
  48415. return current ? current.fullPath : '/'
  48416. };
  48417. AbstractHistory.prototype.ensureURL = function ensureURL () {
  48418. // noop
  48419. };
  48420. return AbstractHistory;
  48421. }(History));
  48422. /* */
  48423. var VueRouter = function VueRouter (options) {
  48424. if ( options === void 0 ) options = {};
  48425. this.app = null;
  48426. this.apps = [];
  48427. this.options = options;
  48428. this.beforeHooks = [];
  48429. this.resolveHooks = [];
  48430. this.afterHooks = [];
  48431. this.matcher = createMatcher(options.routes || [], this);
  48432. var mode = options.mode || 'hash';
  48433. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  48434. if (this.fallback) {
  48435. mode = 'hash';
  48436. }
  48437. if (!inBrowser) {
  48438. mode = 'abstract';
  48439. }
  48440. this.mode = mode;
  48441. switch (mode) {
  48442. case 'history':
  48443. this.history = new HTML5History(this, options.base);
  48444. break
  48445. case 'hash':
  48446. this.history = new HashHistory(this, options.base, this.fallback);
  48447. break
  48448. case 'abstract':
  48449. this.history = new AbstractHistory(this, options.base);
  48450. break
  48451. default:
  48452. if (true) {
  48453. assert(false, ("invalid mode: " + mode));
  48454. }
  48455. }
  48456. };
  48457. var prototypeAccessors = { currentRoute: { configurable: true } };
  48458. VueRouter.prototype.match = function match (
  48459. raw,
  48460. current,
  48461. redirectedFrom
  48462. ) {
  48463. return this.matcher.match(raw, current, redirectedFrom)
  48464. };
  48465. prototypeAccessors.currentRoute.get = function () {
  48466. return this.history && this.history.current
  48467. };
  48468. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  48469. var this$1 = this;
  48470. true && assert(
  48471. install.installed,
  48472. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  48473. "before creating root instance."
  48474. );
  48475. this.apps.push(app);
  48476. // set up app destroyed handler
  48477. // https://github.com/vuejs/vue-router/issues/2639
  48478. app.$once('hook:destroyed', function () {
  48479. // clean out app from this.apps array once destroyed
  48480. var index = this$1.apps.indexOf(app);
  48481. if (index > -1) { this$1.apps.splice(index, 1); }
  48482. // ensure we still have a main app or null if no apps
  48483. // we do not release the router so it can be reused
  48484. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  48485. });
  48486. // main app previously initialized
  48487. // return as we don't need to set up new history listener
  48488. if (this.app) {
  48489. return
  48490. }
  48491. this.app = app;
  48492. var history = this.history;
  48493. if (history instanceof HTML5History) {
  48494. history.transitionTo(history.getCurrentLocation());
  48495. } else if (history instanceof HashHistory) {
  48496. var setupHashListener = function () {
  48497. history.setupListeners();
  48498. };
  48499. history.transitionTo(
  48500. history.getCurrentLocation(),
  48501. setupHashListener,
  48502. setupHashListener
  48503. );
  48504. }
  48505. history.listen(function (route) {
  48506. this$1.apps.forEach(function (app) {
  48507. app._route = route;
  48508. });
  48509. });
  48510. };
  48511. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  48512. return registerHook(this.beforeHooks, fn)
  48513. };
  48514. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  48515. return registerHook(this.resolveHooks, fn)
  48516. };
  48517. VueRouter.prototype.afterEach = function afterEach (fn) {
  48518. return registerHook(this.afterHooks, fn)
  48519. };
  48520. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  48521. this.history.onReady(cb, errorCb);
  48522. };
  48523. VueRouter.prototype.onError = function onError (errorCb) {
  48524. this.history.onError(errorCb);
  48525. };
  48526. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  48527. var this$1 = this;
  48528. // $flow-disable-line
  48529. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  48530. return new Promise(function (resolve, reject) {
  48531. this$1.history.push(location, resolve, reject);
  48532. })
  48533. } else {
  48534. this.history.push(location, onComplete, onAbort);
  48535. }
  48536. };
  48537. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  48538. var this$1 = this;
  48539. // $flow-disable-line
  48540. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  48541. return new Promise(function (resolve, reject) {
  48542. this$1.history.replace(location, resolve, reject);
  48543. })
  48544. } else {
  48545. this.history.replace(location, onComplete, onAbort);
  48546. }
  48547. };
  48548. VueRouter.prototype.go = function go (n) {
  48549. this.history.go(n);
  48550. };
  48551. VueRouter.prototype.back = function back () {
  48552. this.go(-1);
  48553. };
  48554. VueRouter.prototype.forward = function forward () {
  48555. this.go(1);
  48556. };
  48557. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  48558. var route = to
  48559. ? to.matched
  48560. ? to
  48561. : this.resolve(to).route
  48562. : this.currentRoute;
  48563. if (!route) {
  48564. return []
  48565. }
  48566. return [].concat.apply([], route.matched.map(function (m) {
  48567. return Object.keys(m.components).map(function (key) {
  48568. return m.components[key]
  48569. })
  48570. }))
  48571. };
  48572. VueRouter.prototype.resolve = function resolve (
  48573. to,
  48574. current,
  48575. append
  48576. ) {
  48577. current = current || this.history.current;
  48578. var location = normalizeLocation(
  48579. to,
  48580. current,
  48581. append,
  48582. this
  48583. );
  48584. var route = this.match(location, current);
  48585. var fullPath = route.redirectedFrom || route.fullPath;
  48586. var base = this.history.base;
  48587. var href = createHref(base, fullPath, this.mode);
  48588. return {
  48589. location: location,
  48590. route: route,
  48591. href: href,
  48592. // for backwards compat
  48593. normalizedTo: location,
  48594. resolved: route
  48595. }
  48596. };
  48597. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  48598. this.matcher.addRoutes(routes);
  48599. if (this.history.current !== START) {
  48600. this.history.transitionTo(this.history.getCurrentLocation());
  48601. }
  48602. };
  48603. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  48604. function registerHook (list, fn) {
  48605. list.push(fn);
  48606. return function () {
  48607. var i = list.indexOf(fn);
  48608. if (i > -1) { list.splice(i, 1); }
  48609. }
  48610. }
  48611. function createHref (base, fullPath, mode) {
  48612. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  48613. return base ? cleanPath(base + '/' + path) : path
  48614. }
  48615. VueRouter.install = install;
  48616. VueRouter.version = '3.1.6';
  48617. if (inBrowser && window.Vue) {
  48618. window.Vue.use(VueRouter);
  48619. }
  48620. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  48621. /***/ }),
  48622. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  48623. /*!*************************************************!*\
  48624. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  48625. \*************************************************/
  48626. /*! no static exports found */
  48627. /***/ (function(module, exports, __webpack_require__) {
  48628. "use strict";
  48629. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  48630. * Vue.js v2.6.11
  48631. * (c) 2014-2019 Evan You
  48632. * Released under the MIT License.
  48633. */
  48634. /* */
  48635. var emptyObject = Object.freeze({});
  48636. // These helpers produce better VM code in JS engines due to their
  48637. // explicitness and function inlining.
  48638. function isUndef (v) {
  48639. return v === undefined || v === null
  48640. }
  48641. function isDef (v) {
  48642. return v !== undefined && v !== null
  48643. }
  48644. function isTrue (v) {
  48645. return v === true
  48646. }
  48647. function isFalse (v) {
  48648. return v === false
  48649. }
  48650. /**
  48651. * Check if value is primitive.
  48652. */
  48653. function isPrimitive (value) {
  48654. return (
  48655. typeof value === 'string' ||
  48656. typeof value === 'number' ||
  48657. // $flow-disable-line
  48658. typeof value === 'symbol' ||
  48659. typeof value === 'boolean'
  48660. )
  48661. }
  48662. /**
  48663. * Quick object check - this is primarily used to tell
  48664. * Objects from primitive values when we know the value
  48665. * is a JSON-compliant type.
  48666. */
  48667. function isObject (obj) {
  48668. return obj !== null && typeof obj === 'object'
  48669. }
  48670. /**
  48671. * Get the raw type string of a value, e.g., [object Object].
  48672. */
  48673. var _toString = Object.prototype.toString;
  48674. function toRawType (value) {
  48675. return _toString.call(value).slice(8, -1)
  48676. }
  48677. /**
  48678. * Strict object type check. Only returns true
  48679. * for plain JavaScript objects.
  48680. */
  48681. function isPlainObject (obj) {
  48682. return _toString.call(obj) === '[object Object]'
  48683. }
  48684. function isRegExp (v) {
  48685. return _toString.call(v) === '[object RegExp]'
  48686. }
  48687. /**
  48688. * Check if val is a valid array index.
  48689. */
  48690. function isValidArrayIndex (val) {
  48691. var n = parseFloat(String(val));
  48692. return n >= 0 && Math.floor(n) === n && isFinite(val)
  48693. }
  48694. function isPromise (val) {
  48695. return (
  48696. isDef(val) &&
  48697. typeof val.then === 'function' &&
  48698. typeof val.catch === 'function'
  48699. )
  48700. }
  48701. /**
  48702. * Convert a value to a string that is actually rendered.
  48703. */
  48704. function toString (val) {
  48705. return val == null
  48706. ? ''
  48707. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  48708. ? JSON.stringify(val, null, 2)
  48709. : String(val)
  48710. }
  48711. /**
  48712. * Convert an input value to a number for persistence.
  48713. * If the conversion fails, return original string.
  48714. */
  48715. function toNumber (val) {
  48716. var n = parseFloat(val);
  48717. return isNaN(n) ? val : n
  48718. }
  48719. /**
  48720. * Make a map and return a function for checking if a key
  48721. * is in that map.
  48722. */
  48723. function makeMap (
  48724. str,
  48725. expectsLowerCase
  48726. ) {
  48727. var map = Object.create(null);
  48728. var list = str.split(',');
  48729. for (var i = 0; i < list.length; i++) {
  48730. map[list[i]] = true;
  48731. }
  48732. return expectsLowerCase
  48733. ? function (val) { return map[val.toLowerCase()]; }
  48734. : function (val) { return map[val]; }
  48735. }
  48736. /**
  48737. * Check if a tag is a built-in tag.
  48738. */
  48739. var isBuiltInTag = makeMap('slot,component', true);
  48740. /**
  48741. * Check if an attribute is a reserved attribute.
  48742. */
  48743. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  48744. /**
  48745. * Remove an item from an array.
  48746. */
  48747. function remove (arr, item) {
  48748. if (arr.length) {
  48749. var index = arr.indexOf(item);
  48750. if (index > -1) {
  48751. return arr.splice(index, 1)
  48752. }
  48753. }
  48754. }
  48755. /**
  48756. * Check whether an object has the property.
  48757. */
  48758. var hasOwnProperty = Object.prototype.hasOwnProperty;
  48759. function hasOwn (obj, key) {
  48760. return hasOwnProperty.call(obj, key)
  48761. }
  48762. /**
  48763. * Create a cached version of a pure function.
  48764. */
  48765. function cached (fn) {
  48766. var cache = Object.create(null);
  48767. return (function cachedFn (str) {
  48768. var hit = cache[str];
  48769. return hit || (cache[str] = fn(str))
  48770. })
  48771. }
  48772. /**
  48773. * Camelize a hyphen-delimited string.
  48774. */
  48775. var camelizeRE = /-(\w)/g;
  48776. var camelize = cached(function (str) {
  48777. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  48778. });
  48779. /**
  48780. * Capitalize a string.
  48781. */
  48782. var capitalize = cached(function (str) {
  48783. return str.charAt(0).toUpperCase() + str.slice(1)
  48784. });
  48785. /**
  48786. * Hyphenate a camelCase string.
  48787. */
  48788. var hyphenateRE = /\B([A-Z])/g;
  48789. var hyphenate = cached(function (str) {
  48790. return str.replace(hyphenateRE, '-$1').toLowerCase()
  48791. });
  48792. /**
  48793. * Simple bind polyfill for environments that do not support it,
  48794. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  48795. * since native bind is now performant enough in most browsers.
  48796. * But removing it would mean breaking code that was able to run in
  48797. * PhantomJS 1.x, so this must be kept for backward compatibility.
  48798. */
  48799. /* istanbul ignore next */
  48800. function polyfillBind (fn, ctx) {
  48801. function boundFn (a) {
  48802. var l = arguments.length;
  48803. return l
  48804. ? l > 1
  48805. ? fn.apply(ctx, arguments)
  48806. : fn.call(ctx, a)
  48807. : fn.call(ctx)
  48808. }
  48809. boundFn._length = fn.length;
  48810. return boundFn
  48811. }
  48812. function nativeBind (fn, ctx) {
  48813. return fn.bind(ctx)
  48814. }
  48815. var bind = Function.prototype.bind
  48816. ? nativeBind
  48817. : polyfillBind;
  48818. /**
  48819. * Convert an Array-like object to a real Array.
  48820. */
  48821. function toArray (list, start) {
  48822. start = start || 0;
  48823. var i = list.length - start;
  48824. var ret = new Array(i);
  48825. while (i--) {
  48826. ret[i] = list[i + start];
  48827. }
  48828. return ret
  48829. }
  48830. /**
  48831. * Mix properties into target object.
  48832. */
  48833. function extend (to, _from) {
  48834. for (var key in _from) {
  48835. to[key] = _from[key];
  48836. }
  48837. return to
  48838. }
  48839. /**
  48840. * Merge an Array of Objects into a single Object.
  48841. */
  48842. function toObject (arr) {
  48843. var res = {};
  48844. for (var i = 0; i < arr.length; i++) {
  48845. if (arr[i]) {
  48846. extend(res, arr[i]);
  48847. }
  48848. }
  48849. return res
  48850. }
  48851. /* eslint-disable no-unused-vars */
  48852. /**
  48853. * Perform no operation.
  48854. * Stubbing args to make Flow happy without leaving useless transpiled code
  48855. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  48856. */
  48857. function noop (a, b, c) {}
  48858. /**
  48859. * Always return false.
  48860. */
  48861. var no = function (a, b, c) { return false; };
  48862. /* eslint-enable no-unused-vars */
  48863. /**
  48864. * Return the same value.
  48865. */
  48866. var identity = function (_) { return _; };
  48867. /**
  48868. * Generate a string containing static keys from compiler modules.
  48869. */
  48870. function genStaticKeys (modules) {
  48871. return modules.reduce(function (keys, m) {
  48872. return keys.concat(m.staticKeys || [])
  48873. }, []).join(',')
  48874. }
  48875. /**
  48876. * Check if two values are loosely equal - that is,
  48877. * if they are plain objects, do they have the same shape?
  48878. */
  48879. function looseEqual (a, b) {
  48880. if (a === b) { return true }
  48881. var isObjectA = isObject(a);
  48882. var isObjectB = isObject(b);
  48883. if (isObjectA && isObjectB) {
  48884. try {
  48885. var isArrayA = Array.isArray(a);
  48886. var isArrayB = Array.isArray(b);
  48887. if (isArrayA && isArrayB) {
  48888. return a.length === b.length && a.every(function (e, i) {
  48889. return looseEqual(e, b[i])
  48890. })
  48891. } else if (a instanceof Date && b instanceof Date) {
  48892. return a.getTime() === b.getTime()
  48893. } else if (!isArrayA && !isArrayB) {
  48894. var keysA = Object.keys(a);
  48895. var keysB = Object.keys(b);
  48896. return keysA.length === keysB.length && keysA.every(function (key) {
  48897. return looseEqual(a[key], b[key])
  48898. })
  48899. } else {
  48900. /* istanbul ignore next */
  48901. return false
  48902. }
  48903. } catch (e) {
  48904. /* istanbul ignore next */
  48905. return false
  48906. }
  48907. } else if (!isObjectA && !isObjectB) {
  48908. return String(a) === String(b)
  48909. } else {
  48910. return false
  48911. }
  48912. }
  48913. /**
  48914. * Return the first index at which a loosely equal value can be
  48915. * found in the array (if value is a plain object, the array must
  48916. * contain an object of the same shape), or -1 if it is not present.
  48917. */
  48918. function looseIndexOf (arr, val) {
  48919. for (var i = 0; i < arr.length; i++) {
  48920. if (looseEqual(arr[i], val)) { return i }
  48921. }
  48922. return -1
  48923. }
  48924. /**
  48925. * Ensure a function is called only once.
  48926. */
  48927. function once (fn) {
  48928. var called = false;
  48929. return function () {
  48930. if (!called) {
  48931. called = true;
  48932. fn.apply(this, arguments);
  48933. }
  48934. }
  48935. }
  48936. var SSR_ATTR = 'data-server-rendered';
  48937. var ASSET_TYPES = [
  48938. 'component',
  48939. 'directive',
  48940. 'filter'
  48941. ];
  48942. var LIFECYCLE_HOOKS = [
  48943. 'beforeCreate',
  48944. 'created',
  48945. 'beforeMount',
  48946. 'mounted',
  48947. 'beforeUpdate',
  48948. 'updated',
  48949. 'beforeDestroy',
  48950. 'destroyed',
  48951. 'activated',
  48952. 'deactivated',
  48953. 'errorCaptured',
  48954. 'serverPrefetch'
  48955. ];
  48956. /* */
  48957. var config = ({
  48958. /**
  48959. * Option merge strategies (used in core/util/options)
  48960. */
  48961. // $flow-disable-line
  48962. optionMergeStrategies: Object.create(null),
  48963. /**
  48964. * Whether to suppress warnings.
  48965. */
  48966. silent: false,
  48967. /**
  48968. * Show production mode tip message on boot?
  48969. */
  48970. productionTip: "development" !== 'production',
  48971. /**
  48972. * Whether to enable devtools
  48973. */
  48974. devtools: "development" !== 'production',
  48975. /**
  48976. * Whether to record perf
  48977. */
  48978. performance: false,
  48979. /**
  48980. * Error handler for watcher errors
  48981. */
  48982. errorHandler: null,
  48983. /**
  48984. * Warn handler for watcher warns
  48985. */
  48986. warnHandler: null,
  48987. /**
  48988. * Ignore certain custom elements
  48989. */
  48990. ignoredElements: [],
  48991. /**
  48992. * Custom user key aliases for v-on
  48993. */
  48994. // $flow-disable-line
  48995. keyCodes: Object.create(null),
  48996. /**
  48997. * Check if a tag is reserved so that it cannot be registered as a
  48998. * component. This is platform-dependent and may be overwritten.
  48999. */
  49000. isReservedTag: no,
  49001. /**
  49002. * Check if an attribute is reserved so that it cannot be used as a component
  49003. * prop. This is platform-dependent and may be overwritten.
  49004. */
  49005. isReservedAttr: no,
  49006. /**
  49007. * Check if a tag is an unknown element.
  49008. * Platform-dependent.
  49009. */
  49010. isUnknownElement: no,
  49011. /**
  49012. * Get the namespace of an element
  49013. */
  49014. getTagNamespace: noop,
  49015. /**
  49016. * Parse the real tag name for the specific platform.
  49017. */
  49018. parsePlatformTagName: identity,
  49019. /**
  49020. * Check if an attribute must be bound using property, e.g. value
  49021. * Platform-dependent.
  49022. */
  49023. mustUseProp: no,
  49024. /**
  49025. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49026. * This will significantly reduce performance if set to false.
  49027. */
  49028. async: true,
  49029. /**
  49030. * Exposed for legacy reasons
  49031. */
  49032. _lifecycleHooks: LIFECYCLE_HOOKS
  49033. });
  49034. /* */
  49035. /**
  49036. * unicode letters used for parsing html tags, component names and property paths.
  49037. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49038. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49039. */
  49040. 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/;
  49041. /**
  49042. * Check if a string starts with $ or _
  49043. */
  49044. function isReserved (str) {
  49045. var c = (str + '').charCodeAt(0);
  49046. return c === 0x24 || c === 0x5F
  49047. }
  49048. /**
  49049. * Define a property.
  49050. */
  49051. function def (obj, key, val, enumerable) {
  49052. Object.defineProperty(obj, key, {
  49053. value: val,
  49054. enumerable: !!enumerable,
  49055. writable: true,
  49056. configurable: true
  49057. });
  49058. }
  49059. /**
  49060. * Parse simple path.
  49061. */
  49062. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49063. function parsePath (path) {
  49064. if (bailRE.test(path)) {
  49065. return
  49066. }
  49067. var segments = path.split('.');
  49068. return function (obj) {
  49069. for (var i = 0; i < segments.length; i++) {
  49070. if (!obj) { return }
  49071. obj = obj[segments[i]];
  49072. }
  49073. return obj
  49074. }
  49075. }
  49076. /* */
  49077. // can we use __proto__?
  49078. var hasProto = '__proto__' in {};
  49079. // Browser environment sniffing
  49080. var inBrowser = typeof window !== 'undefined';
  49081. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49082. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49083. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49084. var isIE = UA && /msie|trident/.test(UA);
  49085. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49086. var isEdge = UA && UA.indexOf('edge/') > 0;
  49087. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49088. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49089. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49090. var isPhantomJS = UA && /phantomjs/.test(UA);
  49091. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49092. // Firefox has a "watch" function on Object.prototype...
  49093. var nativeWatch = ({}).watch;
  49094. var supportsPassive = false;
  49095. if (inBrowser) {
  49096. try {
  49097. var opts = {};
  49098. Object.defineProperty(opts, 'passive', ({
  49099. get: function get () {
  49100. /* istanbul ignore next */
  49101. supportsPassive = true;
  49102. }
  49103. })); // https://github.com/facebook/flow/issues/285
  49104. window.addEventListener('test-passive', null, opts);
  49105. } catch (e) {}
  49106. }
  49107. // this needs to be lazy-evaled because vue may be required before
  49108. // vue-server-renderer can set VUE_ENV
  49109. var _isServer;
  49110. var isServerRendering = function () {
  49111. if (_isServer === undefined) {
  49112. /* istanbul ignore if */
  49113. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49114. // detect presence of vue-server-renderer and avoid
  49115. // Webpack shimming the process
  49116. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49117. } else {
  49118. _isServer = false;
  49119. }
  49120. }
  49121. return _isServer
  49122. };
  49123. // detect devtools
  49124. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49125. /* istanbul ignore next */
  49126. function isNative (Ctor) {
  49127. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49128. }
  49129. var hasSymbol =
  49130. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49131. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49132. var _Set;
  49133. /* istanbul ignore if */ // $flow-disable-line
  49134. if (typeof Set !== 'undefined' && isNative(Set)) {
  49135. // use native Set when available.
  49136. _Set = Set;
  49137. } else {
  49138. // a non-standard Set polyfill that only works with primitive keys.
  49139. _Set = /*@__PURE__*/(function () {
  49140. function Set () {
  49141. this.set = Object.create(null);
  49142. }
  49143. Set.prototype.has = function has (key) {
  49144. return this.set[key] === true
  49145. };
  49146. Set.prototype.add = function add (key) {
  49147. this.set[key] = true;
  49148. };
  49149. Set.prototype.clear = function clear () {
  49150. this.set = Object.create(null);
  49151. };
  49152. return Set;
  49153. }());
  49154. }
  49155. /* */
  49156. var warn = noop;
  49157. var tip = noop;
  49158. var generateComponentTrace = (noop); // work around flow check
  49159. var formatComponentName = (noop);
  49160. {
  49161. var hasConsole = typeof console !== 'undefined';
  49162. var classifyRE = /(?:^|[-_])(\w)/g;
  49163. var classify = function (str) { return str
  49164. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49165. .replace(/[-_]/g, ''); };
  49166. warn = function (msg, vm) {
  49167. var trace = vm ? generateComponentTrace(vm) : '';
  49168. if (config.warnHandler) {
  49169. config.warnHandler.call(null, msg, vm, trace);
  49170. } else if (hasConsole && (!config.silent)) {
  49171. console.error(("[Vue warn]: " + msg + trace));
  49172. }
  49173. };
  49174. tip = function (msg, vm) {
  49175. if (hasConsole && (!config.silent)) {
  49176. console.warn("[Vue tip]: " + msg + (
  49177. vm ? generateComponentTrace(vm) : ''
  49178. ));
  49179. }
  49180. };
  49181. formatComponentName = function (vm, includeFile) {
  49182. if (vm.$root === vm) {
  49183. return '<Root>'
  49184. }
  49185. var options = typeof vm === 'function' && vm.cid != null
  49186. ? vm.options
  49187. : vm._isVue
  49188. ? vm.$options || vm.constructor.options
  49189. : vm;
  49190. var name = options.name || options._componentTag;
  49191. var file = options.__file;
  49192. if (!name && file) {
  49193. var match = file.match(/([^/\\]+)\.vue$/);
  49194. name = match && match[1];
  49195. }
  49196. return (
  49197. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49198. (file && includeFile !== false ? (" at " + file) : '')
  49199. )
  49200. };
  49201. var repeat = function (str, n) {
  49202. var res = '';
  49203. while (n) {
  49204. if (n % 2 === 1) { res += str; }
  49205. if (n > 1) { str += str; }
  49206. n >>= 1;
  49207. }
  49208. return res
  49209. };
  49210. generateComponentTrace = function (vm) {
  49211. if (vm._isVue && vm.$parent) {
  49212. var tree = [];
  49213. var currentRecursiveSequence = 0;
  49214. while (vm) {
  49215. if (tree.length > 0) {
  49216. var last = tree[tree.length - 1];
  49217. if (last.constructor === vm.constructor) {
  49218. currentRecursiveSequence++;
  49219. vm = vm.$parent;
  49220. continue
  49221. } else if (currentRecursiveSequence > 0) {
  49222. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49223. currentRecursiveSequence = 0;
  49224. }
  49225. }
  49226. tree.push(vm);
  49227. vm = vm.$parent;
  49228. }
  49229. return '\n\nfound in\n\n' + tree
  49230. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49231. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49232. : formatComponentName(vm))); })
  49233. .join('\n')
  49234. } else {
  49235. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49236. }
  49237. };
  49238. }
  49239. /* */
  49240. var uid = 0;
  49241. /**
  49242. * A dep is an observable that can have multiple
  49243. * directives subscribing to it.
  49244. */
  49245. var Dep = function Dep () {
  49246. this.id = uid++;
  49247. this.subs = [];
  49248. };
  49249. Dep.prototype.addSub = function addSub (sub) {
  49250. this.subs.push(sub);
  49251. };
  49252. Dep.prototype.removeSub = function removeSub (sub) {
  49253. remove(this.subs, sub);
  49254. };
  49255. Dep.prototype.depend = function depend () {
  49256. if (Dep.target) {
  49257. Dep.target.addDep(this);
  49258. }
  49259. };
  49260. Dep.prototype.notify = function notify () {
  49261. // stabilize the subscriber list first
  49262. var subs = this.subs.slice();
  49263. if (!config.async) {
  49264. // subs aren't sorted in scheduler if not running async
  49265. // we need to sort them now to make sure they fire in correct
  49266. // order
  49267. subs.sort(function (a, b) { return a.id - b.id; });
  49268. }
  49269. for (var i = 0, l = subs.length; i < l; i++) {
  49270. subs[i].update();
  49271. }
  49272. };
  49273. // The current target watcher being evaluated.
  49274. // This is globally unique because only one watcher
  49275. // can be evaluated at a time.
  49276. Dep.target = null;
  49277. var targetStack = [];
  49278. function pushTarget (target) {
  49279. targetStack.push(target);
  49280. Dep.target = target;
  49281. }
  49282. function popTarget () {
  49283. targetStack.pop();
  49284. Dep.target = targetStack[targetStack.length - 1];
  49285. }
  49286. /* */
  49287. var VNode = function VNode (
  49288. tag,
  49289. data,
  49290. children,
  49291. text,
  49292. elm,
  49293. context,
  49294. componentOptions,
  49295. asyncFactory
  49296. ) {
  49297. this.tag = tag;
  49298. this.data = data;
  49299. this.children = children;
  49300. this.text = text;
  49301. this.elm = elm;
  49302. this.ns = undefined;
  49303. this.context = context;
  49304. this.fnContext = undefined;
  49305. this.fnOptions = undefined;
  49306. this.fnScopeId = undefined;
  49307. this.key = data && data.key;
  49308. this.componentOptions = componentOptions;
  49309. this.componentInstance = undefined;
  49310. this.parent = undefined;
  49311. this.raw = false;
  49312. this.isStatic = false;
  49313. this.isRootInsert = true;
  49314. this.isComment = false;
  49315. this.isCloned = false;
  49316. this.isOnce = false;
  49317. this.asyncFactory = asyncFactory;
  49318. this.asyncMeta = undefined;
  49319. this.isAsyncPlaceholder = false;
  49320. };
  49321. var prototypeAccessors = { child: { configurable: true } };
  49322. // DEPRECATED: alias for componentInstance for backwards compat.
  49323. /* istanbul ignore next */
  49324. prototypeAccessors.child.get = function () {
  49325. return this.componentInstance
  49326. };
  49327. Object.defineProperties( VNode.prototype, prototypeAccessors );
  49328. var createEmptyVNode = function (text) {
  49329. if ( text === void 0 ) text = '';
  49330. var node = new VNode();
  49331. node.text = text;
  49332. node.isComment = true;
  49333. return node
  49334. };
  49335. function createTextVNode (val) {
  49336. return new VNode(undefined, undefined, undefined, String(val))
  49337. }
  49338. // optimized shallow clone
  49339. // used for static nodes and slot nodes because they may be reused across
  49340. // multiple renders, cloning them avoids errors when DOM manipulations rely
  49341. // on their elm reference.
  49342. function cloneVNode (vnode) {
  49343. var cloned = new VNode(
  49344. vnode.tag,
  49345. vnode.data,
  49346. // #7975
  49347. // clone children array to avoid mutating original in case of cloning
  49348. // a child.
  49349. vnode.children && vnode.children.slice(),
  49350. vnode.text,
  49351. vnode.elm,
  49352. vnode.context,
  49353. vnode.componentOptions,
  49354. vnode.asyncFactory
  49355. );
  49356. cloned.ns = vnode.ns;
  49357. cloned.isStatic = vnode.isStatic;
  49358. cloned.key = vnode.key;
  49359. cloned.isComment = vnode.isComment;
  49360. cloned.fnContext = vnode.fnContext;
  49361. cloned.fnOptions = vnode.fnOptions;
  49362. cloned.fnScopeId = vnode.fnScopeId;
  49363. cloned.asyncMeta = vnode.asyncMeta;
  49364. cloned.isCloned = true;
  49365. return cloned
  49366. }
  49367. /*
  49368. * not type checking this file because flow doesn't play well with
  49369. * dynamically accessing methods on Array prototype
  49370. */
  49371. var arrayProto = Array.prototype;
  49372. var arrayMethods = Object.create(arrayProto);
  49373. var methodsToPatch = [
  49374. 'push',
  49375. 'pop',
  49376. 'shift',
  49377. 'unshift',
  49378. 'splice',
  49379. 'sort',
  49380. 'reverse'
  49381. ];
  49382. /**
  49383. * Intercept mutating methods and emit events
  49384. */
  49385. methodsToPatch.forEach(function (method) {
  49386. // cache original method
  49387. var original = arrayProto[method];
  49388. def(arrayMethods, method, function mutator () {
  49389. var args = [], len = arguments.length;
  49390. while ( len-- ) args[ len ] = arguments[ len ];
  49391. var result = original.apply(this, args);
  49392. var ob = this.__ob__;
  49393. var inserted;
  49394. switch (method) {
  49395. case 'push':
  49396. case 'unshift':
  49397. inserted = args;
  49398. break
  49399. case 'splice':
  49400. inserted = args.slice(2);
  49401. break
  49402. }
  49403. if (inserted) { ob.observeArray(inserted); }
  49404. // notify change
  49405. ob.dep.notify();
  49406. return result
  49407. });
  49408. });
  49409. /* */
  49410. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  49411. /**
  49412. * In some cases we may want to disable observation inside a component's
  49413. * update computation.
  49414. */
  49415. var shouldObserve = true;
  49416. function toggleObserving (value) {
  49417. shouldObserve = value;
  49418. }
  49419. /**
  49420. * Observer class that is attached to each observed
  49421. * object. Once attached, the observer converts the target
  49422. * object's property keys into getter/setters that
  49423. * collect dependencies and dispatch updates.
  49424. */
  49425. var Observer = function Observer (value) {
  49426. this.value = value;
  49427. this.dep = new Dep();
  49428. this.vmCount = 0;
  49429. def(value, '__ob__', this);
  49430. if (Array.isArray(value)) {
  49431. if (hasProto) {
  49432. protoAugment(value, arrayMethods);
  49433. } else {
  49434. copyAugment(value, arrayMethods, arrayKeys);
  49435. }
  49436. this.observeArray(value);
  49437. } else {
  49438. this.walk(value);
  49439. }
  49440. };
  49441. /**
  49442. * Walk through all properties and convert them into
  49443. * getter/setters. This method should only be called when
  49444. * value type is Object.
  49445. */
  49446. Observer.prototype.walk = function walk (obj) {
  49447. var keys = Object.keys(obj);
  49448. for (var i = 0; i < keys.length; i++) {
  49449. defineReactive$$1(obj, keys[i]);
  49450. }
  49451. };
  49452. /**
  49453. * Observe a list of Array items.
  49454. */
  49455. Observer.prototype.observeArray = function observeArray (items) {
  49456. for (var i = 0, l = items.length; i < l; i++) {
  49457. observe(items[i]);
  49458. }
  49459. };
  49460. // helpers
  49461. /**
  49462. * Augment a target Object or Array by intercepting
  49463. * the prototype chain using __proto__
  49464. */
  49465. function protoAugment (target, src) {
  49466. /* eslint-disable no-proto */
  49467. target.__proto__ = src;
  49468. /* eslint-enable no-proto */
  49469. }
  49470. /**
  49471. * Augment a target Object or Array by defining
  49472. * hidden properties.
  49473. */
  49474. /* istanbul ignore next */
  49475. function copyAugment (target, src, keys) {
  49476. for (var i = 0, l = keys.length; i < l; i++) {
  49477. var key = keys[i];
  49478. def(target, key, src[key]);
  49479. }
  49480. }
  49481. /**
  49482. * Attempt to create an observer instance for a value,
  49483. * returns the new observer if successfully observed,
  49484. * or the existing observer if the value already has one.
  49485. */
  49486. function observe (value, asRootData) {
  49487. if (!isObject(value) || value instanceof VNode) {
  49488. return
  49489. }
  49490. var ob;
  49491. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  49492. ob = value.__ob__;
  49493. } else if (
  49494. shouldObserve &&
  49495. !isServerRendering() &&
  49496. (Array.isArray(value) || isPlainObject(value)) &&
  49497. Object.isExtensible(value) &&
  49498. !value._isVue
  49499. ) {
  49500. ob = new Observer(value);
  49501. }
  49502. if (asRootData && ob) {
  49503. ob.vmCount++;
  49504. }
  49505. return ob
  49506. }
  49507. /**
  49508. * Define a reactive property on an Object.
  49509. */
  49510. function defineReactive$$1 (
  49511. obj,
  49512. key,
  49513. val,
  49514. customSetter,
  49515. shallow
  49516. ) {
  49517. var dep = new Dep();
  49518. var property = Object.getOwnPropertyDescriptor(obj, key);
  49519. if (property && property.configurable === false) {
  49520. return
  49521. }
  49522. // cater for pre-defined getter/setters
  49523. var getter = property && property.get;
  49524. var setter = property && property.set;
  49525. if ((!getter || setter) && arguments.length === 2) {
  49526. val = obj[key];
  49527. }
  49528. var childOb = !shallow && observe(val);
  49529. Object.defineProperty(obj, key, {
  49530. enumerable: true,
  49531. configurable: true,
  49532. get: function reactiveGetter () {
  49533. var value = getter ? getter.call(obj) : val;
  49534. if (Dep.target) {
  49535. dep.depend();
  49536. if (childOb) {
  49537. childOb.dep.depend();
  49538. if (Array.isArray(value)) {
  49539. dependArray(value);
  49540. }
  49541. }
  49542. }
  49543. return value
  49544. },
  49545. set: function reactiveSetter (newVal) {
  49546. var value = getter ? getter.call(obj) : val;
  49547. /* eslint-disable no-self-compare */
  49548. if (newVal === value || (newVal !== newVal && value !== value)) {
  49549. return
  49550. }
  49551. /* eslint-enable no-self-compare */
  49552. if (customSetter) {
  49553. customSetter();
  49554. }
  49555. // #7981: for accessor properties without setter
  49556. if (getter && !setter) { return }
  49557. if (setter) {
  49558. setter.call(obj, newVal);
  49559. } else {
  49560. val = newVal;
  49561. }
  49562. childOb = !shallow && observe(newVal);
  49563. dep.notify();
  49564. }
  49565. });
  49566. }
  49567. /**
  49568. * Set a property on an object. Adds the new property and
  49569. * triggers change notification if the property doesn't
  49570. * already exist.
  49571. */
  49572. function set (target, key, val) {
  49573. if (isUndef(target) || isPrimitive(target)
  49574. ) {
  49575. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  49576. }
  49577. if (Array.isArray(target) && isValidArrayIndex(key)) {
  49578. target.length = Math.max(target.length, key);
  49579. target.splice(key, 1, val);
  49580. return val
  49581. }
  49582. if (key in target && !(key in Object.prototype)) {
  49583. target[key] = val;
  49584. return val
  49585. }
  49586. var ob = (target).__ob__;
  49587. if (target._isVue || (ob && ob.vmCount)) {
  49588. warn(
  49589. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  49590. 'at runtime - declare it upfront in the data option.'
  49591. );
  49592. return val
  49593. }
  49594. if (!ob) {
  49595. target[key] = val;
  49596. return val
  49597. }
  49598. defineReactive$$1(ob.value, key, val);
  49599. ob.dep.notify();
  49600. return val
  49601. }
  49602. /**
  49603. * Delete a property and trigger change if necessary.
  49604. */
  49605. function del (target, key) {
  49606. if (isUndef(target) || isPrimitive(target)
  49607. ) {
  49608. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  49609. }
  49610. if (Array.isArray(target) && isValidArrayIndex(key)) {
  49611. target.splice(key, 1);
  49612. return
  49613. }
  49614. var ob = (target).__ob__;
  49615. if (target._isVue || (ob && ob.vmCount)) {
  49616. warn(
  49617. 'Avoid deleting properties on a Vue instance or its root $data ' +
  49618. '- just set it to null.'
  49619. );
  49620. return
  49621. }
  49622. if (!hasOwn(target, key)) {
  49623. return
  49624. }
  49625. delete target[key];
  49626. if (!ob) {
  49627. return
  49628. }
  49629. ob.dep.notify();
  49630. }
  49631. /**
  49632. * Collect dependencies on array elements when the array is touched, since
  49633. * we cannot intercept array element access like property getters.
  49634. */
  49635. function dependArray (value) {
  49636. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  49637. e = value[i];
  49638. e && e.__ob__ && e.__ob__.dep.depend();
  49639. if (Array.isArray(e)) {
  49640. dependArray(e);
  49641. }
  49642. }
  49643. }
  49644. /* */
  49645. /**
  49646. * Option overwriting strategies are functions that handle
  49647. * how to merge a parent option value and a child option
  49648. * value into the final value.
  49649. */
  49650. var strats = config.optionMergeStrategies;
  49651. /**
  49652. * Options with restrictions
  49653. */
  49654. {
  49655. strats.el = strats.propsData = function (parent, child, vm, key) {
  49656. if (!vm) {
  49657. warn(
  49658. "option \"" + key + "\" can only be used during instance " +
  49659. 'creation with the `new` keyword.'
  49660. );
  49661. }
  49662. return defaultStrat(parent, child)
  49663. };
  49664. }
  49665. /**
  49666. * Helper that recursively merges two data objects together.
  49667. */
  49668. function mergeData (to, from) {
  49669. if (!from) { return to }
  49670. var key, toVal, fromVal;
  49671. var keys = hasSymbol
  49672. ? Reflect.ownKeys(from)
  49673. : Object.keys(from);
  49674. for (var i = 0; i < keys.length; i++) {
  49675. key = keys[i];
  49676. // in case the object is already observed...
  49677. if (key === '__ob__') { continue }
  49678. toVal = to[key];
  49679. fromVal = from[key];
  49680. if (!hasOwn(to, key)) {
  49681. set(to, key, fromVal);
  49682. } else if (
  49683. toVal !== fromVal &&
  49684. isPlainObject(toVal) &&
  49685. isPlainObject(fromVal)
  49686. ) {
  49687. mergeData(toVal, fromVal);
  49688. }
  49689. }
  49690. return to
  49691. }
  49692. /**
  49693. * Data
  49694. */
  49695. function mergeDataOrFn (
  49696. parentVal,
  49697. childVal,
  49698. vm
  49699. ) {
  49700. if (!vm) {
  49701. // in a Vue.extend merge, both should be functions
  49702. if (!childVal) {
  49703. return parentVal
  49704. }
  49705. if (!parentVal) {
  49706. return childVal
  49707. }
  49708. // when parentVal & childVal are both present,
  49709. // we need to return a function that returns the
  49710. // merged result of both functions... no need to
  49711. // check if parentVal is a function here because
  49712. // it has to be a function to pass previous merges.
  49713. return function mergedDataFn () {
  49714. return mergeData(
  49715. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  49716. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  49717. )
  49718. }
  49719. } else {
  49720. return function mergedInstanceDataFn () {
  49721. // instance merge
  49722. var instanceData = typeof childVal === 'function'
  49723. ? childVal.call(vm, vm)
  49724. : childVal;
  49725. var defaultData = typeof parentVal === 'function'
  49726. ? parentVal.call(vm, vm)
  49727. : parentVal;
  49728. if (instanceData) {
  49729. return mergeData(instanceData, defaultData)
  49730. } else {
  49731. return defaultData
  49732. }
  49733. }
  49734. }
  49735. }
  49736. strats.data = function (
  49737. parentVal,
  49738. childVal,
  49739. vm
  49740. ) {
  49741. if (!vm) {
  49742. if (childVal && typeof childVal !== 'function') {
  49743. warn(
  49744. 'The "data" option should be a function ' +
  49745. 'that returns a per-instance value in component ' +
  49746. 'definitions.',
  49747. vm
  49748. );
  49749. return parentVal
  49750. }
  49751. return mergeDataOrFn(parentVal, childVal)
  49752. }
  49753. return mergeDataOrFn(parentVal, childVal, vm)
  49754. };
  49755. /**
  49756. * Hooks and props are merged as arrays.
  49757. */
  49758. function mergeHook (
  49759. parentVal,
  49760. childVal
  49761. ) {
  49762. var res = childVal
  49763. ? parentVal
  49764. ? parentVal.concat(childVal)
  49765. : Array.isArray(childVal)
  49766. ? childVal
  49767. : [childVal]
  49768. : parentVal;
  49769. return res
  49770. ? dedupeHooks(res)
  49771. : res
  49772. }
  49773. function dedupeHooks (hooks) {
  49774. var res = [];
  49775. for (var i = 0; i < hooks.length; i++) {
  49776. if (res.indexOf(hooks[i]) === -1) {
  49777. res.push(hooks[i]);
  49778. }
  49779. }
  49780. return res
  49781. }
  49782. LIFECYCLE_HOOKS.forEach(function (hook) {
  49783. strats[hook] = mergeHook;
  49784. });
  49785. /**
  49786. * Assets
  49787. *
  49788. * When a vm is present (instance creation), we need to do
  49789. * a three-way merge between constructor options, instance
  49790. * options and parent options.
  49791. */
  49792. function mergeAssets (
  49793. parentVal,
  49794. childVal,
  49795. vm,
  49796. key
  49797. ) {
  49798. var res = Object.create(parentVal || null);
  49799. if (childVal) {
  49800. assertObjectType(key, childVal, vm);
  49801. return extend(res, childVal)
  49802. } else {
  49803. return res
  49804. }
  49805. }
  49806. ASSET_TYPES.forEach(function (type) {
  49807. strats[type + 's'] = mergeAssets;
  49808. });
  49809. /**
  49810. * Watchers.
  49811. *
  49812. * Watchers hashes should not overwrite one
  49813. * another, so we merge them as arrays.
  49814. */
  49815. strats.watch = function (
  49816. parentVal,
  49817. childVal,
  49818. vm,
  49819. key
  49820. ) {
  49821. // work around Firefox's Object.prototype.watch...
  49822. if (parentVal === nativeWatch) { parentVal = undefined; }
  49823. if (childVal === nativeWatch) { childVal = undefined; }
  49824. /* istanbul ignore if */
  49825. if (!childVal) { return Object.create(parentVal || null) }
  49826. {
  49827. assertObjectType(key, childVal, vm);
  49828. }
  49829. if (!parentVal) { return childVal }
  49830. var ret = {};
  49831. extend(ret, parentVal);
  49832. for (var key$1 in childVal) {
  49833. var parent = ret[key$1];
  49834. var child = childVal[key$1];
  49835. if (parent && !Array.isArray(parent)) {
  49836. parent = [parent];
  49837. }
  49838. ret[key$1] = parent
  49839. ? parent.concat(child)
  49840. : Array.isArray(child) ? child : [child];
  49841. }
  49842. return ret
  49843. };
  49844. /**
  49845. * Other object hashes.
  49846. */
  49847. strats.props =
  49848. strats.methods =
  49849. strats.inject =
  49850. strats.computed = function (
  49851. parentVal,
  49852. childVal,
  49853. vm,
  49854. key
  49855. ) {
  49856. if (childVal && "development" !== 'production') {
  49857. assertObjectType(key, childVal, vm);
  49858. }
  49859. if (!parentVal) { return childVal }
  49860. var ret = Object.create(null);
  49861. extend(ret, parentVal);
  49862. if (childVal) { extend(ret, childVal); }
  49863. return ret
  49864. };
  49865. strats.provide = mergeDataOrFn;
  49866. /**
  49867. * Default strategy.
  49868. */
  49869. var defaultStrat = function (parentVal, childVal) {
  49870. return childVal === undefined
  49871. ? parentVal
  49872. : childVal
  49873. };
  49874. /**
  49875. * Validate component names
  49876. */
  49877. function checkComponents (options) {
  49878. for (var key in options.components) {
  49879. validateComponentName(key);
  49880. }
  49881. }
  49882. function validateComponentName (name) {
  49883. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  49884. warn(
  49885. 'Invalid component name: "' + name + '". Component names ' +
  49886. 'should conform to valid custom element name in html5 specification.'
  49887. );
  49888. }
  49889. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  49890. warn(
  49891. 'Do not use built-in or reserved HTML elements as component ' +
  49892. 'id: ' + name
  49893. );
  49894. }
  49895. }
  49896. /**
  49897. * Ensure all props option syntax are normalized into the
  49898. * Object-based format.
  49899. */
  49900. function normalizeProps (options, vm) {
  49901. var props = options.props;
  49902. if (!props) { return }
  49903. var res = {};
  49904. var i, val, name;
  49905. if (Array.isArray(props)) {
  49906. i = props.length;
  49907. while (i--) {
  49908. val = props[i];
  49909. if (typeof val === 'string') {
  49910. name = camelize(val);
  49911. res[name] = { type: null };
  49912. } else {
  49913. warn('props must be strings when using array syntax.');
  49914. }
  49915. }
  49916. } else if (isPlainObject(props)) {
  49917. for (var key in props) {
  49918. val = props[key];
  49919. name = camelize(key);
  49920. res[name] = isPlainObject(val)
  49921. ? val
  49922. : { type: val };
  49923. }
  49924. } else {
  49925. warn(
  49926. "Invalid value for option \"props\": expected an Array or an Object, " +
  49927. "but got " + (toRawType(props)) + ".",
  49928. vm
  49929. );
  49930. }
  49931. options.props = res;
  49932. }
  49933. /**
  49934. * Normalize all injections into Object-based format
  49935. */
  49936. function normalizeInject (options, vm) {
  49937. var inject = options.inject;
  49938. if (!inject) { return }
  49939. var normalized = options.inject = {};
  49940. if (Array.isArray(inject)) {
  49941. for (var i = 0; i < inject.length; i++) {
  49942. normalized[inject[i]] = { from: inject[i] };
  49943. }
  49944. } else if (isPlainObject(inject)) {
  49945. for (var key in inject) {
  49946. var val = inject[key];
  49947. normalized[key] = isPlainObject(val)
  49948. ? extend({ from: key }, val)
  49949. : { from: val };
  49950. }
  49951. } else {
  49952. warn(
  49953. "Invalid value for option \"inject\": expected an Array or an Object, " +
  49954. "but got " + (toRawType(inject)) + ".",
  49955. vm
  49956. );
  49957. }
  49958. }
  49959. /**
  49960. * Normalize raw function directives into object format.
  49961. */
  49962. function normalizeDirectives (options) {
  49963. var dirs = options.directives;
  49964. if (dirs) {
  49965. for (var key in dirs) {
  49966. var def$$1 = dirs[key];
  49967. if (typeof def$$1 === 'function') {
  49968. dirs[key] = { bind: def$$1, update: def$$1 };
  49969. }
  49970. }
  49971. }
  49972. }
  49973. function assertObjectType (name, value, vm) {
  49974. if (!isPlainObject(value)) {
  49975. warn(
  49976. "Invalid value for option \"" + name + "\": expected an Object, " +
  49977. "but got " + (toRawType(value)) + ".",
  49978. vm
  49979. );
  49980. }
  49981. }
  49982. /**
  49983. * Merge two option objects into a new one.
  49984. * Core utility used in both instantiation and inheritance.
  49985. */
  49986. function mergeOptions (
  49987. parent,
  49988. child,
  49989. vm
  49990. ) {
  49991. {
  49992. checkComponents(child);
  49993. }
  49994. if (typeof child === 'function') {
  49995. child = child.options;
  49996. }
  49997. normalizeProps(child, vm);
  49998. normalizeInject(child, vm);
  49999. normalizeDirectives(child);
  50000. // Apply extends and mixins on the child options,
  50001. // but only if it is a raw options object that isn't
  50002. // the result of another mergeOptions call.
  50003. // Only merged options has the _base property.
  50004. if (!child._base) {
  50005. if (child.extends) {
  50006. parent = mergeOptions(parent, child.extends, vm);
  50007. }
  50008. if (child.mixins) {
  50009. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50010. parent = mergeOptions(parent, child.mixins[i], vm);
  50011. }
  50012. }
  50013. }
  50014. var options = {};
  50015. var key;
  50016. for (key in parent) {
  50017. mergeField(key);
  50018. }
  50019. for (key in child) {
  50020. if (!hasOwn(parent, key)) {
  50021. mergeField(key);
  50022. }
  50023. }
  50024. function mergeField (key) {
  50025. var strat = strats[key] || defaultStrat;
  50026. options[key] = strat(parent[key], child[key], vm, key);
  50027. }
  50028. return options
  50029. }
  50030. /**
  50031. * Resolve an asset.
  50032. * This function is used because child instances need access
  50033. * to assets defined in its ancestor chain.
  50034. */
  50035. function resolveAsset (
  50036. options,
  50037. type,
  50038. id,
  50039. warnMissing
  50040. ) {
  50041. /* istanbul ignore if */
  50042. if (typeof id !== 'string') {
  50043. return
  50044. }
  50045. var assets = options[type];
  50046. // check local registration variations first
  50047. if (hasOwn(assets, id)) { return assets[id] }
  50048. var camelizedId = camelize(id);
  50049. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50050. var PascalCaseId = capitalize(camelizedId);
  50051. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50052. // fallback to prototype chain
  50053. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50054. if (warnMissing && !res) {
  50055. warn(
  50056. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50057. options
  50058. );
  50059. }
  50060. return res
  50061. }
  50062. /* */
  50063. function validateProp (
  50064. key,
  50065. propOptions,
  50066. propsData,
  50067. vm
  50068. ) {
  50069. var prop = propOptions[key];
  50070. var absent = !hasOwn(propsData, key);
  50071. var value = propsData[key];
  50072. // boolean casting
  50073. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50074. if (booleanIndex > -1) {
  50075. if (absent && !hasOwn(prop, 'default')) {
  50076. value = false;
  50077. } else if (value === '' || value === hyphenate(key)) {
  50078. // only cast empty string / same name to boolean if
  50079. // boolean has higher priority
  50080. var stringIndex = getTypeIndex(String, prop.type);
  50081. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50082. value = true;
  50083. }
  50084. }
  50085. }
  50086. // check default value
  50087. if (value === undefined) {
  50088. value = getPropDefaultValue(vm, prop, key);
  50089. // since the default value is a fresh copy,
  50090. // make sure to observe it.
  50091. var prevShouldObserve = shouldObserve;
  50092. toggleObserving(true);
  50093. observe(value);
  50094. toggleObserving(prevShouldObserve);
  50095. }
  50096. {
  50097. assertProp(prop, key, value, vm, absent);
  50098. }
  50099. return value
  50100. }
  50101. /**
  50102. * Get the default value of a prop.
  50103. */
  50104. function getPropDefaultValue (vm, prop, key) {
  50105. // no default, return undefined
  50106. if (!hasOwn(prop, 'default')) {
  50107. return undefined
  50108. }
  50109. var def = prop.default;
  50110. // warn against non-factory defaults for Object & Array
  50111. if (isObject(def)) {
  50112. warn(
  50113. 'Invalid default value for prop "' + key + '": ' +
  50114. 'Props with type Object/Array must use a factory function ' +
  50115. 'to return the default value.',
  50116. vm
  50117. );
  50118. }
  50119. // the raw prop value was also undefined from previous render,
  50120. // return previous default value to avoid unnecessary watcher trigger
  50121. if (vm && vm.$options.propsData &&
  50122. vm.$options.propsData[key] === undefined &&
  50123. vm._props[key] !== undefined
  50124. ) {
  50125. return vm._props[key]
  50126. }
  50127. // call factory function for non-Function types
  50128. // a value is Function if its prototype is function even across different execution context
  50129. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50130. ? def.call(vm)
  50131. : def
  50132. }
  50133. /**
  50134. * Assert whether a prop is valid.
  50135. */
  50136. function assertProp (
  50137. prop,
  50138. name,
  50139. value,
  50140. vm,
  50141. absent
  50142. ) {
  50143. if (prop.required && absent) {
  50144. warn(
  50145. 'Missing required prop: "' + name + '"',
  50146. vm
  50147. );
  50148. return
  50149. }
  50150. if (value == null && !prop.required) {
  50151. return
  50152. }
  50153. var type = prop.type;
  50154. var valid = !type || type === true;
  50155. var expectedTypes = [];
  50156. if (type) {
  50157. if (!Array.isArray(type)) {
  50158. type = [type];
  50159. }
  50160. for (var i = 0; i < type.length && !valid; i++) {
  50161. var assertedType = assertType(value, type[i]);
  50162. expectedTypes.push(assertedType.expectedType || '');
  50163. valid = assertedType.valid;
  50164. }
  50165. }
  50166. if (!valid) {
  50167. warn(
  50168. getInvalidTypeMessage(name, value, expectedTypes),
  50169. vm
  50170. );
  50171. return
  50172. }
  50173. var validator = prop.validator;
  50174. if (validator) {
  50175. if (!validator(value)) {
  50176. warn(
  50177. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50178. vm
  50179. );
  50180. }
  50181. }
  50182. }
  50183. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50184. function assertType (value, type) {
  50185. var valid;
  50186. var expectedType = getType(type);
  50187. if (simpleCheckRE.test(expectedType)) {
  50188. var t = typeof value;
  50189. valid = t === expectedType.toLowerCase();
  50190. // for primitive wrapper objects
  50191. if (!valid && t === 'object') {
  50192. valid = value instanceof type;
  50193. }
  50194. } else if (expectedType === 'Object') {
  50195. valid = isPlainObject(value);
  50196. } else if (expectedType === 'Array') {
  50197. valid = Array.isArray(value);
  50198. } else {
  50199. valid = value instanceof type;
  50200. }
  50201. return {
  50202. valid: valid,
  50203. expectedType: expectedType
  50204. }
  50205. }
  50206. /**
  50207. * Use function string name to check built-in types,
  50208. * because a simple equality check will fail when running
  50209. * across different vms / iframes.
  50210. */
  50211. function getType (fn) {
  50212. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50213. return match ? match[1] : ''
  50214. }
  50215. function isSameType (a, b) {
  50216. return getType(a) === getType(b)
  50217. }
  50218. function getTypeIndex (type, expectedTypes) {
  50219. if (!Array.isArray(expectedTypes)) {
  50220. return isSameType(expectedTypes, type) ? 0 : -1
  50221. }
  50222. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50223. if (isSameType(expectedTypes[i], type)) {
  50224. return i
  50225. }
  50226. }
  50227. return -1
  50228. }
  50229. function getInvalidTypeMessage (name, value, expectedTypes) {
  50230. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50231. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50232. var expectedType = expectedTypes[0];
  50233. var receivedType = toRawType(value);
  50234. var expectedValue = styleValue(value, expectedType);
  50235. var receivedValue = styleValue(value, receivedType);
  50236. // check if we need to specify expected value
  50237. if (expectedTypes.length === 1 &&
  50238. isExplicable(expectedType) &&
  50239. !isBoolean(expectedType, receivedType)) {
  50240. message += " with value " + expectedValue;
  50241. }
  50242. message += ", got " + receivedType + " ";
  50243. // check if we need to specify received value
  50244. if (isExplicable(receivedType)) {
  50245. message += "with value " + receivedValue + ".";
  50246. }
  50247. return message
  50248. }
  50249. function styleValue (value, type) {
  50250. if (type === 'String') {
  50251. return ("\"" + value + "\"")
  50252. } else if (type === 'Number') {
  50253. return ("" + (Number(value)))
  50254. } else {
  50255. return ("" + value)
  50256. }
  50257. }
  50258. function isExplicable (value) {
  50259. var explicitTypes = ['string', 'number', 'boolean'];
  50260. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50261. }
  50262. function isBoolean () {
  50263. var args = [], len = arguments.length;
  50264. while ( len-- ) args[ len ] = arguments[ len ];
  50265. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50266. }
  50267. /* */
  50268. function handleError (err, vm, info) {
  50269. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50270. // See: https://github.com/vuejs/vuex/issues/1505
  50271. pushTarget();
  50272. try {
  50273. if (vm) {
  50274. var cur = vm;
  50275. while ((cur = cur.$parent)) {
  50276. var hooks = cur.$options.errorCaptured;
  50277. if (hooks) {
  50278. for (var i = 0; i < hooks.length; i++) {
  50279. try {
  50280. var capture = hooks[i].call(cur, err, vm, info) === false;
  50281. if (capture) { return }
  50282. } catch (e) {
  50283. globalHandleError(e, cur, 'errorCaptured hook');
  50284. }
  50285. }
  50286. }
  50287. }
  50288. }
  50289. globalHandleError(err, vm, info);
  50290. } finally {
  50291. popTarget();
  50292. }
  50293. }
  50294. function invokeWithErrorHandling (
  50295. handler,
  50296. context,
  50297. args,
  50298. vm,
  50299. info
  50300. ) {
  50301. var res;
  50302. try {
  50303. res = args ? handler.apply(context, args) : handler.call(context);
  50304. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50305. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50306. // issue #9511
  50307. // avoid catch triggering multiple times when nested calls
  50308. res._handled = true;
  50309. }
  50310. } catch (e) {
  50311. handleError(e, vm, info);
  50312. }
  50313. return res
  50314. }
  50315. function globalHandleError (err, vm, info) {
  50316. if (config.errorHandler) {
  50317. try {
  50318. return config.errorHandler.call(null, err, vm, info)
  50319. } catch (e) {
  50320. // if the user intentionally throws the original error in the handler,
  50321. // do not log it twice
  50322. if (e !== err) {
  50323. logError(e, null, 'config.errorHandler');
  50324. }
  50325. }
  50326. }
  50327. logError(err, vm, info);
  50328. }
  50329. function logError (err, vm, info) {
  50330. {
  50331. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  50332. }
  50333. /* istanbul ignore else */
  50334. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  50335. console.error(err);
  50336. } else {
  50337. throw err
  50338. }
  50339. }
  50340. /* */
  50341. var isUsingMicroTask = false;
  50342. var callbacks = [];
  50343. var pending = false;
  50344. function flushCallbacks () {
  50345. pending = false;
  50346. var copies = callbacks.slice(0);
  50347. callbacks.length = 0;
  50348. for (var i = 0; i < copies.length; i++) {
  50349. copies[i]();
  50350. }
  50351. }
  50352. // Here we have async deferring wrappers using microtasks.
  50353. // In 2.5 we used (macro) tasks (in combination with microtasks).
  50354. // However, it has subtle problems when state is changed right before repaint
  50355. // (e.g. #6813, out-in transitions).
  50356. // Also, using (macro) tasks in event handler would cause some weird behaviors
  50357. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  50358. // So we now use microtasks everywhere, again.
  50359. // A major drawback of this tradeoff is that there are some scenarios
  50360. // where microtasks have too high a priority and fire in between supposedly
  50361. // sequential events (e.g. #4521, #6690, which have workarounds)
  50362. // or even between bubbling of the same event (#6566).
  50363. var timerFunc;
  50364. // The nextTick behavior leverages the microtask queue, which can be accessed
  50365. // via either native Promise.then or MutationObserver.
  50366. // MutationObserver has wider support, however it is seriously bugged in
  50367. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  50368. // completely stops working after triggering a few times... so, if native
  50369. // Promise is available, we will use it:
  50370. /* istanbul ignore next, $flow-disable-line */
  50371. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  50372. var p = Promise.resolve();
  50373. timerFunc = function () {
  50374. p.then(flushCallbacks);
  50375. // In problematic UIWebViews, Promise.then doesn't completely break, but
  50376. // it can get stuck in a weird state where callbacks are pushed into the
  50377. // microtask queue but the queue isn't being flushed, until the browser
  50378. // needs to do some other work, e.g. handle a timer. Therefore we can
  50379. // "force" the microtask queue to be flushed by adding an empty timer.
  50380. if (isIOS) { setTimeout(noop); }
  50381. };
  50382. isUsingMicroTask = true;
  50383. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  50384. isNative(MutationObserver) ||
  50385. // PhantomJS and iOS 7.x
  50386. MutationObserver.toString() === '[object MutationObserverConstructor]'
  50387. )) {
  50388. // Use MutationObserver where native Promise is not available,
  50389. // e.g. PhantomJS, iOS7, Android 4.4
  50390. // (#6466 MutationObserver is unreliable in IE11)
  50391. var counter = 1;
  50392. var observer = new MutationObserver(flushCallbacks);
  50393. var textNode = document.createTextNode(String(counter));
  50394. observer.observe(textNode, {
  50395. characterData: true
  50396. });
  50397. timerFunc = function () {
  50398. counter = (counter + 1) % 2;
  50399. textNode.data = String(counter);
  50400. };
  50401. isUsingMicroTask = true;
  50402. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  50403. // Fallback to setImmediate.
  50404. // Technically it leverages the (macro) task queue,
  50405. // but it is still a better choice than setTimeout.
  50406. timerFunc = function () {
  50407. setImmediate(flushCallbacks);
  50408. };
  50409. } else {
  50410. // Fallback to setTimeout.
  50411. timerFunc = function () {
  50412. setTimeout(flushCallbacks, 0);
  50413. };
  50414. }
  50415. function nextTick (cb, ctx) {
  50416. var _resolve;
  50417. callbacks.push(function () {
  50418. if (cb) {
  50419. try {
  50420. cb.call(ctx);
  50421. } catch (e) {
  50422. handleError(e, ctx, 'nextTick');
  50423. }
  50424. } else if (_resolve) {
  50425. _resolve(ctx);
  50426. }
  50427. });
  50428. if (!pending) {
  50429. pending = true;
  50430. timerFunc();
  50431. }
  50432. // $flow-disable-line
  50433. if (!cb && typeof Promise !== 'undefined') {
  50434. return new Promise(function (resolve) {
  50435. _resolve = resolve;
  50436. })
  50437. }
  50438. }
  50439. /* */
  50440. var mark;
  50441. var measure;
  50442. {
  50443. var perf = inBrowser && window.performance;
  50444. /* istanbul ignore if */
  50445. if (
  50446. perf &&
  50447. perf.mark &&
  50448. perf.measure &&
  50449. perf.clearMarks &&
  50450. perf.clearMeasures
  50451. ) {
  50452. mark = function (tag) { return perf.mark(tag); };
  50453. measure = function (name, startTag, endTag) {
  50454. perf.measure(name, startTag, endTag);
  50455. perf.clearMarks(startTag);
  50456. perf.clearMarks(endTag);
  50457. // perf.clearMeasures(name)
  50458. };
  50459. }
  50460. }
  50461. /* not type checking this file because flow doesn't play well with Proxy */
  50462. var initProxy;
  50463. {
  50464. var allowedGlobals = makeMap(
  50465. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  50466. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  50467. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  50468. 'require' // for Webpack/Browserify
  50469. );
  50470. var warnNonPresent = function (target, key) {
  50471. warn(
  50472. "Property or method \"" + key + "\" is not defined on the instance but " +
  50473. 'referenced during render. Make sure that this property is reactive, ' +
  50474. 'either in the data option, or for class-based components, by ' +
  50475. 'initializing the property. ' +
  50476. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  50477. target
  50478. );
  50479. };
  50480. var warnReservedPrefix = function (target, key) {
  50481. warn(
  50482. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  50483. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  50484. 'prevent conflicts with Vue internals. ' +
  50485. 'See: https://vuejs.org/v2/api/#data',
  50486. target
  50487. );
  50488. };
  50489. var hasProxy =
  50490. typeof Proxy !== 'undefined' && isNative(Proxy);
  50491. if (hasProxy) {
  50492. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  50493. config.keyCodes = new Proxy(config.keyCodes, {
  50494. set: function set (target, key, value) {
  50495. if (isBuiltInModifier(key)) {
  50496. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  50497. return false
  50498. } else {
  50499. target[key] = value;
  50500. return true
  50501. }
  50502. }
  50503. });
  50504. }
  50505. var hasHandler = {
  50506. has: function has (target, key) {
  50507. var has = key in target;
  50508. var isAllowed = allowedGlobals(key) ||
  50509. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  50510. if (!has && !isAllowed) {
  50511. if (key in target.$data) { warnReservedPrefix(target, key); }
  50512. else { warnNonPresent(target, key); }
  50513. }
  50514. return has || !isAllowed
  50515. }
  50516. };
  50517. var getHandler = {
  50518. get: function get (target, key) {
  50519. if (typeof key === 'string' && !(key in target)) {
  50520. if (key in target.$data) { warnReservedPrefix(target, key); }
  50521. else { warnNonPresent(target, key); }
  50522. }
  50523. return target[key]
  50524. }
  50525. };
  50526. initProxy = function initProxy (vm) {
  50527. if (hasProxy) {
  50528. // determine which proxy handler to use
  50529. var options = vm.$options;
  50530. var handlers = options.render && options.render._withStripped
  50531. ? getHandler
  50532. : hasHandler;
  50533. vm._renderProxy = new Proxy(vm, handlers);
  50534. } else {
  50535. vm._renderProxy = vm;
  50536. }
  50537. };
  50538. }
  50539. /* */
  50540. var seenObjects = new _Set();
  50541. /**
  50542. * Recursively traverse an object to evoke all converted
  50543. * getters, so that every nested property inside the object
  50544. * is collected as a "deep" dependency.
  50545. */
  50546. function traverse (val) {
  50547. _traverse(val, seenObjects);
  50548. seenObjects.clear();
  50549. }
  50550. function _traverse (val, seen) {
  50551. var i, keys;
  50552. var isA = Array.isArray(val);
  50553. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  50554. return
  50555. }
  50556. if (val.__ob__) {
  50557. var depId = val.__ob__.dep.id;
  50558. if (seen.has(depId)) {
  50559. return
  50560. }
  50561. seen.add(depId);
  50562. }
  50563. if (isA) {
  50564. i = val.length;
  50565. while (i--) { _traverse(val[i], seen); }
  50566. } else {
  50567. keys = Object.keys(val);
  50568. i = keys.length;
  50569. while (i--) { _traverse(val[keys[i]], seen); }
  50570. }
  50571. }
  50572. /* */
  50573. var normalizeEvent = cached(function (name) {
  50574. var passive = name.charAt(0) === '&';
  50575. name = passive ? name.slice(1) : name;
  50576. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  50577. name = once$$1 ? name.slice(1) : name;
  50578. var capture = name.charAt(0) === '!';
  50579. name = capture ? name.slice(1) : name;
  50580. return {
  50581. name: name,
  50582. once: once$$1,
  50583. capture: capture,
  50584. passive: passive
  50585. }
  50586. });
  50587. function createFnInvoker (fns, vm) {
  50588. function invoker () {
  50589. var arguments$1 = arguments;
  50590. var fns = invoker.fns;
  50591. if (Array.isArray(fns)) {
  50592. var cloned = fns.slice();
  50593. for (var i = 0; i < cloned.length; i++) {
  50594. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  50595. }
  50596. } else {
  50597. // return handler return value for single handlers
  50598. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  50599. }
  50600. }
  50601. invoker.fns = fns;
  50602. return invoker
  50603. }
  50604. function updateListeners (
  50605. on,
  50606. oldOn,
  50607. add,
  50608. remove$$1,
  50609. createOnceHandler,
  50610. vm
  50611. ) {
  50612. var name, def$$1, cur, old, event;
  50613. for (name in on) {
  50614. def$$1 = cur = on[name];
  50615. old = oldOn[name];
  50616. event = normalizeEvent(name);
  50617. if (isUndef(cur)) {
  50618. warn(
  50619. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  50620. vm
  50621. );
  50622. } else if (isUndef(old)) {
  50623. if (isUndef(cur.fns)) {
  50624. cur = on[name] = createFnInvoker(cur, vm);
  50625. }
  50626. if (isTrue(event.once)) {
  50627. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  50628. }
  50629. add(event.name, cur, event.capture, event.passive, event.params);
  50630. } else if (cur !== old) {
  50631. old.fns = cur;
  50632. on[name] = old;
  50633. }
  50634. }
  50635. for (name in oldOn) {
  50636. if (isUndef(on[name])) {
  50637. event = normalizeEvent(name);
  50638. remove$$1(event.name, oldOn[name], event.capture);
  50639. }
  50640. }
  50641. }
  50642. /* */
  50643. function mergeVNodeHook (def, hookKey, hook) {
  50644. if (def instanceof VNode) {
  50645. def = def.data.hook || (def.data.hook = {});
  50646. }
  50647. var invoker;
  50648. var oldHook = def[hookKey];
  50649. function wrappedHook () {
  50650. hook.apply(this, arguments);
  50651. // important: remove merged hook to ensure it's called only once
  50652. // and prevent memory leak
  50653. remove(invoker.fns, wrappedHook);
  50654. }
  50655. if (isUndef(oldHook)) {
  50656. // no existing hook
  50657. invoker = createFnInvoker([wrappedHook]);
  50658. } else {
  50659. /* istanbul ignore if */
  50660. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  50661. // already a merged invoker
  50662. invoker = oldHook;
  50663. invoker.fns.push(wrappedHook);
  50664. } else {
  50665. // existing plain hook
  50666. invoker = createFnInvoker([oldHook, wrappedHook]);
  50667. }
  50668. }
  50669. invoker.merged = true;
  50670. def[hookKey] = invoker;
  50671. }
  50672. /* */
  50673. function extractPropsFromVNodeData (
  50674. data,
  50675. Ctor,
  50676. tag
  50677. ) {
  50678. // we are only extracting raw values here.
  50679. // validation and default values are handled in the child
  50680. // component itself.
  50681. var propOptions = Ctor.options.props;
  50682. if (isUndef(propOptions)) {
  50683. return
  50684. }
  50685. var res = {};
  50686. var attrs = data.attrs;
  50687. var props = data.props;
  50688. if (isDef(attrs) || isDef(props)) {
  50689. for (var key in propOptions) {
  50690. var altKey = hyphenate(key);
  50691. {
  50692. var keyInLowerCase = key.toLowerCase();
  50693. if (
  50694. key !== keyInLowerCase &&
  50695. attrs && hasOwn(attrs, keyInLowerCase)
  50696. ) {
  50697. tip(
  50698. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  50699. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  50700. " \"" + key + "\". " +
  50701. "Note that HTML attributes are case-insensitive and camelCased " +
  50702. "props need to use their kebab-case equivalents when using in-DOM " +
  50703. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  50704. );
  50705. }
  50706. }
  50707. checkProp(res, props, key, altKey, true) ||
  50708. checkProp(res, attrs, key, altKey, false);
  50709. }
  50710. }
  50711. return res
  50712. }
  50713. function checkProp (
  50714. res,
  50715. hash,
  50716. key,
  50717. altKey,
  50718. preserve
  50719. ) {
  50720. if (isDef(hash)) {
  50721. if (hasOwn(hash, key)) {
  50722. res[key] = hash[key];
  50723. if (!preserve) {
  50724. delete hash[key];
  50725. }
  50726. return true
  50727. } else if (hasOwn(hash, altKey)) {
  50728. res[key] = hash[altKey];
  50729. if (!preserve) {
  50730. delete hash[altKey];
  50731. }
  50732. return true
  50733. }
  50734. }
  50735. return false
  50736. }
  50737. /* */
  50738. // The template compiler attempts to minimize the need for normalization by
  50739. // statically analyzing the template at compile time.
  50740. //
  50741. // For plain HTML markup, normalization can be completely skipped because the
  50742. // generated render function is guaranteed to return Array<VNode>. There are
  50743. // two cases where extra normalization is needed:
  50744. // 1. When the children contains components - because a functional component
  50745. // may return an Array instead of a single root. In this case, just a simple
  50746. // normalization is needed - if any child is an Array, we flatten the whole
  50747. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  50748. // because functional components already normalize their own children.
  50749. function simpleNormalizeChildren (children) {
  50750. for (var i = 0; i < children.length; i++) {
  50751. if (Array.isArray(children[i])) {
  50752. return Array.prototype.concat.apply([], children)
  50753. }
  50754. }
  50755. return children
  50756. }
  50757. // 2. When the children contains constructs that always generated nested Arrays,
  50758. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  50759. // with hand-written render functions / JSX. In such cases a full normalization
  50760. // is needed to cater to all possible types of children values.
  50761. function normalizeChildren (children) {
  50762. return isPrimitive(children)
  50763. ? [createTextVNode(children)]
  50764. : Array.isArray(children)
  50765. ? normalizeArrayChildren(children)
  50766. : undefined
  50767. }
  50768. function isTextNode (node) {
  50769. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  50770. }
  50771. function normalizeArrayChildren (children, nestedIndex) {
  50772. var res = [];
  50773. var i, c, lastIndex, last;
  50774. for (i = 0; i < children.length; i++) {
  50775. c = children[i];
  50776. if (isUndef(c) || typeof c === 'boolean') { continue }
  50777. lastIndex = res.length - 1;
  50778. last = res[lastIndex];
  50779. // nested
  50780. if (Array.isArray(c)) {
  50781. if (c.length > 0) {
  50782. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  50783. // merge adjacent text nodes
  50784. if (isTextNode(c[0]) && isTextNode(last)) {
  50785. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  50786. c.shift();
  50787. }
  50788. res.push.apply(res, c);
  50789. }
  50790. } else if (isPrimitive(c)) {
  50791. if (isTextNode(last)) {
  50792. // merge adjacent text nodes
  50793. // this is necessary for SSR hydration because text nodes are
  50794. // essentially merged when rendered to HTML strings
  50795. res[lastIndex] = createTextVNode(last.text + c);
  50796. } else if (c !== '') {
  50797. // convert primitive to vnode
  50798. res.push(createTextVNode(c));
  50799. }
  50800. } else {
  50801. if (isTextNode(c) && isTextNode(last)) {
  50802. // merge adjacent text nodes
  50803. res[lastIndex] = createTextVNode(last.text + c.text);
  50804. } else {
  50805. // default key for nested array children (likely generated by v-for)
  50806. if (isTrue(children._isVList) &&
  50807. isDef(c.tag) &&
  50808. isUndef(c.key) &&
  50809. isDef(nestedIndex)) {
  50810. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  50811. }
  50812. res.push(c);
  50813. }
  50814. }
  50815. }
  50816. return res
  50817. }
  50818. /* */
  50819. function initProvide (vm) {
  50820. var provide = vm.$options.provide;
  50821. if (provide) {
  50822. vm._provided = typeof provide === 'function'
  50823. ? provide.call(vm)
  50824. : provide;
  50825. }
  50826. }
  50827. function initInjections (vm) {
  50828. var result = resolveInject(vm.$options.inject, vm);
  50829. if (result) {
  50830. toggleObserving(false);
  50831. Object.keys(result).forEach(function (key) {
  50832. /* istanbul ignore else */
  50833. {
  50834. defineReactive$$1(vm, key, result[key], function () {
  50835. warn(
  50836. "Avoid mutating an injected value directly since the changes will be " +
  50837. "overwritten whenever the provided component re-renders. " +
  50838. "injection being mutated: \"" + key + "\"",
  50839. vm
  50840. );
  50841. });
  50842. }
  50843. });
  50844. toggleObserving(true);
  50845. }
  50846. }
  50847. function resolveInject (inject, vm) {
  50848. if (inject) {
  50849. // inject is :any because flow is not smart enough to figure out cached
  50850. var result = Object.create(null);
  50851. var keys = hasSymbol
  50852. ? Reflect.ownKeys(inject)
  50853. : Object.keys(inject);
  50854. for (var i = 0; i < keys.length; i++) {
  50855. var key = keys[i];
  50856. // #6574 in case the inject object is observed...
  50857. if (key === '__ob__') { continue }
  50858. var provideKey = inject[key].from;
  50859. var source = vm;
  50860. while (source) {
  50861. if (source._provided && hasOwn(source._provided, provideKey)) {
  50862. result[key] = source._provided[provideKey];
  50863. break
  50864. }
  50865. source = source.$parent;
  50866. }
  50867. if (!source) {
  50868. if ('default' in inject[key]) {
  50869. var provideDefault = inject[key].default;
  50870. result[key] = typeof provideDefault === 'function'
  50871. ? provideDefault.call(vm)
  50872. : provideDefault;
  50873. } else {
  50874. warn(("Injection \"" + key + "\" not found"), vm);
  50875. }
  50876. }
  50877. }
  50878. return result
  50879. }
  50880. }
  50881. /* */
  50882. /**
  50883. * Runtime helper for resolving raw children VNodes into a slot object.
  50884. */
  50885. function resolveSlots (
  50886. children,
  50887. context
  50888. ) {
  50889. if (!children || !children.length) {
  50890. return {}
  50891. }
  50892. var slots = {};
  50893. for (var i = 0, l = children.length; i < l; i++) {
  50894. var child = children[i];
  50895. var data = child.data;
  50896. // remove slot attribute if the node is resolved as a Vue slot node
  50897. if (data && data.attrs && data.attrs.slot) {
  50898. delete data.attrs.slot;
  50899. }
  50900. // named slots should only be respected if the vnode was rendered in the
  50901. // same context.
  50902. if ((child.context === context || child.fnContext === context) &&
  50903. data && data.slot != null
  50904. ) {
  50905. var name = data.slot;
  50906. var slot = (slots[name] || (slots[name] = []));
  50907. if (child.tag === 'template') {
  50908. slot.push.apply(slot, child.children || []);
  50909. } else {
  50910. slot.push(child);
  50911. }
  50912. } else {
  50913. (slots.default || (slots.default = [])).push(child);
  50914. }
  50915. }
  50916. // ignore slots that contains only whitespace
  50917. for (var name$1 in slots) {
  50918. if (slots[name$1].every(isWhitespace)) {
  50919. delete slots[name$1];
  50920. }
  50921. }
  50922. return slots
  50923. }
  50924. function isWhitespace (node) {
  50925. return (node.isComment && !node.asyncFactory) || node.text === ' '
  50926. }
  50927. /* */
  50928. function normalizeScopedSlots (
  50929. slots,
  50930. normalSlots,
  50931. prevSlots
  50932. ) {
  50933. var res;
  50934. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  50935. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  50936. var key = slots && slots.$key;
  50937. if (!slots) {
  50938. res = {};
  50939. } else if (slots._normalized) {
  50940. // fast path 1: child component re-render only, parent did not change
  50941. return slots._normalized
  50942. } else if (
  50943. isStable &&
  50944. prevSlots &&
  50945. prevSlots !== emptyObject &&
  50946. key === prevSlots.$key &&
  50947. !hasNormalSlots &&
  50948. !prevSlots.$hasNormal
  50949. ) {
  50950. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  50951. // only need to normalize once
  50952. return prevSlots
  50953. } else {
  50954. res = {};
  50955. for (var key$1 in slots) {
  50956. if (slots[key$1] && key$1[0] !== '$') {
  50957. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  50958. }
  50959. }
  50960. }
  50961. // expose normal slots on scopedSlots
  50962. for (var key$2 in normalSlots) {
  50963. if (!(key$2 in res)) {
  50964. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  50965. }
  50966. }
  50967. // avoriaz seems to mock a non-extensible $scopedSlots object
  50968. // and when that is passed down this would cause an error
  50969. if (slots && Object.isExtensible(slots)) {
  50970. (slots)._normalized = res;
  50971. }
  50972. def(res, '$stable', isStable);
  50973. def(res, '$key', key);
  50974. def(res, '$hasNormal', hasNormalSlots);
  50975. return res
  50976. }
  50977. function normalizeScopedSlot(normalSlots, key, fn) {
  50978. var normalized = function () {
  50979. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  50980. res = res && typeof res === 'object' && !Array.isArray(res)
  50981. ? [res] // single vnode
  50982. : normalizeChildren(res);
  50983. return res && (
  50984. res.length === 0 ||
  50985. (res.length === 1 && res[0].isComment) // #9658
  50986. ) ? undefined
  50987. : res
  50988. };
  50989. // this is a slot using the new v-slot syntax without scope. although it is
  50990. // compiled as a scoped slot, render fn users would expect it to be present
  50991. // on this.$slots because the usage is semantically a normal slot.
  50992. if (fn.proxy) {
  50993. Object.defineProperty(normalSlots, key, {
  50994. get: normalized,
  50995. enumerable: true,
  50996. configurable: true
  50997. });
  50998. }
  50999. return normalized
  51000. }
  51001. function proxyNormalSlot(slots, key) {
  51002. return function () { return slots[key]; }
  51003. }
  51004. /* */
  51005. /**
  51006. * Runtime helper for rendering v-for lists.
  51007. */
  51008. function renderList (
  51009. val,
  51010. render
  51011. ) {
  51012. var ret, i, l, keys, key;
  51013. if (Array.isArray(val) || typeof val === 'string') {
  51014. ret = new Array(val.length);
  51015. for (i = 0, l = val.length; i < l; i++) {
  51016. ret[i] = render(val[i], i);
  51017. }
  51018. } else if (typeof val === 'number') {
  51019. ret = new Array(val);
  51020. for (i = 0; i < val; i++) {
  51021. ret[i] = render(i + 1, i);
  51022. }
  51023. } else if (isObject(val)) {
  51024. if (hasSymbol && val[Symbol.iterator]) {
  51025. ret = [];
  51026. var iterator = val[Symbol.iterator]();
  51027. var result = iterator.next();
  51028. while (!result.done) {
  51029. ret.push(render(result.value, ret.length));
  51030. result = iterator.next();
  51031. }
  51032. } else {
  51033. keys = Object.keys(val);
  51034. ret = new Array(keys.length);
  51035. for (i = 0, l = keys.length; i < l; i++) {
  51036. key = keys[i];
  51037. ret[i] = render(val[key], key, i);
  51038. }
  51039. }
  51040. }
  51041. if (!isDef(ret)) {
  51042. ret = [];
  51043. }
  51044. (ret)._isVList = true;
  51045. return ret
  51046. }
  51047. /* */
  51048. /**
  51049. * Runtime helper for rendering <slot>
  51050. */
  51051. function renderSlot (
  51052. name,
  51053. fallback,
  51054. props,
  51055. bindObject
  51056. ) {
  51057. var scopedSlotFn = this.$scopedSlots[name];
  51058. var nodes;
  51059. if (scopedSlotFn) { // scoped slot
  51060. props = props || {};
  51061. if (bindObject) {
  51062. if (!isObject(bindObject)) {
  51063. warn(
  51064. 'slot v-bind without argument expects an Object',
  51065. this
  51066. );
  51067. }
  51068. props = extend(extend({}, bindObject), props);
  51069. }
  51070. nodes = scopedSlotFn(props) || fallback;
  51071. } else {
  51072. nodes = this.$slots[name] || fallback;
  51073. }
  51074. var target = props && props.slot;
  51075. if (target) {
  51076. return this.$createElement('template', { slot: target }, nodes)
  51077. } else {
  51078. return nodes
  51079. }
  51080. }
  51081. /* */
  51082. /**
  51083. * Runtime helper for resolving filters
  51084. */
  51085. function resolveFilter (id) {
  51086. return resolveAsset(this.$options, 'filters', id, true) || identity
  51087. }
  51088. /* */
  51089. function isKeyNotMatch (expect, actual) {
  51090. if (Array.isArray(expect)) {
  51091. return expect.indexOf(actual) === -1
  51092. } else {
  51093. return expect !== actual
  51094. }
  51095. }
  51096. /**
  51097. * Runtime helper for checking keyCodes from config.
  51098. * exposed as Vue.prototype._k
  51099. * passing in eventKeyName as last argument separately for backwards compat
  51100. */
  51101. function checkKeyCodes (
  51102. eventKeyCode,
  51103. key,
  51104. builtInKeyCode,
  51105. eventKeyName,
  51106. builtInKeyName
  51107. ) {
  51108. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51109. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51110. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51111. } else if (mappedKeyCode) {
  51112. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51113. } else if (eventKeyName) {
  51114. return hyphenate(eventKeyName) !== key
  51115. }
  51116. }
  51117. /* */
  51118. /**
  51119. * Runtime helper for merging v-bind="object" into a VNode's data.
  51120. */
  51121. function bindObjectProps (
  51122. data,
  51123. tag,
  51124. value,
  51125. asProp,
  51126. isSync
  51127. ) {
  51128. if (value) {
  51129. if (!isObject(value)) {
  51130. warn(
  51131. 'v-bind without argument expects an Object or Array value',
  51132. this
  51133. );
  51134. } else {
  51135. if (Array.isArray(value)) {
  51136. value = toObject(value);
  51137. }
  51138. var hash;
  51139. var loop = function ( key ) {
  51140. if (
  51141. key === 'class' ||
  51142. key === 'style' ||
  51143. isReservedAttribute(key)
  51144. ) {
  51145. hash = data;
  51146. } else {
  51147. var type = data.attrs && data.attrs.type;
  51148. hash = asProp || config.mustUseProp(tag, type, key)
  51149. ? data.domProps || (data.domProps = {})
  51150. : data.attrs || (data.attrs = {});
  51151. }
  51152. var camelizedKey = camelize(key);
  51153. var hyphenatedKey = hyphenate(key);
  51154. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51155. hash[key] = value[key];
  51156. if (isSync) {
  51157. var on = data.on || (data.on = {});
  51158. on[("update:" + key)] = function ($event) {
  51159. value[key] = $event;
  51160. };
  51161. }
  51162. }
  51163. };
  51164. for (var key in value) loop( key );
  51165. }
  51166. }
  51167. return data
  51168. }
  51169. /* */
  51170. /**
  51171. * Runtime helper for rendering static trees.
  51172. */
  51173. function renderStatic (
  51174. index,
  51175. isInFor
  51176. ) {
  51177. var cached = this._staticTrees || (this._staticTrees = []);
  51178. var tree = cached[index];
  51179. // if has already-rendered static tree and not inside v-for,
  51180. // we can reuse the same tree.
  51181. if (tree && !isInFor) {
  51182. return tree
  51183. }
  51184. // otherwise, render a fresh tree.
  51185. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51186. this._renderProxy,
  51187. null,
  51188. this // for render fns generated for functional component templates
  51189. );
  51190. markStatic(tree, ("__static__" + index), false);
  51191. return tree
  51192. }
  51193. /**
  51194. * Runtime helper for v-once.
  51195. * Effectively it means marking the node as static with a unique key.
  51196. */
  51197. function markOnce (
  51198. tree,
  51199. index,
  51200. key
  51201. ) {
  51202. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51203. return tree
  51204. }
  51205. function markStatic (
  51206. tree,
  51207. key,
  51208. isOnce
  51209. ) {
  51210. if (Array.isArray(tree)) {
  51211. for (var i = 0; i < tree.length; i++) {
  51212. if (tree[i] && typeof tree[i] !== 'string') {
  51213. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51214. }
  51215. }
  51216. } else {
  51217. markStaticNode(tree, key, isOnce);
  51218. }
  51219. }
  51220. function markStaticNode (node, key, isOnce) {
  51221. node.isStatic = true;
  51222. node.key = key;
  51223. node.isOnce = isOnce;
  51224. }
  51225. /* */
  51226. function bindObjectListeners (data, value) {
  51227. if (value) {
  51228. if (!isPlainObject(value)) {
  51229. warn(
  51230. 'v-on without argument expects an Object value',
  51231. this
  51232. );
  51233. } else {
  51234. var on = data.on = data.on ? extend({}, data.on) : {};
  51235. for (var key in value) {
  51236. var existing = on[key];
  51237. var ours = value[key];
  51238. on[key] = existing ? [].concat(existing, ours) : ours;
  51239. }
  51240. }
  51241. }
  51242. return data
  51243. }
  51244. /* */
  51245. function resolveScopedSlots (
  51246. fns, // see flow/vnode
  51247. res,
  51248. // the following are added in 2.6
  51249. hasDynamicKeys,
  51250. contentHashKey
  51251. ) {
  51252. res = res || { $stable: !hasDynamicKeys };
  51253. for (var i = 0; i < fns.length; i++) {
  51254. var slot = fns[i];
  51255. if (Array.isArray(slot)) {
  51256. resolveScopedSlots(slot, res, hasDynamicKeys);
  51257. } else if (slot) {
  51258. // marker for reverse proxying v-slot without scope on this.$slots
  51259. if (slot.proxy) {
  51260. slot.fn.proxy = true;
  51261. }
  51262. res[slot.key] = slot.fn;
  51263. }
  51264. }
  51265. if (contentHashKey) {
  51266. (res).$key = contentHashKey;
  51267. }
  51268. return res
  51269. }
  51270. /* */
  51271. function bindDynamicKeys (baseObj, values) {
  51272. for (var i = 0; i < values.length; i += 2) {
  51273. var key = values[i];
  51274. if (typeof key === 'string' && key) {
  51275. baseObj[values[i]] = values[i + 1];
  51276. } else if (key !== '' && key !== null) {
  51277. // null is a special value for explicitly removing a binding
  51278. warn(
  51279. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51280. this
  51281. );
  51282. }
  51283. }
  51284. return baseObj
  51285. }
  51286. // helper to dynamically append modifier runtime markers to event names.
  51287. // ensure only append when value is already string, otherwise it will be cast
  51288. // to string and cause the type check to miss.
  51289. function prependModifier (value, symbol) {
  51290. return typeof value === 'string' ? symbol + value : value
  51291. }
  51292. /* */
  51293. function installRenderHelpers (target) {
  51294. target._o = markOnce;
  51295. target._n = toNumber;
  51296. target._s = toString;
  51297. target._l = renderList;
  51298. target._t = renderSlot;
  51299. target._q = looseEqual;
  51300. target._i = looseIndexOf;
  51301. target._m = renderStatic;
  51302. target._f = resolveFilter;
  51303. target._k = checkKeyCodes;
  51304. target._b = bindObjectProps;
  51305. target._v = createTextVNode;
  51306. target._e = createEmptyVNode;
  51307. target._u = resolveScopedSlots;
  51308. target._g = bindObjectListeners;
  51309. target._d = bindDynamicKeys;
  51310. target._p = prependModifier;
  51311. }
  51312. /* */
  51313. function FunctionalRenderContext (
  51314. data,
  51315. props,
  51316. children,
  51317. parent,
  51318. Ctor
  51319. ) {
  51320. var this$1 = this;
  51321. var options = Ctor.options;
  51322. // ensure the createElement function in functional components
  51323. // gets a unique context - this is necessary for correct named slot check
  51324. var contextVm;
  51325. if (hasOwn(parent, '_uid')) {
  51326. contextVm = Object.create(parent);
  51327. // $flow-disable-line
  51328. contextVm._original = parent;
  51329. } else {
  51330. // the context vm passed in is a functional context as well.
  51331. // in this case we want to make sure we are able to get a hold to the
  51332. // real context instance.
  51333. contextVm = parent;
  51334. // $flow-disable-line
  51335. parent = parent._original;
  51336. }
  51337. var isCompiled = isTrue(options._compiled);
  51338. var needNormalization = !isCompiled;
  51339. this.data = data;
  51340. this.props = props;
  51341. this.children = children;
  51342. this.parent = parent;
  51343. this.listeners = data.on || emptyObject;
  51344. this.injections = resolveInject(options.inject, parent);
  51345. this.slots = function () {
  51346. if (!this$1.$slots) {
  51347. normalizeScopedSlots(
  51348. data.scopedSlots,
  51349. this$1.$slots = resolveSlots(children, parent)
  51350. );
  51351. }
  51352. return this$1.$slots
  51353. };
  51354. Object.defineProperty(this, 'scopedSlots', ({
  51355. enumerable: true,
  51356. get: function get () {
  51357. return normalizeScopedSlots(data.scopedSlots, this.slots())
  51358. }
  51359. }));
  51360. // support for compiled functional template
  51361. if (isCompiled) {
  51362. // exposing $options for renderStatic()
  51363. this.$options = options;
  51364. // pre-resolve slots for renderSlot()
  51365. this.$slots = this.slots();
  51366. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  51367. }
  51368. if (options._scopeId) {
  51369. this._c = function (a, b, c, d) {
  51370. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  51371. if (vnode && !Array.isArray(vnode)) {
  51372. vnode.fnScopeId = options._scopeId;
  51373. vnode.fnContext = parent;
  51374. }
  51375. return vnode
  51376. };
  51377. } else {
  51378. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  51379. }
  51380. }
  51381. installRenderHelpers(FunctionalRenderContext.prototype);
  51382. function createFunctionalComponent (
  51383. Ctor,
  51384. propsData,
  51385. data,
  51386. contextVm,
  51387. children
  51388. ) {
  51389. var options = Ctor.options;
  51390. var props = {};
  51391. var propOptions = options.props;
  51392. if (isDef(propOptions)) {
  51393. for (var key in propOptions) {
  51394. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  51395. }
  51396. } else {
  51397. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  51398. if (isDef(data.props)) { mergeProps(props, data.props); }
  51399. }
  51400. var renderContext = new FunctionalRenderContext(
  51401. data,
  51402. props,
  51403. children,
  51404. contextVm,
  51405. Ctor
  51406. );
  51407. var vnode = options.render.call(null, renderContext._c, renderContext);
  51408. if (vnode instanceof VNode) {
  51409. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  51410. } else if (Array.isArray(vnode)) {
  51411. var vnodes = normalizeChildren(vnode) || [];
  51412. var res = new Array(vnodes.length);
  51413. for (var i = 0; i < vnodes.length; i++) {
  51414. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  51415. }
  51416. return res
  51417. }
  51418. }
  51419. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  51420. // #7817 clone node before setting fnContext, otherwise if the node is reused
  51421. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  51422. // that should not be matched to match.
  51423. var clone = cloneVNode(vnode);
  51424. clone.fnContext = contextVm;
  51425. clone.fnOptions = options;
  51426. {
  51427. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  51428. }
  51429. if (data.slot) {
  51430. (clone.data || (clone.data = {})).slot = data.slot;
  51431. }
  51432. return clone
  51433. }
  51434. function mergeProps (to, from) {
  51435. for (var key in from) {
  51436. to[camelize(key)] = from[key];
  51437. }
  51438. }
  51439. /* */
  51440. /* */
  51441. /* */
  51442. /* */
  51443. // inline hooks to be invoked on component VNodes during patch
  51444. var componentVNodeHooks = {
  51445. init: function init (vnode, hydrating) {
  51446. if (
  51447. vnode.componentInstance &&
  51448. !vnode.componentInstance._isDestroyed &&
  51449. vnode.data.keepAlive
  51450. ) {
  51451. // kept-alive components, treat as a patch
  51452. var mountedNode = vnode; // work around flow
  51453. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  51454. } else {
  51455. var child = vnode.componentInstance = createComponentInstanceForVnode(
  51456. vnode,
  51457. activeInstance
  51458. );
  51459. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  51460. }
  51461. },
  51462. prepatch: function prepatch (oldVnode, vnode) {
  51463. var options = vnode.componentOptions;
  51464. var child = vnode.componentInstance = oldVnode.componentInstance;
  51465. updateChildComponent(
  51466. child,
  51467. options.propsData, // updated props
  51468. options.listeners, // updated listeners
  51469. vnode, // new parent vnode
  51470. options.children // new children
  51471. );
  51472. },
  51473. insert: function insert (vnode) {
  51474. var context = vnode.context;
  51475. var componentInstance = vnode.componentInstance;
  51476. if (!componentInstance._isMounted) {
  51477. componentInstance._isMounted = true;
  51478. callHook(componentInstance, 'mounted');
  51479. }
  51480. if (vnode.data.keepAlive) {
  51481. if (context._isMounted) {
  51482. // vue-router#1212
  51483. // During updates, a kept-alive component's child components may
  51484. // change, so directly walking the tree here may call activated hooks
  51485. // on incorrect children. Instead we push them into a queue which will
  51486. // be processed after the whole patch process ended.
  51487. queueActivatedComponent(componentInstance);
  51488. } else {
  51489. activateChildComponent(componentInstance, true /* direct */);
  51490. }
  51491. }
  51492. },
  51493. destroy: function destroy (vnode) {
  51494. var componentInstance = vnode.componentInstance;
  51495. if (!componentInstance._isDestroyed) {
  51496. if (!vnode.data.keepAlive) {
  51497. componentInstance.$destroy();
  51498. } else {
  51499. deactivateChildComponent(componentInstance, true /* direct */);
  51500. }
  51501. }
  51502. }
  51503. };
  51504. var hooksToMerge = Object.keys(componentVNodeHooks);
  51505. function createComponent (
  51506. Ctor,
  51507. data,
  51508. context,
  51509. children,
  51510. tag
  51511. ) {
  51512. if (isUndef(Ctor)) {
  51513. return
  51514. }
  51515. var baseCtor = context.$options._base;
  51516. // plain options object: turn it into a constructor
  51517. if (isObject(Ctor)) {
  51518. Ctor = baseCtor.extend(Ctor);
  51519. }
  51520. // if at this stage it's not a constructor or an async component factory,
  51521. // reject.
  51522. if (typeof Ctor !== 'function') {
  51523. {
  51524. warn(("Invalid Component definition: " + (String(Ctor))), context);
  51525. }
  51526. return
  51527. }
  51528. // async component
  51529. var asyncFactory;
  51530. if (isUndef(Ctor.cid)) {
  51531. asyncFactory = Ctor;
  51532. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  51533. if (Ctor === undefined) {
  51534. // return a placeholder node for async component, which is rendered
  51535. // as a comment node but preserves all the raw information for the node.
  51536. // the information will be used for async server-rendering and hydration.
  51537. return createAsyncPlaceholder(
  51538. asyncFactory,
  51539. data,
  51540. context,
  51541. children,
  51542. tag
  51543. )
  51544. }
  51545. }
  51546. data = data || {};
  51547. // resolve constructor options in case global mixins are applied after
  51548. // component constructor creation
  51549. resolveConstructorOptions(Ctor);
  51550. // transform component v-model data into props & events
  51551. if (isDef(data.model)) {
  51552. transformModel(Ctor.options, data);
  51553. }
  51554. // extract props
  51555. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  51556. // functional component
  51557. if (isTrue(Ctor.options.functional)) {
  51558. return createFunctionalComponent(Ctor, propsData, data, context, children)
  51559. }
  51560. // extract listeners, since these needs to be treated as
  51561. // child component listeners instead of DOM listeners
  51562. var listeners = data.on;
  51563. // replace with listeners with .native modifier
  51564. // so it gets processed during parent component patch.
  51565. data.on = data.nativeOn;
  51566. if (isTrue(Ctor.options.abstract)) {
  51567. // abstract components do not keep anything
  51568. // other than props & listeners & slot
  51569. // work around flow
  51570. var slot = data.slot;
  51571. data = {};
  51572. if (slot) {
  51573. data.slot = slot;
  51574. }
  51575. }
  51576. // install component management hooks onto the placeholder node
  51577. installComponentHooks(data);
  51578. // return a placeholder vnode
  51579. var name = Ctor.options.name || tag;
  51580. var vnode = new VNode(
  51581. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  51582. data, undefined, undefined, undefined, context,
  51583. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  51584. asyncFactory
  51585. );
  51586. return vnode
  51587. }
  51588. function createComponentInstanceForVnode (
  51589. vnode, // we know it's MountedComponentVNode but flow doesn't
  51590. parent // activeInstance in lifecycle state
  51591. ) {
  51592. var options = {
  51593. _isComponent: true,
  51594. _parentVnode: vnode,
  51595. parent: parent
  51596. };
  51597. // check inline-template render functions
  51598. var inlineTemplate = vnode.data.inlineTemplate;
  51599. if (isDef(inlineTemplate)) {
  51600. options.render = inlineTemplate.render;
  51601. options.staticRenderFns = inlineTemplate.staticRenderFns;
  51602. }
  51603. return new vnode.componentOptions.Ctor(options)
  51604. }
  51605. function installComponentHooks (data) {
  51606. var hooks = data.hook || (data.hook = {});
  51607. for (var i = 0; i < hooksToMerge.length; i++) {
  51608. var key = hooksToMerge[i];
  51609. var existing = hooks[key];
  51610. var toMerge = componentVNodeHooks[key];
  51611. if (existing !== toMerge && !(existing && existing._merged)) {
  51612. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  51613. }
  51614. }
  51615. }
  51616. function mergeHook$1 (f1, f2) {
  51617. var merged = function (a, b) {
  51618. // flow complains about extra args which is why we use any
  51619. f1(a, b);
  51620. f2(a, b);
  51621. };
  51622. merged._merged = true;
  51623. return merged
  51624. }
  51625. // transform component v-model info (value and callback) into
  51626. // prop and event handler respectively.
  51627. function transformModel (options, data) {
  51628. var prop = (options.model && options.model.prop) || 'value';
  51629. var event = (options.model && options.model.event) || 'input'
  51630. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  51631. var on = data.on || (data.on = {});
  51632. var existing = on[event];
  51633. var callback = data.model.callback;
  51634. if (isDef(existing)) {
  51635. if (
  51636. Array.isArray(existing)
  51637. ? existing.indexOf(callback) === -1
  51638. : existing !== callback
  51639. ) {
  51640. on[event] = [callback].concat(existing);
  51641. }
  51642. } else {
  51643. on[event] = callback;
  51644. }
  51645. }
  51646. /* */
  51647. var SIMPLE_NORMALIZE = 1;
  51648. var ALWAYS_NORMALIZE = 2;
  51649. // wrapper function for providing a more flexible interface
  51650. // without getting yelled at by flow
  51651. function createElement (
  51652. context,
  51653. tag,
  51654. data,
  51655. children,
  51656. normalizationType,
  51657. alwaysNormalize
  51658. ) {
  51659. if (Array.isArray(data) || isPrimitive(data)) {
  51660. normalizationType = children;
  51661. children = data;
  51662. data = undefined;
  51663. }
  51664. if (isTrue(alwaysNormalize)) {
  51665. normalizationType = ALWAYS_NORMALIZE;
  51666. }
  51667. return _createElement(context, tag, data, children, normalizationType)
  51668. }
  51669. function _createElement (
  51670. context,
  51671. tag,
  51672. data,
  51673. children,
  51674. normalizationType
  51675. ) {
  51676. if (isDef(data) && isDef((data).__ob__)) {
  51677. warn(
  51678. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  51679. 'Always create fresh vnode data objects in each render!',
  51680. context
  51681. );
  51682. return createEmptyVNode()
  51683. }
  51684. // object syntax in v-bind
  51685. if (isDef(data) && isDef(data.is)) {
  51686. tag = data.is;
  51687. }
  51688. if (!tag) {
  51689. // in case of component :is set to falsy value
  51690. return createEmptyVNode()
  51691. }
  51692. // warn against non-primitive key
  51693. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  51694. ) {
  51695. {
  51696. warn(
  51697. 'Avoid using non-primitive value as key, ' +
  51698. 'use string/number value instead.',
  51699. context
  51700. );
  51701. }
  51702. }
  51703. // support single function children as default scoped slot
  51704. if (Array.isArray(children) &&
  51705. typeof children[0] === 'function'
  51706. ) {
  51707. data = data || {};
  51708. data.scopedSlots = { default: children[0] };
  51709. children.length = 0;
  51710. }
  51711. if (normalizationType === ALWAYS_NORMALIZE) {
  51712. children = normalizeChildren(children);
  51713. } else if (normalizationType === SIMPLE_NORMALIZE) {
  51714. children = simpleNormalizeChildren(children);
  51715. }
  51716. var vnode, ns;
  51717. if (typeof tag === 'string') {
  51718. var Ctor;
  51719. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  51720. if (config.isReservedTag(tag)) {
  51721. // platform built-in elements
  51722. if (isDef(data) && isDef(data.nativeOn)) {
  51723. warn(
  51724. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  51725. context
  51726. );
  51727. }
  51728. vnode = new VNode(
  51729. config.parsePlatformTagName(tag), data, children,
  51730. undefined, undefined, context
  51731. );
  51732. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  51733. // component
  51734. vnode = createComponent(Ctor, data, context, children, tag);
  51735. } else {
  51736. // unknown or unlisted namespaced elements
  51737. // check at runtime because it may get assigned a namespace when its
  51738. // parent normalizes children
  51739. vnode = new VNode(
  51740. tag, data, children,
  51741. undefined, undefined, context
  51742. );
  51743. }
  51744. } else {
  51745. // direct component options / constructor
  51746. vnode = createComponent(tag, data, context, children);
  51747. }
  51748. if (Array.isArray(vnode)) {
  51749. return vnode
  51750. } else if (isDef(vnode)) {
  51751. if (isDef(ns)) { applyNS(vnode, ns); }
  51752. if (isDef(data)) { registerDeepBindings(data); }
  51753. return vnode
  51754. } else {
  51755. return createEmptyVNode()
  51756. }
  51757. }
  51758. function applyNS (vnode, ns, force) {
  51759. vnode.ns = ns;
  51760. if (vnode.tag === 'foreignObject') {
  51761. // use default namespace inside foreignObject
  51762. ns = undefined;
  51763. force = true;
  51764. }
  51765. if (isDef(vnode.children)) {
  51766. for (var i = 0, l = vnode.children.length; i < l; i++) {
  51767. var child = vnode.children[i];
  51768. if (isDef(child.tag) && (
  51769. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  51770. applyNS(child, ns, force);
  51771. }
  51772. }
  51773. }
  51774. }
  51775. // ref #5318
  51776. // necessary to ensure parent re-render when deep bindings like :style and
  51777. // :class are used on slot nodes
  51778. function registerDeepBindings (data) {
  51779. if (isObject(data.style)) {
  51780. traverse(data.style);
  51781. }
  51782. if (isObject(data.class)) {
  51783. traverse(data.class);
  51784. }
  51785. }
  51786. /* */
  51787. function initRender (vm) {
  51788. vm._vnode = null; // the root of the child tree
  51789. vm._staticTrees = null; // v-once cached trees
  51790. var options = vm.$options;
  51791. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  51792. var renderContext = parentVnode && parentVnode.context;
  51793. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  51794. vm.$scopedSlots = emptyObject;
  51795. // bind the createElement fn to this instance
  51796. // so that we get proper render context inside it.
  51797. // args order: tag, data, children, normalizationType, alwaysNormalize
  51798. // internal version is used by render functions compiled from templates
  51799. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  51800. // normalization is always applied for the public version, used in
  51801. // user-written render functions.
  51802. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  51803. // $attrs & $listeners are exposed for easier HOC creation.
  51804. // they need to be reactive so that HOCs using them are always updated
  51805. var parentData = parentVnode && parentVnode.data;
  51806. /* istanbul ignore else */
  51807. {
  51808. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  51809. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  51810. }, true);
  51811. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  51812. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  51813. }, true);
  51814. }
  51815. }
  51816. var currentRenderingInstance = null;
  51817. function renderMixin (Vue) {
  51818. // install runtime convenience helpers
  51819. installRenderHelpers(Vue.prototype);
  51820. Vue.prototype.$nextTick = function (fn) {
  51821. return nextTick(fn, this)
  51822. };
  51823. Vue.prototype._render = function () {
  51824. var vm = this;
  51825. var ref = vm.$options;
  51826. var render = ref.render;
  51827. var _parentVnode = ref._parentVnode;
  51828. if (_parentVnode) {
  51829. vm.$scopedSlots = normalizeScopedSlots(
  51830. _parentVnode.data.scopedSlots,
  51831. vm.$slots,
  51832. vm.$scopedSlots
  51833. );
  51834. }
  51835. // set parent vnode. this allows render functions to have access
  51836. // to the data on the placeholder node.
  51837. vm.$vnode = _parentVnode;
  51838. // render self
  51839. var vnode;
  51840. try {
  51841. // There's no need to maintain a stack because all render fns are called
  51842. // separately from one another. Nested component's render fns are called
  51843. // when parent component is patched.
  51844. currentRenderingInstance = vm;
  51845. vnode = render.call(vm._renderProxy, vm.$createElement);
  51846. } catch (e) {
  51847. handleError(e, vm, "render");
  51848. // return error render result,
  51849. // or previous vnode to prevent render error causing blank component
  51850. /* istanbul ignore else */
  51851. if (vm.$options.renderError) {
  51852. try {
  51853. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  51854. } catch (e) {
  51855. handleError(e, vm, "renderError");
  51856. vnode = vm._vnode;
  51857. }
  51858. } else {
  51859. vnode = vm._vnode;
  51860. }
  51861. } finally {
  51862. currentRenderingInstance = null;
  51863. }
  51864. // if the returned array contains only a single node, allow it
  51865. if (Array.isArray(vnode) && vnode.length === 1) {
  51866. vnode = vnode[0];
  51867. }
  51868. // return empty vnode in case the render function errored out
  51869. if (!(vnode instanceof VNode)) {
  51870. if (Array.isArray(vnode)) {
  51871. warn(
  51872. 'Multiple root nodes returned from render function. Render function ' +
  51873. 'should return a single root node.',
  51874. vm
  51875. );
  51876. }
  51877. vnode = createEmptyVNode();
  51878. }
  51879. // set parent
  51880. vnode.parent = _parentVnode;
  51881. return vnode
  51882. };
  51883. }
  51884. /* */
  51885. function ensureCtor (comp, base) {
  51886. if (
  51887. comp.__esModule ||
  51888. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  51889. ) {
  51890. comp = comp.default;
  51891. }
  51892. return isObject(comp)
  51893. ? base.extend(comp)
  51894. : comp
  51895. }
  51896. function createAsyncPlaceholder (
  51897. factory,
  51898. data,
  51899. context,
  51900. children,
  51901. tag
  51902. ) {
  51903. var node = createEmptyVNode();
  51904. node.asyncFactory = factory;
  51905. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  51906. return node
  51907. }
  51908. function resolveAsyncComponent (
  51909. factory,
  51910. baseCtor
  51911. ) {
  51912. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  51913. return factory.errorComp
  51914. }
  51915. if (isDef(factory.resolved)) {
  51916. return factory.resolved
  51917. }
  51918. var owner = currentRenderingInstance;
  51919. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  51920. // already pending
  51921. factory.owners.push(owner);
  51922. }
  51923. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  51924. return factory.loadingComp
  51925. }
  51926. if (owner && !isDef(factory.owners)) {
  51927. var owners = factory.owners = [owner];
  51928. var sync = true;
  51929. var timerLoading = null;
  51930. var timerTimeout = null
  51931. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  51932. var forceRender = function (renderCompleted) {
  51933. for (var i = 0, l = owners.length; i < l; i++) {
  51934. (owners[i]).$forceUpdate();
  51935. }
  51936. if (renderCompleted) {
  51937. owners.length = 0;
  51938. if (timerLoading !== null) {
  51939. clearTimeout(timerLoading);
  51940. timerLoading = null;
  51941. }
  51942. if (timerTimeout !== null) {
  51943. clearTimeout(timerTimeout);
  51944. timerTimeout = null;
  51945. }
  51946. }
  51947. };
  51948. var resolve = once(function (res) {
  51949. // cache resolved
  51950. factory.resolved = ensureCtor(res, baseCtor);
  51951. // invoke callbacks only if this is not a synchronous resolve
  51952. // (async resolves are shimmed as synchronous during SSR)
  51953. if (!sync) {
  51954. forceRender(true);
  51955. } else {
  51956. owners.length = 0;
  51957. }
  51958. });
  51959. var reject = once(function (reason) {
  51960. warn(
  51961. "Failed to resolve async component: " + (String(factory)) +
  51962. (reason ? ("\nReason: " + reason) : '')
  51963. );
  51964. if (isDef(factory.errorComp)) {
  51965. factory.error = true;
  51966. forceRender(true);
  51967. }
  51968. });
  51969. var res = factory(resolve, reject);
  51970. if (isObject(res)) {
  51971. if (isPromise(res)) {
  51972. // () => Promise
  51973. if (isUndef(factory.resolved)) {
  51974. res.then(resolve, reject);
  51975. }
  51976. } else if (isPromise(res.component)) {
  51977. res.component.then(resolve, reject);
  51978. if (isDef(res.error)) {
  51979. factory.errorComp = ensureCtor(res.error, baseCtor);
  51980. }
  51981. if (isDef(res.loading)) {
  51982. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  51983. if (res.delay === 0) {
  51984. factory.loading = true;
  51985. } else {
  51986. timerLoading = setTimeout(function () {
  51987. timerLoading = null;
  51988. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  51989. factory.loading = true;
  51990. forceRender(false);
  51991. }
  51992. }, res.delay || 200);
  51993. }
  51994. }
  51995. if (isDef(res.timeout)) {
  51996. timerTimeout = setTimeout(function () {
  51997. timerTimeout = null;
  51998. if (isUndef(factory.resolved)) {
  51999. reject(
  52000. "timeout (" + (res.timeout) + "ms)"
  52001. );
  52002. }
  52003. }, res.timeout);
  52004. }
  52005. }
  52006. }
  52007. sync = false;
  52008. // return in case resolved synchronously
  52009. return factory.loading
  52010. ? factory.loadingComp
  52011. : factory.resolved
  52012. }
  52013. }
  52014. /* */
  52015. function isAsyncPlaceholder (node) {
  52016. return node.isComment && node.asyncFactory
  52017. }
  52018. /* */
  52019. function getFirstComponentChild (children) {
  52020. if (Array.isArray(children)) {
  52021. for (var i = 0; i < children.length; i++) {
  52022. var c = children[i];
  52023. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52024. return c
  52025. }
  52026. }
  52027. }
  52028. }
  52029. /* */
  52030. /* */
  52031. function initEvents (vm) {
  52032. vm._events = Object.create(null);
  52033. vm._hasHookEvent = false;
  52034. // init parent attached events
  52035. var listeners = vm.$options._parentListeners;
  52036. if (listeners) {
  52037. updateComponentListeners(vm, listeners);
  52038. }
  52039. }
  52040. var target;
  52041. function add (event, fn) {
  52042. target.$on(event, fn);
  52043. }
  52044. function remove$1 (event, fn) {
  52045. target.$off(event, fn);
  52046. }
  52047. function createOnceHandler (event, fn) {
  52048. var _target = target;
  52049. return function onceHandler () {
  52050. var res = fn.apply(null, arguments);
  52051. if (res !== null) {
  52052. _target.$off(event, onceHandler);
  52053. }
  52054. }
  52055. }
  52056. function updateComponentListeners (
  52057. vm,
  52058. listeners,
  52059. oldListeners
  52060. ) {
  52061. target = vm;
  52062. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52063. target = undefined;
  52064. }
  52065. function eventsMixin (Vue) {
  52066. var hookRE = /^hook:/;
  52067. Vue.prototype.$on = function (event, fn) {
  52068. var vm = this;
  52069. if (Array.isArray(event)) {
  52070. for (var i = 0, l = event.length; i < l; i++) {
  52071. vm.$on(event[i], fn);
  52072. }
  52073. } else {
  52074. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52075. // optimize hook:event cost by using a boolean flag marked at registration
  52076. // instead of a hash lookup
  52077. if (hookRE.test(event)) {
  52078. vm._hasHookEvent = true;
  52079. }
  52080. }
  52081. return vm
  52082. };
  52083. Vue.prototype.$once = function (event, fn) {
  52084. var vm = this;
  52085. function on () {
  52086. vm.$off(event, on);
  52087. fn.apply(vm, arguments);
  52088. }
  52089. on.fn = fn;
  52090. vm.$on(event, on);
  52091. return vm
  52092. };
  52093. Vue.prototype.$off = function (event, fn) {
  52094. var vm = this;
  52095. // all
  52096. if (!arguments.length) {
  52097. vm._events = Object.create(null);
  52098. return vm
  52099. }
  52100. // array of events
  52101. if (Array.isArray(event)) {
  52102. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52103. vm.$off(event[i$1], fn);
  52104. }
  52105. return vm
  52106. }
  52107. // specific event
  52108. var cbs = vm._events[event];
  52109. if (!cbs) {
  52110. return vm
  52111. }
  52112. if (!fn) {
  52113. vm._events[event] = null;
  52114. return vm
  52115. }
  52116. // specific handler
  52117. var cb;
  52118. var i = cbs.length;
  52119. while (i--) {
  52120. cb = cbs[i];
  52121. if (cb === fn || cb.fn === fn) {
  52122. cbs.splice(i, 1);
  52123. break
  52124. }
  52125. }
  52126. return vm
  52127. };
  52128. Vue.prototype.$emit = function (event) {
  52129. var vm = this;
  52130. {
  52131. var lowerCaseEvent = event.toLowerCase();
  52132. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52133. tip(
  52134. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52135. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52136. "Note that HTML attributes are case-insensitive and you cannot use " +
  52137. "v-on to listen to camelCase events when using in-DOM templates. " +
  52138. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52139. );
  52140. }
  52141. }
  52142. var cbs = vm._events[event];
  52143. if (cbs) {
  52144. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52145. var args = toArray(arguments, 1);
  52146. var info = "event handler for \"" + event + "\"";
  52147. for (var i = 0, l = cbs.length; i < l; i++) {
  52148. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52149. }
  52150. }
  52151. return vm
  52152. };
  52153. }
  52154. /* */
  52155. var activeInstance = null;
  52156. var isUpdatingChildComponent = false;
  52157. function setActiveInstance(vm) {
  52158. var prevActiveInstance = activeInstance;
  52159. activeInstance = vm;
  52160. return function () {
  52161. activeInstance = prevActiveInstance;
  52162. }
  52163. }
  52164. function initLifecycle (vm) {
  52165. var options = vm.$options;
  52166. // locate first non-abstract parent
  52167. var parent = options.parent;
  52168. if (parent && !options.abstract) {
  52169. while (parent.$options.abstract && parent.$parent) {
  52170. parent = parent.$parent;
  52171. }
  52172. parent.$children.push(vm);
  52173. }
  52174. vm.$parent = parent;
  52175. vm.$root = parent ? parent.$root : vm;
  52176. vm.$children = [];
  52177. vm.$refs = {};
  52178. vm._watcher = null;
  52179. vm._inactive = null;
  52180. vm._directInactive = false;
  52181. vm._isMounted = false;
  52182. vm._isDestroyed = false;
  52183. vm._isBeingDestroyed = false;
  52184. }
  52185. function lifecycleMixin (Vue) {
  52186. Vue.prototype._update = function (vnode, hydrating) {
  52187. var vm = this;
  52188. var prevEl = vm.$el;
  52189. var prevVnode = vm._vnode;
  52190. var restoreActiveInstance = setActiveInstance(vm);
  52191. vm._vnode = vnode;
  52192. // Vue.prototype.__patch__ is injected in entry points
  52193. // based on the rendering backend used.
  52194. if (!prevVnode) {
  52195. // initial render
  52196. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52197. } else {
  52198. // updates
  52199. vm.$el = vm.__patch__(prevVnode, vnode);
  52200. }
  52201. restoreActiveInstance();
  52202. // update __vue__ reference
  52203. if (prevEl) {
  52204. prevEl.__vue__ = null;
  52205. }
  52206. if (vm.$el) {
  52207. vm.$el.__vue__ = vm;
  52208. }
  52209. // if parent is an HOC, update its $el as well
  52210. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52211. vm.$parent.$el = vm.$el;
  52212. }
  52213. // updated hook is called by the scheduler to ensure that children are
  52214. // updated in a parent's updated hook.
  52215. };
  52216. Vue.prototype.$forceUpdate = function () {
  52217. var vm = this;
  52218. if (vm._watcher) {
  52219. vm._watcher.update();
  52220. }
  52221. };
  52222. Vue.prototype.$destroy = function () {
  52223. var vm = this;
  52224. if (vm._isBeingDestroyed) {
  52225. return
  52226. }
  52227. callHook(vm, 'beforeDestroy');
  52228. vm._isBeingDestroyed = true;
  52229. // remove self from parent
  52230. var parent = vm.$parent;
  52231. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52232. remove(parent.$children, vm);
  52233. }
  52234. // teardown watchers
  52235. if (vm._watcher) {
  52236. vm._watcher.teardown();
  52237. }
  52238. var i = vm._watchers.length;
  52239. while (i--) {
  52240. vm._watchers[i].teardown();
  52241. }
  52242. // remove reference from data ob
  52243. // frozen object may not have observer.
  52244. if (vm._data.__ob__) {
  52245. vm._data.__ob__.vmCount--;
  52246. }
  52247. // call the last hook...
  52248. vm._isDestroyed = true;
  52249. // invoke destroy hooks on current rendered tree
  52250. vm.__patch__(vm._vnode, null);
  52251. // fire destroyed hook
  52252. callHook(vm, 'destroyed');
  52253. // turn off all instance listeners.
  52254. vm.$off();
  52255. // remove __vue__ reference
  52256. if (vm.$el) {
  52257. vm.$el.__vue__ = null;
  52258. }
  52259. // release circular reference (#6759)
  52260. if (vm.$vnode) {
  52261. vm.$vnode.parent = null;
  52262. }
  52263. };
  52264. }
  52265. function mountComponent (
  52266. vm,
  52267. el,
  52268. hydrating
  52269. ) {
  52270. vm.$el = el;
  52271. if (!vm.$options.render) {
  52272. vm.$options.render = createEmptyVNode;
  52273. {
  52274. /* istanbul ignore if */
  52275. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52276. vm.$options.el || el) {
  52277. warn(
  52278. 'You are using the runtime-only build of Vue where the template ' +
  52279. 'compiler is not available. Either pre-compile the templates into ' +
  52280. 'render functions, or use the compiler-included build.',
  52281. vm
  52282. );
  52283. } else {
  52284. warn(
  52285. 'Failed to mount component: template or render function not defined.',
  52286. vm
  52287. );
  52288. }
  52289. }
  52290. }
  52291. callHook(vm, 'beforeMount');
  52292. var updateComponent;
  52293. /* istanbul ignore if */
  52294. if (config.performance && mark) {
  52295. updateComponent = function () {
  52296. var name = vm._name;
  52297. var id = vm._uid;
  52298. var startTag = "vue-perf-start:" + id;
  52299. var endTag = "vue-perf-end:" + id;
  52300. mark(startTag);
  52301. var vnode = vm._render();
  52302. mark(endTag);
  52303. measure(("vue " + name + " render"), startTag, endTag);
  52304. mark(startTag);
  52305. vm._update(vnode, hydrating);
  52306. mark(endTag);
  52307. measure(("vue " + name + " patch"), startTag, endTag);
  52308. };
  52309. } else {
  52310. updateComponent = function () {
  52311. vm._update(vm._render(), hydrating);
  52312. };
  52313. }
  52314. // we set this to vm._watcher inside the watcher's constructor
  52315. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52316. // component's mounted hook), which relies on vm._watcher being already defined
  52317. new Watcher(vm, updateComponent, noop, {
  52318. before: function before () {
  52319. if (vm._isMounted && !vm._isDestroyed) {
  52320. callHook(vm, 'beforeUpdate');
  52321. }
  52322. }
  52323. }, true /* isRenderWatcher */);
  52324. hydrating = false;
  52325. // manually mounted instance, call mounted on self
  52326. // mounted is called for render-created child components in its inserted hook
  52327. if (vm.$vnode == null) {
  52328. vm._isMounted = true;
  52329. callHook(vm, 'mounted');
  52330. }
  52331. return vm
  52332. }
  52333. function updateChildComponent (
  52334. vm,
  52335. propsData,
  52336. listeners,
  52337. parentVnode,
  52338. renderChildren
  52339. ) {
  52340. {
  52341. isUpdatingChildComponent = true;
  52342. }
  52343. // determine whether component has slot children
  52344. // we need to do this before overwriting $options._renderChildren.
  52345. // check if there are dynamic scopedSlots (hand-written or compiled but with
  52346. // dynamic slot names). Static scoped slots compiled from template has the
  52347. // "$stable" marker.
  52348. var newScopedSlots = parentVnode.data.scopedSlots;
  52349. var oldScopedSlots = vm.$scopedSlots;
  52350. var hasDynamicScopedSlot = !!(
  52351. (newScopedSlots && !newScopedSlots.$stable) ||
  52352. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  52353. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  52354. );
  52355. // Any static slot children from the parent may have changed during parent's
  52356. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  52357. // update is necessary to ensure correctness.
  52358. var needsForceUpdate = !!(
  52359. renderChildren || // has new static slots
  52360. vm.$options._renderChildren || // has old static slots
  52361. hasDynamicScopedSlot
  52362. );
  52363. vm.$options._parentVnode = parentVnode;
  52364. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  52365. if (vm._vnode) { // update child tree's parent
  52366. vm._vnode.parent = parentVnode;
  52367. }
  52368. vm.$options._renderChildren = renderChildren;
  52369. // update $attrs and $listeners hash
  52370. // these are also reactive so they may trigger child update if the child
  52371. // used them during render
  52372. vm.$attrs = parentVnode.data.attrs || emptyObject;
  52373. vm.$listeners = listeners || emptyObject;
  52374. // update props
  52375. if (propsData && vm.$options.props) {
  52376. toggleObserving(false);
  52377. var props = vm._props;
  52378. var propKeys = vm.$options._propKeys || [];
  52379. for (var i = 0; i < propKeys.length; i++) {
  52380. var key = propKeys[i];
  52381. var propOptions = vm.$options.props; // wtf flow?
  52382. props[key] = validateProp(key, propOptions, propsData, vm);
  52383. }
  52384. toggleObserving(true);
  52385. // keep a copy of raw propsData
  52386. vm.$options.propsData = propsData;
  52387. }
  52388. // update listeners
  52389. listeners = listeners || emptyObject;
  52390. var oldListeners = vm.$options._parentListeners;
  52391. vm.$options._parentListeners = listeners;
  52392. updateComponentListeners(vm, listeners, oldListeners);
  52393. // resolve slots + force update if has children
  52394. if (needsForceUpdate) {
  52395. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  52396. vm.$forceUpdate();
  52397. }
  52398. {
  52399. isUpdatingChildComponent = false;
  52400. }
  52401. }
  52402. function isInInactiveTree (vm) {
  52403. while (vm && (vm = vm.$parent)) {
  52404. if (vm._inactive) { return true }
  52405. }
  52406. return false
  52407. }
  52408. function activateChildComponent (vm, direct) {
  52409. if (direct) {
  52410. vm._directInactive = false;
  52411. if (isInInactiveTree(vm)) {
  52412. return
  52413. }
  52414. } else if (vm._directInactive) {
  52415. return
  52416. }
  52417. if (vm._inactive || vm._inactive === null) {
  52418. vm._inactive = false;
  52419. for (var i = 0; i < vm.$children.length; i++) {
  52420. activateChildComponent(vm.$children[i]);
  52421. }
  52422. callHook(vm, 'activated');
  52423. }
  52424. }
  52425. function deactivateChildComponent (vm, direct) {
  52426. if (direct) {
  52427. vm._directInactive = true;
  52428. if (isInInactiveTree(vm)) {
  52429. return
  52430. }
  52431. }
  52432. if (!vm._inactive) {
  52433. vm._inactive = true;
  52434. for (var i = 0; i < vm.$children.length; i++) {
  52435. deactivateChildComponent(vm.$children[i]);
  52436. }
  52437. callHook(vm, 'deactivated');
  52438. }
  52439. }
  52440. function callHook (vm, hook) {
  52441. // #7573 disable dep collection when invoking lifecycle hooks
  52442. pushTarget();
  52443. var handlers = vm.$options[hook];
  52444. var info = hook + " hook";
  52445. if (handlers) {
  52446. for (var i = 0, j = handlers.length; i < j; i++) {
  52447. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  52448. }
  52449. }
  52450. if (vm._hasHookEvent) {
  52451. vm.$emit('hook:' + hook);
  52452. }
  52453. popTarget();
  52454. }
  52455. /* */
  52456. var MAX_UPDATE_COUNT = 100;
  52457. var queue = [];
  52458. var activatedChildren = [];
  52459. var has = {};
  52460. var circular = {};
  52461. var waiting = false;
  52462. var flushing = false;
  52463. var index = 0;
  52464. /**
  52465. * Reset the scheduler's state.
  52466. */
  52467. function resetSchedulerState () {
  52468. index = queue.length = activatedChildren.length = 0;
  52469. has = {};
  52470. {
  52471. circular = {};
  52472. }
  52473. waiting = flushing = false;
  52474. }
  52475. // Async edge case #6566 requires saving the timestamp when event listeners are
  52476. // attached. However, calling performance.now() has a perf overhead especially
  52477. // if the page has thousands of event listeners. Instead, we take a timestamp
  52478. // every time the scheduler flushes and use that for all event listeners
  52479. // attached during that flush.
  52480. var currentFlushTimestamp = 0;
  52481. // Async edge case fix requires storing an event listener's attach timestamp.
  52482. var getNow = Date.now;
  52483. // Determine what event timestamp the browser is using. Annoyingly, the
  52484. // timestamp can either be hi-res (relative to page load) or low-res
  52485. // (relative to UNIX epoch), so in order to compare time we have to use the
  52486. // same timestamp type when saving the flush timestamp.
  52487. // All IE versions use low-res event timestamps, and have problematic clock
  52488. // implementations (#9632)
  52489. if (inBrowser && !isIE) {
  52490. var performance = window.performance;
  52491. if (
  52492. performance &&
  52493. typeof performance.now === 'function' &&
  52494. getNow() > document.createEvent('Event').timeStamp
  52495. ) {
  52496. // if the event timestamp, although evaluated AFTER the Date.now(), is
  52497. // smaller than it, it means the event is using a hi-res timestamp,
  52498. // and we need to use the hi-res version for event listener timestamps as
  52499. // well.
  52500. getNow = function () { return performance.now(); };
  52501. }
  52502. }
  52503. /**
  52504. * Flush both queues and run the watchers.
  52505. */
  52506. function flushSchedulerQueue () {
  52507. currentFlushTimestamp = getNow();
  52508. flushing = true;
  52509. var watcher, id;
  52510. // Sort queue before flush.
  52511. // This ensures that:
  52512. // 1. Components are updated from parent to child. (because parent is always
  52513. // created before the child)
  52514. // 2. A component's user watchers are run before its render watcher (because
  52515. // user watchers are created before the render watcher)
  52516. // 3. If a component is destroyed during a parent component's watcher run,
  52517. // its watchers can be skipped.
  52518. queue.sort(function (a, b) { return a.id - b.id; });
  52519. // do not cache length because more watchers might be pushed
  52520. // as we run existing watchers
  52521. for (index = 0; index < queue.length; index++) {
  52522. watcher = queue[index];
  52523. if (watcher.before) {
  52524. watcher.before();
  52525. }
  52526. id = watcher.id;
  52527. has[id] = null;
  52528. watcher.run();
  52529. // in dev build, check and stop circular updates.
  52530. if (has[id] != null) {
  52531. circular[id] = (circular[id] || 0) + 1;
  52532. if (circular[id] > MAX_UPDATE_COUNT) {
  52533. warn(
  52534. 'You may have an infinite update loop ' + (
  52535. watcher.user
  52536. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  52537. : "in a component render function."
  52538. ),
  52539. watcher.vm
  52540. );
  52541. break
  52542. }
  52543. }
  52544. }
  52545. // keep copies of post queues before resetting state
  52546. var activatedQueue = activatedChildren.slice();
  52547. var updatedQueue = queue.slice();
  52548. resetSchedulerState();
  52549. // call component updated and activated hooks
  52550. callActivatedHooks(activatedQueue);
  52551. callUpdatedHooks(updatedQueue);
  52552. // devtool hook
  52553. /* istanbul ignore if */
  52554. if (devtools && config.devtools) {
  52555. devtools.emit('flush');
  52556. }
  52557. }
  52558. function callUpdatedHooks (queue) {
  52559. var i = queue.length;
  52560. while (i--) {
  52561. var watcher = queue[i];
  52562. var vm = watcher.vm;
  52563. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  52564. callHook(vm, 'updated');
  52565. }
  52566. }
  52567. }
  52568. /**
  52569. * Queue a kept-alive component that was activated during patch.
  52570. * The queue will be processed after the entire tree has been patched.
  52571. */
  52572. function queueActivatedComponent (vm) {
  52573. // setting _inactive to false here so that a render function can
  52574. // rely on checking whether it's in an inactive tree (e.g. router-view)
  52575. vm._inactive = false;
  52576. activatedChildren.push(vm);
  52577. }
  52578. function callActivatedHooks (queue) {
  52579. for (var i = 0; i < queue.length; i++) {
  52580. queue[i]._inactive = true;
  52581. activateChildComponent(queue[i], true /* true */);
  52582. }
  52583. }
  52584. /**
  52585. * Push a watcher into the watcher queue.
  52586. * Jobs with duplicate IDs will be skipped unless it's
  52587. * pushed when the queue is being flushed.
  52588. */
  52589. function queueWatcher (watcher) {
  52590. var id = watcher.id;
  52591. if (has[id] == null) {
  52592. has[id] = true;
  52593. if (!flushing) {
  52594. queue.push(watcher);
  52595. } else {
  52596. // if already flushing, splice the watcher based on its id
  52597. // if already past its id, it will be run next immediately.
  52598. var i = queue.length - 1;
  52599. while (i > index && queue[i].id > watcher.id) {
  52600. i--;
  52601. }
  52602. queue.splice(i + 1, 0, watcher);
  52603. }
  52604. // queue the flush
  52605. if (!waiting) {
  52606. waiting = true;
  52607. if (!config.async) {
  52608. flushSchedulerQueue();
  52609. return
  52610. }
  52611. nextTick(flushSchedulerQueue);
  52612. }
  52613. }
  52614. }
  52615. /* */
  52616. var uid$2 = 0;
  52617. /**
  52618. * A watcher parses an expression, collects dependencies,
  52619. * and fires callback when the expression value changes.
  52620. * This is used for both the $watch() api and directives.
  52621. */
  52622. var Watcher = function Watcher (
  52623. vm,
  52624. expOrFn,
  52625. cb,
  52626. options,
  52627. isRenderWatcher
  52628. ) {
  52629. this.vm = vm;
  52630. if (isRenderWatcher) {
  52631. vm._watcher = this;
  52632. }
  52633. vm._watchers.push(this);
  52634. // options
  52635. if (options) {
  52636. this.deep = !!options.deep;
  52637. this.user = !!options.user;
  52638. this.lazy = !!options.lazy;
  52639. this.sync = !!options.sync;
  52640. this.before = options.before;
  52641. } else {
  52642. this.deep = this.user = this.lazy = this.sync = false;
  52643. }
  52644. this.cb = cb;
  52645. this.id = ++uid$2; // uid for batching
  52646. this.active = true;
  52647. this.dirty = this.lazy; // for lazy watchers
  52648. this.deps = [];
  52649. this.newDeps = [];
  52650. this.depIds = new _Set();
  52651. this.newDepIds = new _Set();
  52652. this.expression = expOrFn.toString();
  52653. // parse expression for getter
  52654. if (typeof expOrFn === 'function') {
  52655. this.getter = expOrFn;
  52656. } else {
  52657. this.getter = parsePath(expOrFn);
  52658. if (!this.getter) {
  52659. this.getter = noop;
  52660. warn(
  52661. "Failed watching path: \"" + expOrFn + "\" " +
  52662. 'Watcher only accepts simple dot-delimited paths. ' +
  52663. 'For full control, use a function instead.',
  52664. vm
  52665. );
  52666. }
  52667. }
  52668. this.value = this.lazy
  52669. ? undefined
  52670. : this.get();
  52671. };
  52672. /**
  52673. * Evaluate the getter, and re-collect dependencies.
  52674. */
  52675. Watcher.prototype.get = function get () {
  52676. pushTarget(this);
  52677. var value;
  52678. var vm = this.vm;
  52679. try {
  52680. value = this.getter.call(vm, vm);
  52681. } catch (e) {
  52682. if (this.user) {
  52683. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  52684. } else {
  52685. throw e
  52686. }
  52687. } finally {
  52688. // "touch" every property so they are all tracked as
  52689. // dependencies for deep watching
  52690. if (this.deep) {
  52691. traverse(value);
  52692. }
  52693. popTarget();
  52694. this.cleanupDeps();
  52695. }
  52696. return value
  52697. };
  52698. /**
  52699. * Add a dependency to this directive.
  52700. */
  52701. Watcher.prototype.addDep = function addDep (dep) {
  52702. var id = dep.id;
  52703. if (!this.newDepIds.has(id)) {
  52704. this.newDepIds.add(id);
  52705. this.newDeps.push(dep);
  52706. if (!this.depIds.has(id)) {
  52707. dep.addSub(this);
  52708. }
  52709. }
  52710. };
  52711. /**
  52712. * Clean up for dependency collection.
  52713. */
  52714. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  52715. var i = this.deps.length;
  52716. while (i--) {
  52717. var dep = this.deps[i];
  52718. if (!this.newDepIds.has(dep.id)) {
  52719. dep.removeSub(this);
  52720. }
  52721. }
  52722. var tmp = this.depIds;
  52723. this.depIds = this.newDepIds;
  52724. this.newDepIds = tmp;
  52725. this.newDepIds.clear();
  52726. tmp = this.deps;
  52727. this.deps = this.newDeps;
  52728. this.newDeps = tmp;
  52729. this.newDeps.length = 0;
  52730. };
  52731. /**
  52732. * Subscriber interface.
  52733. * Will be called when a dependency changes.
  52734. */
  52735. Watcher.prototype.update = function update () {
  52736. /* istanbul ignore else */
  52737. if (this.lazy) {
  52738. this.dirty = true;
  52739. } else if (this.sync) {
  52740. this.run();
  52741. } else {
  52742. queueWatcher(this);
  52743. }
  52744. };
  52745. /**
  52746. * Scheduler job interface.
  52747. * Will be called by the scheduler.
  52748. */
  52749. Watcher.prototype.run = function run () {
  52750. if (this.active) {
  52751. var value = this.get();
  52752. if (
  52753. value !== this.value ||
  52754. // Deep watchers and watchers on Object/Arrays should fire even
  52755. // when the value is the same, because the value may
  52756. // have mutated.
  52757. isObject(value) ||
  52758. this.deep
  52759. ) {
  52760. // set new value
  52761. var oldValue = this.value;
  52762. this.value = value;
  52763. if (this.user) {
  52764. try {
  52765. this.cb.call(this.vm, value, oldValue);
  52766. } catch (e) {
  52767. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  52768. }
  52769. } else {
  52770. this.cb.call(this.vm, value, oldValue);
  52771. }
  52772. }
  52773. }
  52774. };
  52775. /**
  52776. * Evaluate the value of the watcher.
  52777. * This only gets called for lazy watchers.
  52778. */
  52779. Watcher.prototype.evaluate = function evaluate () {
  52780. this.value = this.get();
  52781. this.dirty = false;
  52782. };
  52783. /**
  52784. * Depend on all deps collected by this watcher.
  52785. */
  52786. Watcher.prototype.depend = function depend () {
  52787. var i = this.deps.length;
  52788. while (i--) {
  52789. this.deps[i].depend();
  52790. }
  52791. };
  52792. /**
  52793. * Remove self from all dependencies' subscriber list.
  52794. */
  52795. Watcher.prototype.teardown = function teardown () {
  52796. if (this.active) {
  52797. // remove self from vm's watcher list
  52798. // this is a somewhat expensive operation so we skip it
  52799. // if the vm is being destroyed.
  52800. if (!this.vm._isBeingDestroyed) {
  52801. remove(this.vm._watchers, this);
  52802. }
  52803. var i = this.deps.length;
  52804. while (i--) {
  52805. this.deps[i].removeSub(this);
  52806. }
  52807. this.active = false;
  52808. }
  52809. };
  52810. /* */
  52811. var sharedPropertyDefinition = {
  52812. enumerable: true,
  52813. configurable: true,
  52814. get: noop,
  52815. set: noop
  52816. };
  52817. function proxy (target, sourceKey, key) {
  52818. sharedPropertyDefinition.get = function proxyGetter () {
  52819. return this[sourceKey][key]
  52820. };
  52821. sharedPropertyDefinition.set = function proxySetter (val) {
  52822. this[sourceKey][key] = val;
  52823. };
  52824. Object.defineProperty(target, key, sharedPropertyDefinition);
  52825. }
  52826. function initState (vm) {
  52827. vm._watchers = [];
  52828. var opts = vm.$options;
  52829. if (opts.props) { initProps(vm, opts.props); }
  52830. if (opts.methods) { initMethods(vm, opts.methods); }
  52831. if (opts.data) {
  52832. initData(vm);
  52833. } else {
  52834. observe(vm._data = {}, true /* asRootData */);
  52835. }
  52836. if (opts.computed) { initComputed(vm, opts.computed); }
  52837. if (opts.watch && opts.watch !== nativeWatch) {
  52838. initWatch(vm, opts.watch);
  52839. }
  52840. }
  52841. function initProps (vm, propsOptions) {
  52842. var propsData = vm.$options.propsData || {};
  52843. var props = vm._props = {};
  52844. // cache prop keys so that future props updates can iterate using Array
  52845. // instead of dynamic object key enumeration.
  52846. var keys = vm.$options._propKeys = [];
  52847. var isRoot = !vm.$parent;
  52848. // root instance props should be converted
  52849. if (!isRoot) {
  52850. toggleObserving(false);
  52851. }
  52852. var loop = function ( key ) {
  52853. keys.push(key);
  52854. var value = validateProp(key, propsOptions, propsData, vm);
  52855. /* istanbul ignore else */
  52856. {
  52857. var hyphenatedKey = hyphenate(key);
  52858. if (isReservedAttribute(hyphenatedKey) ||
  52859. config.isReservedAttr(hyphenatedKey)) {
  52860. warn(
  52861. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  52862. vm
  52863. );
  52864. }
  52865. defineReactive$$1(props, key, value, function () {
  52866. if (!isRoot && !isUpdatingChildComponent) {
  52867. warn(
  52868. "Avoid mutating a prop directly since the value will be " +
  52869. "overwritten whenever the parent component re-renders. " +
  52870. "Instead, use a data or computed property based on the prop's " +
  52871. "value. Prop being mutated: \"" + key + "\"",
  52872. vm
  52873. );
  52874. }
  52875. });
  52876. }
  52877. // static props are already proxied on the component's prototype
  52878. // during Vue.extend(). We only need to proxy props defined at
  52879. // instantiation here.
  52880. if (!(key in vm)) {
  52881. proxy(vm, "_props", key);
  52882. }
  52883. };
  52884. for (var key in propsOptions) loop( key );
  52885. toggleObserving(true);
  52886. }
  52887. function initData (vm) {
  52888. var data = vm.$options.data;
  52889. data = vm._data = typeof data === 'function'
  52890. ? getData(data, vm)
  52891. : data || {};
  52892. if (!isPlainObject(data)) {
  52893. data = {};
  52894. warn(
  52895. 'data functions should return an object:\n' +
  52896. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  52897. vm
  52898. );
  52899. }
  52900. // proxy data on instance
  52901. var keys = Object.keys(data);
  52902. var props = vm.$options.props;
  52903. var methods = vm.$options.methods;
  52904. var i = keys.length;
  52905. while (i--) {
  52906. var key = keys[i];
  52907. {
  52908. if (methods && hasOwn(methods, key)) {
  52909. warn(
  52910. ("Method \"" + key + "\" has already been defined as a data property."),
  52911. vm
  52912. );
  52913. }
  52914. }
  52915. if (props && hasOwn(props, key)) {
  52916. warn(
  52917. "The data property \"" + key + "\" is already declared as a prop. " +
  52918. "Use prop default value instead.",
  52919. vm
  52920. );
  52921. } else if (!isReserved(key)) {
  52922. proxy(vm, "_data", key);
  52923. }
  52924. }
  52925. // observe data
  52926. observe(data, true /* asRootData */);
  52927. }
  52928. function getData (data, vm) {
  52929. // #7573 disable dep collection when invoking data getters
  52930. pushTarget();
  52931. try {
  52932. return data.call(vm, vm)
  52933. } catch (e) {
  52934. handleError(e, vm, "data()");
  52935. return {}
  52936. } finally {
  52937. popTarget();
  52938. }
  52939. }
  52940. var computedWatcherOptions = { lazy: true };
  52941. function initComputed (vm, computed) {
  52942. // $flow-disable-line
  52943. var watchers = vm._computedWatchers = Object.create(null);
  52944. // computed properties are just getters during SSR
  52945. var isSSR = isServerRendering();
  52946. for (var key in computed) {
  52947. var userDef = computed[key];
  52948. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  52949. if (getter == null) {
  52950. warn(
  52951. ("Getter is missing for computed property \"" + key + "\"."),
  52952. vm
  52953. );
  52954. }
  52955. if (!isSSR) {
  52956. // create internal watcher for the computed property.
  52957. watchers[key] = new Watcher(
  52958. vm,
  52959. getter || noop,
  52960. noop,
  52961. computedWatcherOptions
  52962. );
  52963. }
  52964. // component-defined computed properties are already defined on the
  52965. // component prototype. We only need to define computed properties defined
  52966. // at instantiation here.
  52967. if (!(key in vm)) {
  52968. defineComputed(vm, key, userDef);
  52969. } else {
  52970. if (key in vm.$data) {
  52971. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  52972. } else if (vm.$options.props && key in vm.$options.props) {
  52973. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  52974. }
  52975. }
  52976. }
  52977. }
  52978. function defineComputed (
  52979. target,
  52980. key,
  52981. userDef
  52982. ) {
  52983. var shouldCache = !isServerRendering();
  52984. if (typeof userDef === 'function') {
  52985. sharedPropertyDefinition.get = shouldCache
  52986. ? createComputedGetter(key)
  52987. : createGetterInvoker(userDef);
  52988. sharedPropertyDefinition.set = noop;
  52989. } else {
  52990. sharedPropertyDefinition.get = userDef.get
  52991. ? shouldCache && userDef.cache !== false
  52992. ? createComputedGetter(key)
  52993. : createGetterInvoker(userDef.get)
  52994. : noop;
  52995. sharedPropertyDefinition.set = userDef.set || noop;
  52996. }
  52997. if (sharedPropertyDefinition.set === noop) {
  52998. sharedPropertyDefinition.set = function () {
  52999. warn(
  53000. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53001. this
  53002. );
  53003. };
  53004. }
  53005. Object.defineProperty(target, key, sharedPropertyDefinition);
  53006. }
  53007. function createComputedGetter (key) {
  53008. return function computedGetter () {
  53009. var watcher = this._computedWatchers && this._computedWatchers[key];
  53010. if (watcher) {
  53011. if (watcher.dirty) {
  53012. watcher.evaluate();
  53013. }
  53014. if (Dep.target) {
  53015. watcher.depend();
  53016. }
  53017. return watcher.value
  53018. }
  53019. }
  53020. }
  53021. function createGetterInvoker(fn) {
  53022. return function computedGetter () {
  53023. return fn.call(this, this)
  53024. }
  53025. }
  53026. function initMethods (vm, methods) {
  53027. var props = vm.$options.props;
  53028. for (var key in methods) {
  53029. {
  53030. if (typeof methods[key] !== 'function') {
  53031. warn(
  53032. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53033. "Did you reference the function correctly?",
  53034. vm
  53035. );
  53036. }
  53037. if (props && hasOwn(props, key)) {
  53038. warn(
  53039. ("Method \"" + key + "\" has already been defined as a prop."),
  53040. vm
  53041. );
  53042. }
  53043. if ((key in vm) && isReserved(key)) {
  53044. warn(
  53045. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53046. "Avoid defining component methods that start with _ or $."
  53047. );
  53048. }
  53049. }
  53050. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53051. }
  53052. }
  53053. function initWatch (vm, watch) {
  53054. for (var key in watch) {
  53055. var handler = watch[key];
  53056. if (Array.isArray(handler)) {
  53057. for (var i = 0; i < handler.length; i++) {
  53058. createWatcher(vm, key, handler[i]);
  53059. }
  53060. } else {
  53061. createWatcher(vm, key, handler);
  53062. }
  53063. }
  53064. }
  53065. function createWatcher (
  53066. vm,
  53067. expOrFn,
  53068. handler,
  53069. options
  53070. ) {
  53071. if (isPlainObject(handler)) {
  53072. options = handler;
  53073. handler = handler.handler;
  53074. }
  53075. if (typeof handler === 'string') {
  53076. handler = vm[handler];
  53077. }
  53078. return vm.$watch(expOrFn, handler, options)
  53079. }
  53080. function stateMixin (Vue) {
  53081. // flow somehow has problems with directly declared definition object
  53082. // when using Object.defineProperty, so we have to procedurally build up
  53083. // the object here.
  53084. var dataDef = {};
  53085. dataDef.get = function () { return this._data };
  53086. var propsDef = {};
  53087. propsDef.get = function () { return this._props };
  53088. {
  53089. dataDef.set = function () {
  53090. warn(
  53091. 'Avoid replacing instance root $data. ' +
  53092. 'Use nested data properties instead.',
  53093. this
  53094. );
  53095. };
  53096. propsDef.set = function () {
  53097. warn("$props is readonly.", this);
  53098. };
  53099. }
  53100. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53101. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53102. Vue.prototype.$set = set;
  53103. Vue.prototype.$delete = del;
  53104. Vue.prototype.$watch = function (
  53105. expOrFn,
  53106. cb,
  53107. options
  53108. ) {
  53109. var vm = this;
  53110. if (isPlainObject(cb)) {
  53111. return createWatcher(vm, expOrFn, cb, options)
  53112. }
  53113. options = options || {};
  53114. options.user = true;
  53115. var watcher = new Watcher(vm, expOrFn, cb, options);
  53116. if (options.immediate) {
  53117. try {
  53118. cb.call(vm, watcher.value);
  53119. } catch (error) {
  53120. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53121. }
  53122. }
  53123. return function unwatchFn () {
  53124. watcher.teardown();
  53125. }
  53126. };
  53127. }
  53128. /* */
  53129. var uid$3 = 0;
  53130. function initMixin (Vue) {
  53131. Vue.prototype._init = function (options) {
  53132. var vm = this;
  53133. // a uid
  53134. vm._uid = uid$3++;
  53135. var startTag, endTag;
  53136. /* istanbul ignore if */
  53137. if (config.performance && mark) {
  53138. startTag = "vue-perf-start:" + (vm._uid);
  53139. endTag = "vue-perf-end:" + (vm._uid);
  53140. mark(startTag);
  53141. }
  53142. // a flag to avoid this being observed
  53143. vm._isVue = true;
  53144. // merge options
  53145. if (options && options._isComponent) {
  53146. // optimize internal component instantiation
  53147. // since dynamic options merging is pretty slow, and none of the
  53148. // internal component options needs special treatment.
  53149. initInternalComponent(vm, options);
  53150. } else {
  53151. vm.$options = mergeOptions(
  53152. resolveConstructorOptions(vm.constructor),
  53153. options || {},
  53154. vm
  53155. );
  53156. }
  53157. /* istanbul ignore else */
  53158. {
  53159. initProxy(vm);
  53160. }
  53161. // expose real self
  53162. vm._self = vm;
  53163. initLifecycle(vm);
  53164. initEvents(vm);
  53165. initRender(vm);
  53166. callHook(vm, 'beforeCreate');
  53167. initInjections(vm); // resolve injections before data/props
  53168. initState(vm);
  53169. initProvide(vm); // resolve provide after data/props
  53170. callHook(vm, 'created');
  53171. /* istanbul ignore if */
  53172. if (config.performance && mark) {
  53173. vm._name = formatComponentName(vm, false);
  53174. mark(endTag);
  53175. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53176. }
  53177. if (vm.$options.el) {
  53178. vm.$mount(vm.$options.el);
  53179. }
  53180. };
  53181. }
  53182. function initInternalComponent (vm, options) {
  53183. var opts = vm.$options = Object.create(vm.constructor.options);
  53184. // doing this because it's faster than dynamic enumeration.
  53185. var parentVnode = options._parentVnode;
  53186. opts.parent = options.parent;
  53187. opts._parentVnode = parentVnode;
  53188. var vnodeComponentOptions = parentVnode.componentOptions;
  53189. opts.propsData = vnodeComponentOptions.propsData;
  53190. opts._parentListeners = vnodeComponentOptions.listeners;
  53191. opts._renderChildren = vnodeComponentOptions.children;
  53192. opts._componentTag = vnodeComponentOptions.tag;
  53193. if (options.render) {
  53194. opts.render = options.render;
  53195. opts.staticRenderFns = options.staticRenderFns;
  53196. }
  53197. }
  53198. function resolveConstructorOptions (Ctor) {
  53199. var options = Ctor.options;
  53200. if (Ctor.super) {
  53201. var superOptions = resolveConstructorOptions(Ctor.super);
  53202. var cachedSuperOptions = Ctor.superOptions;
  53203. if (superOptions !== cachedSuperOptions) {
  53204. // super option changed,
  53205. // need to resolve new options.
  53206. Ctor.superOptions = superOptions;
  53207. // check if there are any late-modified/attached options (#4976)
  53208. var modifiedOptions = resolveModifiedOptions(Ctor);
  53209. // update base extend options
  53210. if (modifiedOptions) {
  53211. extend(Ctor.extendOptions, modifiedOptions);
  53212. }
  53213. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53214. if (options.name) {
  53215. options.components[options.name] = Ctor;
  53216. }
  53217. }
  53218. }
  53219. return options
  53220. }
  53221. function resolveModifiedOptions (Ctor) {
  53222. var modified;
  53223. var latest = Ctor.options;
  53224. var sealed = Ctor.sealedOptions;
  53225. for (var key in latest) {
  53226. if (latest[key] !== sealed[key]) {
  53227. if (!modified) { modified = {}; }
  53228. modified[key] = latest[key];
  53229. }
  53230. }
  53231. return modified
  53232. }
  53233. function Vue (options) {
  53234. if (!(this instanceof Vue)
  53235. ) {
  53236. warn('Vue is a constructor and should be called with the `new` keyword');
  53237. }
  53238. this._init(options);
  53239. }
  53240. initMixin(Vue);
  53241. stateMixin(Vue);
  53242. eventsMixin(Vue);
  53243. lifecycleMixin(Vue);
  53244. renderMixin(Vue);
  53245. /* */
  53246. function initUse (Vue) {
  53247. Vue.use = function (plugin) {
  53248. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53249. if (installedPlugins.indexOf(plugin) > -1) {
  53250. return this
  53251. }
  53252. // additional parameters
  53253. var args = toArray(arguments, 1);
  53254. args.unshift(this);
  53255. if (typeof plugin.install === 'function') {
  53256. plugin.install.apply(plugin, args);
  53257. } else if (typeof plugin === 'function') {
  53258. plugin.apply(null, args);
  53259. }
  53260. installedPlugins.push(plugin);
  53261. return this
  53262. };
  53263. }
  53264. /* */
  53265. function initMixin$1 (Vue) {
  53266. Vue.mixin = function (mixin) {
  53267. this.options = mergeOptions(this.options, mixin);
  53268. return this
  53269. };
  53270. }
  53271. /* */
  53272. function initExtend (Vue) {
  53273. /**
  53274. * Each instance constructor, including Vue, has a unique
  53275. * cid. This enables us to create wrapped "child
  53276. * constructors" for prototypal inheritance and cache them.
  53277. */
  53278. Vue.cid = 0;
  53279. var cid = 1;
  53280. /**
  53281. * Class inheritance
  53282. */
  53283. Vue.extend = function (extendOptions) {
  53284. extendOptions = extendOptions || {};
  53285. var Super = this;
  53286. var SuperId = Super.cid;
  53287. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53288. if (cachedCtors[SuperId]) {
  53289. return cachedCtors[SuperId]
  53290. }
  53291. var name = extendOptions.name || Super.options.name;
  53292. if (name) {
  53293. validateComponentName(name);
  53294. }
  53295. var Sub = function VueComponent (options) {
  53296. this._init(options);
  53297. };
  53298. Sub.prototype = Object.create(Super.prototype);
  53299. Sub.prototype.constructor = Sub;
  53300. Sub.cid = cid++;
  53301. Sub.options = mergeOptions(
  53302. Super.options,
  53303. extendOptions
  53304. );
  53305. Sub['super'] = Super;
  53306. // For props and computed properties, we define the proxy getters on
  53307. // the Vue instances at extension time, on the extended prototype. This
  53308. // avoids Object.defineProperty calls for each instance created.
  53309. if (Sub.options.props) {
  53310. initProps$1(Sub);
  53311. }
  53312. if (Sub.options.computed) {
  53313. initComputed$1(Sub);
  53314. }
  53315. // allow further extension/mixin/plugin usage
  53316. Sub.extend = Super.extend;
  53317. Sub.mixin = Super.mixin;
  53318. Sub.use = Super.use;
  53319. // create asset registers, so extended classes
  53320. // can have their private assets too.
  53321. ASSET_TYPES.forEach(function (type) {
  53322. Sub[type] = Super[type];
  53323. });
  53324. // enable recursive self-lookup
  53325. if (name) {
  53326. Sub.options.components[name] = Sub;
  53327. }
  53328. // keep a reference to the super options at extension time.
  53329. // later at instantiation we can check if Super's options have
  53330. // been updated.
  53331. Sub.superOptions = Super.options;
  53332. Sub.extendOptions = extendOptions;
  53333. Sub.sealedOptions = extend({}, Sub.options);
  53334. // cache constructor
  53335. cachedCtors[SuperId] = Sub;
  53336. return Sub
  53337. };
  53338. }
  53339. function initProps$1 (Comp) {
  53340. var props = Comp.options.props;
  53341. for (var key in props) {
  53342. proxy(Comp.prototype, "_props", key);
  53343. }
  53344. }
  53345. function initComputed$1 (Comp) {
  53346. var computed = Comp.options.computed;
  53347. for (var key in computed) {
  53348. defineComputed(Comp.prototype, key, computed[key]);
  53349. }
  53350. }
  53351. /* */
  53352. function initAssetRegisters (Vue) {
  53353. /**
  53354. * Create asset registration methods.
  53355. */
  53356. ASSET_TYPES.forEach(function (type) {
  53357. Vue[type] = function (
  53358. id,
  53359. definition
  53360. ) {
  53361. if (!definition) {
  53362. return this.options[type + 's'][id]
  53363. } else {
  53364. /* istanbul ignore if */
  53365. if (type === 'component') {
  53366. validateComponentName(id);
  53367. }
  53368. if (type === 'component' && isPlainObject(definition)) {
  53369. definition.name = definition.name || id;
  53370. definition = this.options._base.extend(definition);
  53371. }
  53372. if (type === 'directive' && typeof definition === 'function') {
  53373. definition = { bind: definition, update: definition };
  53374. }
  53375. this.options[type + 's'][id] = definition;
  53376. return definition
  53377. }
  53378. };
  53379. });
  53380. }
  53381. /* */
  53382. function getComponentName (opts) {
  53383. return opts && (opts.Ctor.options.name || opts.tag)
  53384. }
  53385. function matches (pattern, name) {
  53386. if (Array.isArray(pattern)) {
  53387. return pattern.indexOf(name) > -1
  53388. } else if (typeof pattern === 'string') {
  53389. return pattern.split(',').indexOf(name) > -1
  53390. } else if (isRegExp(pattern)) {
  53391. return pattern.test(name)
  53392. }
  53393. /* istanbul ignore next */
  53394. return false
  53395. }
  53396. function pruneCache (keepAliveInstance, filter) {
  53397. var cache = keepAliveInstance.cache;
  53398. var keys = keepAliveInstance.keys;
  53399. var _vnode = keepAliveInstance._vnode;
  53400. for (var key in cache) {
  53401. var cachedNode = cache[key];
  53402. if (cachedNode) {
  53403. var name = getComponentName(cachedNode.componentOptions);
  53404. if (name && !filter(name)) {
  53405. pruneCacheEntry(cache, key, keys, _vnode);
  53406. }
  53407. }
  53408. }
  53409. }
  53410. function pruneCacheEntry (
  53411. cache,
  53412. key,
  53413. keys,
  53414. current
  53415. ) {
  53416. var cached$$1 = cache[key];
  53417. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  53418. cached$$1.componentInstance.$destroy();
  53419. }
  53420. cache[key] = null;
  53421. remove(keys, key);
  53422. }
  53423. var patternTypes = [String, RegExp, Array];
  53424. var KeepAlive = {
  53425. name: 'keep-alive',
  53426. abstract: true,
  53427. props: {
  53428. include: patternTypes,
  53429. exclude: patternTypes,
  53430. max: [String, Number]
  53431. },
  53432. created: function created () {
  53433. this.cache = Object.create(null);
  53434. this.keys = [];
  53435. },
  53436. destroyed: function destroyed () {
  53437. for (var key in this.cache) {
  53438. pruneCacheEntry(this.cache, key, this.keys);
  53439. }
  53440. },
  53441. mounted: function mounted () {
  53442. var this$1 = this;
  53443. this.$watch('include', function (val) {
  53444. pruneCache(this$1, function (name) { return matches(val, name); });
  53445. });
  53446. this.$watch('exclude', function (val) {
  53447. pruneCache(this$1, function (name) { return !matches(val, name); });
  53448. });
  53449. },
  53450. render: function render () {
  53451. var slot = this.$slots.default;
  53452. var vnode = getFirstComponentChild(slot);
  53453. var componentOptions = vnode && vnode.componentOptions;
  53454. if (componentOptions) {
  53455. // check pattern
  53456. var name = getComponentName(componentOptions);
  53457. var ref = this;
  53458. var include = ref.include;
  53459. var exclude = ref.exclude;
  53460. if (
  53461. // not included
  53462. (include && (!name || !matches(include, name))) ||
  53463. // excluded
  53464. (exclude && name && matches(exclude, name))
  53465. ) {
  53466. return vnode
  53467. }
  53468. var ref$1 = this;
  53469. var cache = ref$1.cache;
  53470. var keys = ref$1.keys;
  53471. var key = vnode.key == null
  53472. // same constructor may get registered as different local components
  53473. // so cid alone is not enough (#3269)
  53474. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  53475. : vnode.key;
  53476. if (cache[key]) {
  53477. vnode.componentInstance = cache[key].componentInstance;
  53478. // make current key freshest
  53479. remove(keys, key);
  53480. keys.push(key);
  53481. } else {
  53482. cache[key] = vnode;
  53483. keys.push(key);
  53484. // prune oldest entry
  53485. if (this.max && keys.length > parseInt(this.max)) {
  53486. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  53487. }
  53488. }
  53489. vnode.data.keepAlive = true;
  53490. }
  53491. return vnode || (slot && slot[0])
  53492. }
  53493. };
  53494. var builtInComponents = {
  53495. KeepAlive: KeepAlive
  53496. };
  53497. /* */
  53498. function initGlobalAPI (Vue) {
  53499. // config
  53500. var configDef = {};
  53501. configDef.get = function () { return config; };
  53502. {
  53503. configDef.set = function () {
  53504. warn(
  53505. 'Do not replace the Vue.config object, set individual fields instead.'
  53506. );
  53507. };
  53508. }
  53509. Object.defineProperty(Vue, 'config', configDef);
  53510. // exposed util methods.
  53511. // NOTE: these are not considered part of the public API - avoid relying on
  53512. // them unless you are aware of the risk.
  53513. Vue.util = {
  53514. warn: warn,
  53515. extend: extend,
  53516. mergeOptions: mergeOptions,
  53517. defineReactive: defineReactive$$1
  53518. };
  53519. Vue.set = set;
  53520. Vue.delete = del;
  53521. Vue.nextTick = nextTick;
  53522. // 2.6 explicit observable API
  53523. Vue.observable = function (obj) {
  53524. observe(obj);
  53525. return obj
  53526. };
  53527. Vue.options = Object.create(null);
  53528. ASSET_TYPES.forEach(function (type) {
  53529. Vue.options[type + 's'] = Object.create(null);
  53530. });
  53531. // this is used to identify the "base" constructor to extend all plain-object
  53532. // components with in Weex's multi-instance scenarios.
  53533. Vue.options._base = Vue;
  53534. extend(Vue.options.components, builtInComponents);
  53535. initUse(Vue);
  53536. initMixin$1(Vue);
  53537. initExtend(Vue);
  53538. initAssetRegisters(Vue);
  53539. }
  53540. initGlobalAPI(Vue);
  53541. Object.defineProperty(Vue.prototype, '$isServer', {
  53542. get: isServerRendering
  53543. });
  53544. Object.defineProperty(Vue.prototype, '$ssrContext', {
  53545. get: function get () {
  53546. /* istanbul ignore next */
  53547. return this.$vnode && this.$vnode.ssrContext
  53548. }
  53549. });
  53550. // expose FunctionalRenderContext for ssr runtime helper installation
  53551. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  53552. value: FunctionalRenderContext
  53553. });
  53554. Vue.version = '2.6.11';
  53555. /* */
  53556. // these are reserved for web because they are directly compiled away
  53557. // during template compilation
  53558. var isReservedAttr = makeMap('style,class');
  53559. // attributes that should be using props for binding
  53560. var acceptValue = makeMap('input,textarea,option,select,progress');
  53561. var mustUseProp = function (tag, type, attr) {
  53562. return (
  53563. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  53564. (attr === 'selected' && tag === 'option') ||
  53565. (attr === 'checked' && tag === 'input') ||
  53566. (attr === 'muted' && tag === 'video')
  53567. )
  53568. };
  53569. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  53570. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  53571. var convertEnumeratedValue = function (key, value) {
  53572. return isFalsyAttrValue(value) || value === 'false'
  53573. ? 'false'
  53574. // allow arbitrary string value for contenteditable
  53575. : key === 'contenteditable' && isValidContentEditableValue(value)
  53576. ? value
  53577. : 'true'
  53578. };
  53579. var isBooleanAttr = makeMap(
  53580. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  53581. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  53582. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  53583. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  53584. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  53585. 'truespeed,typemustmatch,visible'
  53586. );
  53587. var xlinkNS = 'http://www.w3.org/1999/xlink';
  53588. var isXlink = function (name) {
  53589. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  53590. };
  53591. var getXlinkProp = function (name) {
  53592. return isXlink(name) ? name.slice(6, name.length) : ''
  53593. };
  53594. var isFalsyAttrValue = function (val) {
  53595. return val == null || val === false
  53596. };
  53597. /* */
  53598. function genClassForVnode (vnode) {
  53599. var data = vnode.data;
  53600. var parentNode = vnode;
  53601. var childNode = vnode;
  53602. while (isDef(childNode.componentInstance)) {
  53603. childNode = childNode.componentInstance._vnode;
  53604. if (childNode && childNode.data) {
  53605. data = mergeClassData(childNode.data, data);
  53606. }
  53607. }
  53608. while (isDef(parentNode = parentNode.parent)) {
  53609. if (parentNode && parentNode.data) {
  53610. data = mergeClassData(data, parentNode.data);
  53611. }
  53612. }
  53613. return renderClass(data.staticClass, data.class)
  53614. }
  53615. function mergeClassData (child, parent) {
  53616. return {
  53617. staticClass: concat(child.staticClass, parent.staticClass),
  53618. class: isDef(child.class)
  53619. ? [child.class, parent.class]
  53620. : parent.class
  53621. }
  53622. }
  53623. function renderClass (
  53624. staticClass,
  53625. dynamicClass
  53626. ) {
  53627. if (isDef(staticClass) || isDef(dynamicClass)) {
  53628. return concat(staticClass, stringifyClass(dynamicClass))
  53629. }
  53630. /* istanbul ignore next */
  53631. return ''
  53632. }
  53633. function concat (a, b) {
  53634. return a ? b ? (a + ' ' + b) : a : (b || '')
  53635. }
  53636. function stringifyClass (value) {
  53637. if (Array.isArray(value)) {
  53638. return stringifyArray(value)
  53639. }
  53640. if (isObject(value)) {
  53641. return stringifyObject(value)
  53642. }
  53643. if (typeof value === 'string') {
  53644. return value
  53645. }
  53646. /* istanbul ignore next */
  53647. return ''
  53648. }
  53649. function stringifyArray (value) {
  53650. var res = '';
  53651. var stringified;
  53652. for (var i = 0, l = value.length; i < l; i++) {
  53653. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  53654. if (res) { res += ' '; }
  53655. res += stringified;
  53656. }
  53657. }
  53658. return res
  53659. }
  53660. function stringifyObject (value) {
  53661. var res = '';
  53662. for (var key in value) {
  53663. if (value[key]) {
  53664. if (res) { res += ' '; }
  53665. res += key;
  53666. }
  53667. }
  53668. return res
  53669. }
  53670. /* */
  53671. var namespaceMap = {
  53672. svg: 'http://www.w3.org/2000/svg',
  53673. math: 'http://www.w3.org/1998/Math/MathML'
  53674. };
  53675. var isHTMLTag = makeMap(
  53676. 'html,body,base,head,link,meta,style,title,' +
  53677. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  53678. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  53679. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  53680. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  53681. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  53682. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  53683. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  53684. 'output,progress,select,textarea,' +
  53685. 'details,dialog,menu,menuitem,summary,' +
  53686. 'content,element,shadow,template,blockquote,iframe,tfoot'
  53687. );
  53688. // this map is intentionally selective, only covering SVG elements that may
  53689. // contain child elements.
  53690. var isSVG = makeMap(
  53691. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  53692. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  53693. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  53694. true
  53695. );
  53696. var isPreTag = function (tag) { return tag === 'pre'; };
  53697. var isReservedTag = function (tag) {
  53698. return isHTMLTag(tag) || isSVG(tag)
  53699. };
  53700. function getTagNamespace (tag) {
  53701. if (isSVG(tag)) {
  53702. return 'svg'
  53703. }
  53704. // basic support for MathML
  53705. // note it doesn't support other MathML elements being component roots
  53706. if (tag === 'math') {
  53707. return 'math'
  53708. }
  53709. }
  53710. var unknownElementCache = Object.create(null);
  53711. function isUnknownElement (tag) {
  53712. /* istanbul ignore if */
  53713. if (!inBrowser) {
  53714. return true
  53715. }
  53716. if (isReservedTag(tag)) {
  53717. return false
  53718. }
  53719. tag = tag.toLowerCase();
  53720. /* istanbul ignore if */
  53721. if (unknownElementCache[tag] != null) {
  53722. return unknownElementCache[tag]
  53723. }
  53724. var el = document.createElement(tag);
  53725. if (tag.indexOf('-') > -1) {
  53726. // http://stackoverflow.com/a/28210364/1070244
  53727. return (unknownElementCache[tag] = (
  53728. el.constructor === window.HTMLUnknownElement ||
  53729. el.constructor === window.HTMLElement
  53730. ))
  53731. } else {
  53732. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  53733. }
  53734. }
  53735. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  53736. /* */
  53737. /**
  53738. * Query an element selector if it's not an element already.
  53739. */
  53740. function query (el) {
  53741. if (typeof el === 'string') {
  53742. var selected = document.querySelector(el);
  53743. if (!selected) {
  53744. warn(
  53745. 'Cannot find element: ' + el
  53746. );
  53747. return document.createElement('div')
  53748. }
  53749. return selected
  53750. } else {
  53751. return el
  53752. }
  53753. }
  53754. /* */
  53755. function createElement$1 (tagName, vnode) {
  53756. var elm = document.createElement(tagName);
  53757. if (tagName !== 'select') {
  53758. return elm
  53759. }
  53760. // false or null will remove the attribute but undefined will not
  53761. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  53762. elm.setAttribute('multiple', 'multiple');
  53763. }
  53764. return elm
  53765. }
  53766. function createElementNS (namespace, tagName) {
  53767. return document.createElementNS(namespaceMap[namespace], tagName)
  53768. }
  53769. function createTextNode (text) {
  53770. return document.createTextNode(text)
  53771. }
  53772. function createComment (text) {
  53773. return document.createComment(text)
  53774. }
  53775. function insertBefore (parentNode, newNode, referenceNode) {
  53776. parentNode.insertBefore(newNode, referenceNode);
  53777. }
  53778. function removeChild (node, child) {
  53779. node.removeChild(child);
  53780. }
  53781. function appendChild (node, child) {
  53782. node.appendChild(child);
  53783. }
  53784. function parentNode (node) {
  53785. return node.parentNode
  53786. }
  53787. function nextSibling (node) {
  53788. return node.nextSibling
  53789. }
  53790. function tagName (node) {
  53791. return node.tagName
  53792. }
  53793. function setTextContent (node, text) {
  53794. node.textContent = text;
  53795. }
  53796. function setStyleScope (node, scopeId) {
  53797. node.setAttribute(scopeId, '');
  53798. }
  53799. var nodeOps = /*#__PURE__*/Object.freeze({
  53800. createElement: createElement$1,
  53801. createElementNS: createElementNS,
  53802. createTextNode: createTextNode,
  53803. createComment: createComment,
  53804. insertBefore: insertBefore,
  53805. removeChild: removeChild,
  53806. appendChild: appendChild,
  53807. parentNode: parentNode,
  53808. nextSibling: nextSibling,
  53809. tagName: tagName,
  53810. setTextContent: setTextContent,
  53811. setStyleScope: setStyleScope
  53812. });
  53813. /* */
  53814. var ref = {
  53815. create: function create (_, vnode) {
  53816. registerRef(vnode);
  53817. },
  53818. update: function update (oldVnode, vnode) {
  53819. if (oldVnode.data.ref !== vnode.data.ref) {
  53820. registerRef(oldVnode, true);
  53821. registerRef(vnode);
  53822. }
  53823. },
  53824. destroy: function destroy (vnode) {
  53825. registerRef(vnode, true);
  53826. }
  53827. };
  53828. function registerRef (vnode, isRemoval) {
  53829. var key = vnode.data.ref;
  53830. if (!isDef(key)) { return }
  53831. var vm = vnode.context;
  53832. var ref = vnode.componentInstance || vnode.elm;
  53833. var refs = vm.$refs;
  53834. if (isRemoval) {
  53835. if (Array.isArray(refs[key])) {
  53836. remove(refs[key], ref);
  53837. } else if (refs[key] === ref) {
  53838. refs[key] = undefined;
  53839. }
  53840. } else {
  53841. if (vnode.data.refInFor) {
  53842. if (!Array.isArray(refs[key])) {
  53843. refs[key] = [ref];
  53844. } else if (refs[key].indexOf(ref) < 0) {
  53845. // $flow-disable-line
  53846. refs[key].push(ref);
  53847. }
  53848. } else {
  53849. refs[key] = ref;
  53850. }
  53851. }
  53852. }
  53853. /**
  53854. * Virtual DOM patching algorithm based on Snabbdom by
  53855. * Simon Friis Vindum (@paldepind)
  53856. * Licensed under the MIT License
  53857. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  53858. *
  53859. * modified by Evan You (@yyx990803)
  53860. *
  53861. * Not type-checking this because this file is perf-critical and the cost
  53862. * of making flow understand it is not worth it.
  53863. */
  53864. var emptyNode = new VNode('', {}, []);
  53865. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  53866. function sameVnode (a, b) {
  53867. return (
  53868. a.key === b.key && (
  53869. (
  53870. a.tag === b.tag &&
  53871. a.isComment === b.isComment &&
  53872. isDef(a.data) === isDef(b.data) &&
  53873. sameInputType(a, b)
  53874. ) || (
  53875. isTrue(a.isAsyncPlaceholder) &&
  53876. a.asyncFactory === b.asyncFactory &&
  53877. isUndef(b.asyncFactory.error)
  53878. )
  53879. )
  53880. )
  53881. }
  53882. function sameInputType (a, b) {
  53883. if (a.tag !== 'input') { return true }
  53884. var i;
  53885. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  53886. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  53887. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  53888. }
  53889. function createKeyToOldIdx (children, beginIdx, endIdx) {
  53890. var i, key;
  53891. var map = {};
  53892. for (i = beginIdx; i <= endIdx; ++i) {
  53893. key = children[i].key;
  53894. if (isDef(key)) { map[key] = i; }
  53895. }
  53896. return map
  53897. }
  53898. function createPatchFunction (backend) {
  53899. var i, j;
  53900. var cbs = {};
  53901. var modules = backend.modules;
  53902. var nodeOps = backend.nodeOps;
  53903. for (i = 0; i < hooks.length; ++i) {
  53904. cbs[hooks[i]] = [];
  53905. for (j = 0; j < modules.length; ++j) {
  53906. if (isDef(modules[j][hooks[i]])) {
  53907. cbs[hooks[i]].push(modules[j][hooks[i]]);
  53908. }
  53909. }
  53910. }
  53911. function emptyNodeAt (elm) {
  53912. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  53913. }
  53914. function createRmCb (childElm, listeners) {
  53915. function remove$$1 () {
  53916. if (--remove$$1.listeners === 0) {
  53917. removeNode(childElm);
  53918. }
  53919. }
  53920. remove$$1.listeners = listeners;
  53921. return remove$$1
  53922. }
  53923. function removeNode (el) {
  53924. var parent = nodeOps.parentNode(el);
  53925. // element may have already been removed due to v-html / v-text
  53926. if (isDef(parent)) {
  53927. nodeOps.removeChild(parent, el);
  53928. }
  53929. }
  53930. function isUnknownElement$$1 (vnode, inVPre) {
  53931. return (
  53932. !inVPre &&
  53933. !vnode.ns &&
  53934. !(
  53935. config.ignoredElements.length &&
  53936. config.ignoredElements.some(function (ignore) {
  53937. return isRegExp(ignore)
  53938. ? ignore.test(vnode.tag)
  53939. : ignore === vnode.tag
  53940. })
  53941. ) &&
  53942. config.isUnknownElement(vnode.tag)
  53943. )
  53944. }
  53945. var creatingElmInVPre = 0;
  53946. function createElm (
  53947. vnode,
  53948. insertedVnodeQueue,
  53949. parentElm,
  53950. refElm,
  53951. nested,
  53952. ownerArray,
  53953. index
  53954. ) {
  53955. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53956. // This vnode was used in a previous render!
  53957. // now it's used as a new node, overwriting its elm would cause
  53958. // potential patch errors down the road when it's used as an insertion
  53959. // reference node. Instead, we clone the node on-demand before creating
  53960. // associated DOM element for it.
  53961. vnode = ownerArray[index] = cloneVNode(vnode);
  53962. }
  53963. vnode.isRootInsert = !nested; // for transition enter check
  53964. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  53965. return
  53966. }
  53967. var data = vnode.data;
  53968. var children = vnode.children;
  53969. var tag = vnode.tag;
  53970. if (isDef(tag)) {
  53971. {
  53972. if (data && data.pre) {
  53973. creatingElmInVPre++;
  53974. }
  53975. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  53976. warn(
  53977. 'Unknown custom element: <' + tag + '> - did you ' +
  53978. 'register the component correctly? For recursive components, ' +
  53979. 'make sure to provide the "name" option.',
  53980. vnode.context
  53981. );
  53982. }
  53983. }
  53984. vnode.elm = vnode.ns
  53985. ? nodeOps.createElementNS(vnode.ns, tag)
  53986. : nodeOps.createElement(tag, vnode);
  53987. setScope(vnode);
  53988. /* istanbul ignore if */
  53989. {
  53990. createChildren(vnode, children, insertedVnodeQueue);
  53991. if (isDef(data)) {
  53992. invokeCreateHooks(vnode, insertedVnodeQueue);
  53993. }
  53994. insert(parentElm, vnode.elm, refElm);
  53995. }
  53996. if (data && data.pre) {
  53997. creatingElmInVPre--;
  53998. }
  53999. } else if (isTrue(vnode.isComment)) {
  54000. vnode.elm = nodeOps.createComment(vnode.text);
  54001. insert(parentElm, vnode.elm, refElm);
  54002. } else {
  54003. vnode.elm = nodeOps.createTextNode(vnode.text);
  54004. insert(parentElm, vnode.elm, refElm);
  54005. }
  54006. }
  54007. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54008. var i = vnode.data;
  54009. if (isDef(i)) {
  54010. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54011. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54012. i(vnode, false /* hydrating */);
  54013. }
  54014. // after calling the init hook, if the vnode is a child component
  54015. // it should've created a child instance and mounted it. the child
  54016. // component also has set the placeholder vnode's elm.
  54017. // in that case we can just return the element and be done.
  54018. if (isDef(vnode.componentInstance)) {
  54019. initComponent(vnode, insertedVnodeQueue);
  54020. insert(parentElm, vnode.elm, refElm);
  54021. if (isTrue(isReactivated)) {
  54022. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54023. }
  54024. return true
  54025. }
  54026. }
  54027. }
  54028. function initComponent (vnode, insertedVnodeQueue) {
  54029. if (isDef(vnode.data.pendingInsert)) {
  54030. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54031. vnode.data.pendingInsert = null;
  54032. }
  54033. vnode.elm = vnode.componentInstance.$el;
  54034. if (isPatchable(vnode)) {
  54035. invokeCreateHooks(vnode, insertedVnodeQueue);
  54036. setScope(vnode);
  54037. } else {
  54038. // empty component root.
  54039. // skip all element-related modules except for ref (#3455)
  54040. registerRef(vnode);
  54041. // make sure to invoke the insert hook
  54042. insertedVnodeQueue.push(vnode);
  54043. }
  54044. }
  54045. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54046. var i;
  54047. // hack for #4339: a reactivated component with inner transition
  54048. // does not trigger because the inner node's created hooks are not called
  54049. // again. It's not ideal to involve module-specific logic in here but
  54050. // there doesn't seem to be a better way to do it.
  54051. var innerNode = vnode;
  54052. while (innerNode.componentInstance) {
  54053. innerNode = innerNode.componentInstance._vnode;
  54054. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54055. for (i = 0; i < cbs.activate.length; ++i) {
  54056. cbs.activate[i](emptyNode, innerNode);
  54057. }
  54058. insertedVnodeQueue.push(innerNode);
  54059. break
  54060. }
  54061. }
  54062. // unlike a newly created component,
  54063. // a reactivated keep-alive component doesn't insert itself
  54064. insert(parentElm, vnode.elm, refElm);
  54065. }
  54066. function insert (parent, elm, ref$$1) {
  54067. if (isDef(parent)) {
  54068. if (isDef(ref$$1)) {
  54069. if (nodeOps.parentNode(ref$$1) === parent) {
  54070. nodeOps.insertBefore(parent, elm, ref$$1);
  54071. }
  54072. } else {
  54073. nodeOps.appendChild(parent, elm);
  54074. }
  54075. }
  54076. }
  54077. function createChildren (vnode, children, insertedVnodeQueue) {
  54078. if (Array.isArray(children)) {
  54079. {
  54080. checkDuplicateKeys(children);
  54081. }
  54082. for (var i = 0; i < children.length; ++i) {
  54083. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54084. }
  54085. } else if (isPrimitive(vnode.text)) {
  54086. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54087. }
  54088. }
  54089. function isPatchable (vnode) {
  54090. while (vnode.componentInstance) {
  54091. vnode = vnode.componentInstance._vnode;
  54092. }
  54093. return isDef(vnode.tag)
  54094. }
  54095. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54096. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54097. cbs.create[i$1](emptyNode, vnode);
  54098. }
  54099. i = vnode.data.hook; // Reuse variable
  54100. if (isDef(i)) {
  54101. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54102. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54103. }
  54104. }
  54105. // set scope id attribute for scoped CSS.
  54106. // this is implemented as a special case to avoid the overhead
  54107. // of going through the normal attribute patching process.
  54108. function setScope (vnode) {
  54109. var i;
  54110. if (isDef(i = vnode.fnScopeId)) {
  54111. nodeOps.setStyleScope(vnode.elm, i);
  54112. } else {
  54113. var ancestor = vnode;
  54114. while (ancestor) {
  54115. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54116. nodeOps.setStyleScope(vnode.elm, i);
  54117. }
  54118. ancestor = ancestor.parent;
  54119. }
  54120. }
  54121. // for slot content they should also get the scopeId from the host instance.
  54122. if (isDef(i = activeInstance) &&
  54123. i !== vnode.context &&
  54124. i !== vnode.fnContext &&
  54125. isDef(i = i.$options._scopeId)
  54126. ) {
  54127. nodeOps.setStyleScope(vnode.elm, i);
  54128. }
  54129. }
  54130. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54131. for (; startIdx <= endIdx; ++startIdx) {
  54132. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54133. }
  54134. }
  54135. function invokeDestroyHook (vnode) {
  54136. var i, j;
  54137. var data = vnode.data;
  54138. if (isDef(data)) {
  54139. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54140. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54141. }
  54142. if (isDef(i = vnode.children)) {
  54143. for (j = 0; j < vnode.children.length; ++j) {
  54144. invokeDestroyHook(vnode.children[j]);
  54145. }
  54146. }
  54147. }
  54148. function removeVnodes (vnodes, startIdx, endIdx) {
  54149. for (; startIdx <= endIdx; ++startIdx) {
  54150. var ch = vnodes[startIdx];
  54151. if (isDef(ch)) {
  54152. if (isDef(ch.tag)) {
  54153. removeAndInvokeRemoveHook(ch);
  54154. invokeDestroyHook(ch);
  54155. } else { // Text node
  54156. removeNode(ch.elm);
  54157. }
  54158. }
  54159. }
  54160. }
  54161. function removeAndInvokeRemoveHook (vnode, rm) {
  54162. if (isDef(rm) || isDef(vnode.data)) {
  54163. var i;
  54164. var listeners = cbs.remove.length + 1;
  54165. if (isDef(rm)) {
  54166. // we have a recursively passed down rm callback
  54167. // increase the listeners count
  54168. rm.listeners += listeners;
  54169. } else {
  54170. // directly removing
  54171. rm = createRmCb(vnode.elm, listeners);
  54172. }
  54173. // recursively invoke hooks on child component root node
  54174. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54175. removeAndInvokeRemoveHook(i, rm);
  54176. }
  54177. for (i = 0; i < cbs.remove.length; ++i) {
  54178. cbs.remove[i](vnode, rm);
  54179. }
  54180. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54181. i(vnode, rm);
  54182. } else {
  54183. rm();
  54184. }
  54185. } else {
  54186. removeNode(vnode.elm);
  54187. }
  54188. }
  54189. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54190. var oldStartIdx = 0;
  54191. var newStartIdx = 0;
  54192. var oldEndIdx = oldCh.length - 1;
  54193. var oldStartVnode = oldCh[0];
  54194. var oldEndVnode = oldCh[oldEndIdx];
  54195. var newEndIdx = newCh.length - 1;
  54196. var newStartVnode = newCh[0];
  54197. var newEndVnode = newCh[newEndIdx];
  54198. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54199. // removeOnly is a special flag used only by <transition-group>
  54200. // to ensure removed elements stay in correct relative positions
  54201. // during leaving transitions
  54202. var canMove = !removeOnly;
  54203. {
  54204. checkDuplicateKeys(newCh);
  54205. }
  54206. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54207. if (isUndef(oldStartVnode)) {
  54208. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54209. } else if (isUndef(oldEndVnode)) {
  54210. oldEndVnode = oldCh[--oldEndIdx];
  54211. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54212. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54213. oldStartVnode = oldCh[++oldStartIdx];
  54214. newStartVnode = newCh[++newStartIdx];
  54215. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54216. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54217. oldEndVnode = oldCh[--oldEndIdx];
  54218. newEndVnode = newCh[--newEndIdx];
  54219. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54220. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54221. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54222. oldStartVnode = oldCh[++oldStartIdx];
  54223. newEndVnode = newCh[--newEndIdx];
  54224. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54225. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54226. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54227. oldEndVnode = oldCh[--oldEndIdx];
  54228. newStartVnode = newCh[++newStartIdx];
  54229. } else {
  54230. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54231. idxInOld = isDef(newStartVnode.key)
  54232. ? oldKeyToIdx[newStartVnode.key]
  54233. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54234. if (isUndef(idxInOld)) { // New element
  54235. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54236. } else {
  54237. vnodeToMove = oldCh[idxInOld];
  54238. if (sameVnode(vnodeToMove, newStartVnode)) {
  54239. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54240. oldCh[idxInOld] = undefined;
  54241. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54242. } else {
  54243. // same key but different element. treat as new element
  54244. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54245. }
  54246. }
  54247. newStartVnode = newCh[++newStartIdx];
  54248. }
  54249. }
  54250. if (oldStartIdx > oldEndIdx) {
  54251. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54252. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54253. } else if (newStartIdx > newEndIdx) {
  54254. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54255. }
  54256. }
  54257. function checkDuplicateKeys (children) {
  54258. var seenKeys = {};
  54259. for (var i = 0; i < children.length; i++) {
  54260. var vnode = children[i];
  54261. var key = vnode.key;
  54262. if (isDef(key)) {
  54263. if (seenKeys[key]) {
  54264. warn(
  54265. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54266. vnode.context
  54267. );
  54268. } else {
  54269. seenKeys[key] = true;
  54270. }
  54271. }
  54272. }
  54273. }
  54274. function findIdxInOld (node, oldCh, start, end) {
  54275. for (var i = start; i < end; i++) {
  54276. var c = oldCh[i];
  54277. if (isDef(c) && sameVnode(node, c)) { return i }
  54278. }
  54279. }
  54280. function patchVnode (
  54281. oldVnode,
  54282. vnode,
  54283. insertedVnodeQueue,
  54284. ownerArray,
  54285. index,
  54286. removeOnly
  54287. ) {
  54288. if (oldVnode === vnode) {
  54289. return
  54290. }
  54291. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54292. // clone reused vnode
  54293. vnode = ownerArray[index] = cloneVNode(vnode);
  54294. }
  54295. var elm = vnode.elm = oldVnode.elm;
  54296. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54297. if (isDef(vnode.asyncFactory.resolved)) {
  54298. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54299. } else {
  54300. vnode.isAsyncPlaceholder = true;
  54301. }
  54302. return
  54303. }
  54304. // reuse element for static trees.
  54305. // note we only do this if the vnode is cloned -
  54306. // if the new node is not cloned it means the render functions have been
  54307. // reset by the hot-reload-api and we need to do a proper re-render.
  54308. if (isTrue(vnode.isStatic) &&
  54309. isTrue(oldVnode.isStatic) &&
  54310. vnode.key === oldVnode.key &&
  54311. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54312. ) {
  54313. vnode.componentInstance = oldVnode.componentInstance;
  54314. return
  54315. }
  54316. var i;
  54317. var data = vnode.data;
  54318. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  54319. i(oldVnode, vnode);
  54320. }
  54321. var oldCh = oldVnode.children;
  54322. var ch = vnode.children;
  54323. if (isDef(data) && isPatchable(vnode)) {
  54324. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  54325. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  54326. }
  54327. if (isUndef(vnode.text)) {
  54328. if (isDef(oldCh) && isDef(ch)) {
  54329. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  54330. } else if (isDef(ch)) {
  54331. {
  54332. checkDuplicateKeys(ch);
  54333. }
  54334. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  54335. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  54336. } else if (isDef(oldCh)) {
  54337. removeVnodes(oldCh, 0, oldCh.length - 1);
  54338. } else if (isDef(oldVnode.text)) {
  54339. nodeOps.setTextContent(elm, '');
  54340. }
  54341. } else if (oldVnode.text !== vnode.text) {
  54342. nodeOps.setTextContent(elm, vnode.text);
  54343. }
  54344. if (isDef(data)) {
  54345. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  54346. }
  54347. }
  54348. function invokeInsertHook (vnode, queue, initial) {
  54349. // delay insert hooks for component root nodes, invoke them after the
  54350. // element is really inserted
  54351. if (isTrue(initial) && isDef(vnode.parent)) {
  54352. vnode.parent.data.pendingInsert = queue;
  54353. } else {
  54354. for (var i = 0; i < queue.length; ++i) {
  54355. queue[i].data.hook.insert(queue[i]);
  54356. }
  54357. }
  54358. }
  54359. var hydrationBailed = false;
  54360. // list of modules that can skip create hook during hydration because they
  54361. // are already rendered on the client or has no need for initialization
  54362. // Note: style is excluded because it relies on initial clone for future
  54363. // deep updates (#7063).
  54364. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  54365. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  54366. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  54367. var i;
  54368. var tag = vnode.tag;
  54369. var data = vnode.data;
  54370. var children = vnode.children;
  54371. inVPre = inVPre || (data && data.pre);
  54372. vnode.elm = elm;
  54373. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  54374. vnode.isAsyncPlaceholder = true;
  54375. return true
  54376. }
  54377. // assert node match
  54378. {
  54379. if (!assertNodeMatch(elm, vnode, inVPre)) {
  54380. return false
  54381. }
  54382. }
  54383. if (isDef(data)) {
  54384. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  54385. if (isDef(i = vnode.componentInstance)) {
  54386. // child component. it should have hydrated its own tree.
  54387. initComponent(vnode, insertedVnodeQueue);
  54388. return true
  54389. }
  54390. }
  54391. if (isDef(tag)) {
  54392. if (isDef(children)) {
  54393. // empty element, allow client to pick up and populate children
  54394. if (!elm.hasChildNodes()) {
  54395. createChildren(vnode, children, insertedVnodeQueue);
  54396. } else {
  54397. // v-html and domProps: innerHTML
  54398. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  54399. if (i !== elm.innerHTML) {
  54400. /* istanbul ignore if */
  54401. if (typeof console !== 'undefined' &&
  54402. !hydrationBailed
  54403. ) {
  54404. hydrationBailed = true;
  54405. console.warn('Parent: ', elm);
  54406. console.warn('server innerHTML: ', i);
  54407. console.warn('client innerHTML: ', elm.innerHTML);
  54408. }
  54409. return false
  54410. }
  54411. } else {
  54412. // iterate and compare children lists
  54413. var childrenMatch = true;
  54414. var childNode = elm.firstChild;
  54415. for (var i$1 = 0; i$1 < children.length; i$1++) {
  54416. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  54417. childrenMatch = false;
  54418. break
  54419. }
  54420. childNode = childNode.nextSibling;
  54421. }
  54422. // if childNode is not null, it means the actual childNodes list is
  54423. // longer than the virtual children list.
  54424. if (!childrenMatch || childNode) {
  54425. /* istanbul ignore if */
  54426. if (typeof console !== 'undefined' &&
  54427. !hydrationBailed
  54428. ) {
  54429. hydrationBailed = true;
  54430. console.warn('Parent: ', elm);
  54431. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  54432. }
  54433. return false
  54434. }
  54435. }
  54436. }
  54437. }
  54438. if (isDef(data)) {
  54439. var fullInvoke = false;
  54440. for (var key in data) {
  54441. if (!isRenderedModule(key)) {
  54442. fullInvoke = true;
  54443. invokeCreateHooks(vnode, insertedVnodeQueue);
  54444. break
  54445. }
  54446. }
  54447. if (!fullInvoke && data['class']) {
  54448. // ensure collecting deps for deep class bindings for future updates
  54449. traverse(data['class']);
  54450. }
  54451. }
  54452. } else if (elm.data !== vnode.text) {
  54453. elm.data = vnode.text;
  54454. }
  54455. return true
  54456. }
  54457. function assertNodeMatch (node, vnode, inVPre) {
  54458. if (isDef(vnode.tag)) {
  54459. return vnode.tag.indexOf('vue-component') === 0 || (
  54460. !isUnknownElement$$1(vnode, inVPre) &&
  54461. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  54462. )
  54463. } else {
  54464. return node.nodeType === (vnode.isComment ? 8 : 3)
  54465. }
  54466. }
  54467. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  54468. if (isUndef(vnode)) {
  54469. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  54470. return
  54471. }
  54472. var isInitialPatch = false;
  54473. var insertedVnodeQueue = [];
  54474. if (isUndef(oldVnode)) {
  54475. // empty mount (likely as component), create new root element
  54476. isInitialPatch = true;
  54477. createElm(vnode, insertedVnodeQueue);
  54478. } else {
  54479. var isRealElement = isDef(oldVnode.nodeType);
  54480. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  54481. // patch existing root node
  54482. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  54483. } else {
  54484. if (isRealElement) {
  54485. // mounting to a real element
  54486. // check if this is server-rendered content and if we can perform
  54487. // a successful hydration.
  54488. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  54489. oldVnode.removeAttribute(SSR_ATTR);
  54490. hydrating = true;
  54491. }
  54492. if (isTrue(hydrating)) {
  54493. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  54494. invokeInsertHook(vnode, insertedVnodeQueue, true);
  54495. return oldVnode
  54496. } else {
  54497. warn(
  54498. 'The client-side rendered virtual DOM tree is not matching ' +
  54499. 'server-rendered content. This is likely caused by incorrect ' +
  54500. 'HTML markup, for example nesting block-level elements inside ' +
  54501. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  54502. 'full client-side render.'
  54503. );
  54504. }
  54505. }
  54506. // either not server-rendered, or hydration failed.
  54507. // create an empty node and replace it
  54508. oldVnode = emptyNodeAt(oldVnode);
  54509. }
  54510. // replacing existing element
  54511. var oldElm = oldVnode.elm;
  54512. var parentElm = nodeOps.parentNode(oldElm);
  54513. // create new node
  54514. createElm(
  54515. vnode,
  54516. insertedVnodeQueue,
  54517. // extremely rare edge case: do not insert if old element is in a
  54518. // leaving transition. Only happens when combining transition +
  54519. // keep-alive + HOCs. (#4590)
  54520. oldElm._leaveCb ? null : parentElm,
  54521. nodeOps.nextSibling(oldElm)
  54522. );
  54523. // update parent placeholder node element, recursively
  54524. if (isDef(vnode.parent)) {
  54525. var ancestor = vnode.parent;
  54526. var patchable = isPatchable(vnode);
  54527. while (ancestor) {
  54528. for (var i = 0; i < cbs.destroy.length; ++i) {
  54529. cbs.destroy[i](ancestor);
  54530. }
  54531. ancestor.elm = vnode.elm;
  54532. if (patchable) {
  54533. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54534. cbs.create[i$1](emptyNode, ancestor);
  54535. }
  54536. // #6513
  54537. // invoke insert hooks that may have been merged by create hooks.
  54538. // e.g. for directives that uses the "inserted" hook.
  54539. var insert = ancestor.data.hook.insert;
  54540. if (insert.merged) {
  54541. // start at index 1 to avoid re-invoking component mounted hook
  54542. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  54543. insert.fns[i$2]();
  54544. }
  54545. }
  54546. } else {
  54547. registerRef(ancestor);
  54548. }
  54549. ancestor = ancestor.parent;
  54550. }
  54551. }
  54552. // destroy old node
  54553. if (isDef(parentElm)) {
  54554. removeVnodes([oldVnode], 0, 0);
  54555. } else if (isDef(oldVnode.tag)) {
  54556. invokeDestroyHook(oldVnode);
  54557. }
  54558. }
  54559. }
  54560. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  54561. return vnode.elm
  54562. }
  54563. }
  54564. /* */
  54565. var directives = {
  54566. create: updateDirectives,
  54567. update: updateDirectives,
  54568. destroy: function unbindDirectives (vnode) {
  54569. updateDirectives(vnode, emptyNode);
  54570. }
  54571. };
  54572. function updateDirectives (oldVnode, vnode) {
  54573. if (oldVnode.data.directives || vnode.data.directives) {
  54574. _update(oldVnode, vnode);
  54575. }
  54576. }
  54577. function _update (oldVnode, vnode) {
  54578. var isCreate = oldVnode === emptyNode;
  54579. var isDestroy = vnode === emptyNode;
  54580. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  54581. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  54582. var dirsWithInsert = [];
  54583. var dirsWithPostpatch = [];
  54584. var key, oldDir, dir;
  54585. for (key in newDirs) {
  54586. oldDir = oldDirs[key];
  54587. dir = newDirs[key];
  54588. if (!oldDir) {
  54589. // new directive, bind
  54590. callHook$1(dir, 'bind', vnode, oldVnode);
  54591. if (dir.def && dir.def.inserted) {
  54592. dirsWithInsert.push(dir);
  54593. }
  54594. } else {
  54595. // existing directive, update
  54596. dir.oldValue = oldDir.value;
  54597. dir.oldArg = oldDir.arg;
  54598. callHook$1(dir, 'update', vnode, oldVnode);
  54599. if (dir.def && dir.def.componentUpdated) {
  54600. dirsWithPostpatch.push(dir);
  54601. }
  54602. }
  54603. }
  54604. if (dirsWithInsert.length) {
  54605. var callInsert = function () {
  54606. for (var i = 0; i < dirsWithInsert.length; i++) {
  54607. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  54608. }
  54609. };
  54610. if (isCreate) {
  54611. mergeVNodeHook(vnode, 'insert', callInsert);
  54612. } else {
  54613. callInsert();
  54614. }
  54615. }
  54616. if (dirsWithPostpatch.length) {
  54617. mergeVNodeHook(vnode, 'postpatch', function () {
  54618. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  54619. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  54620. }
  54621. });
  54622. }
  54623. if (!isCreate) {
  54624. for (key in oldDirs) {
  54625. if (!newDirs[key]) {
  54626. // no longer present, unbind
  54627. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  54628. }
  54629. }
  54630. }
  54631. }
  54632. var emptyModifiers = Object.create(null);
  54633. function normalizeDirectives$1 (
  54634. dirs,
  54635. vm
  54636. ) {
  54637. var res = Object.create(null);
  54638. if (!dirs) {
  54639. // $flow-disable-line
  54640. return res
  54641. }
  54642. var i, dir;
  54643. for (i = 0; i < dirs.length; i++) {
  54644. dir = dirs[i];
  54645. if (!dir.modifiers) {
  54646. // $flow-disable-line
  54647. dir.modifiers = emptyModifiers;
  54648. }
  54649. res[getRawDirName(dir)] = dir;
  54650. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  54651. }
  54652. // $flow-disable-line
  54653. return res
  54654. }
  54655. function getRawDirName (dir) {
  54656. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  54657. }
  54658. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  54659. var fn = dir.def && dir.def[hook];
  54660. if (fn) {
  54661. try {
  54662. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  54663. } catch (e) {
  54664. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  54665. }
  54666. }
  54667. }
  54668. var baseModules = [
  54669. ref,
  54670. directives
  54671. ];
  54672. /* */
  54673. function updateAttrs (oldVnode, vnode) {
  54674. var opts = vnode.componentOptions;
  54675. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  54676. return
  54677. }
  54678. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  54679. return
  54680. }
  54681. var key, cur, old;
  54682. var elm = vnode.elm;
  54683. var oldAttrs = oldVnode.data.attrs || {};
  54684. var attrs = vnode.data.attrs || {};
  54685. // clone observed objects, as the user probably wants to mutate it
  54686. if (isDef(attrs.__ob__)) {
  54687. attrs = vnode.data.attrs = extend({}, attrs);
  54688. }
  54689. for (key in attrs) {
  54690. cur = attrs[key];
  54691. old = oldAttrs[key];
  54692. if (old !== cur) {
  54693. setAttr(elm, key, cur);
  54694. }
  54695. }
  54696. // #4391: in IE9, setting type can reset value for input[type=radio]
  54697. // #6666: IE/Edge forces progress value down to 1 before setting a max
  54698. /* istanbul ignore if */
  54699. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  54700. setAttr(elm, 'value', attrs.value);
  54701. }
  54702. for (key in oldAttrs) {
  54703. if (isUndef(attrs[key])) {
  54704. if (isXlink(key)) {
  54705. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  54706. } else if (!isEnumeratedAttr(key)) {
  54707. elm.removeAttribute(key);
  54708. }
  54709. }
  54710. }
  54711. }
  54712. function setAttr (el, key, value) {
  54713. if (el.tagName.indexOf('-') > -1) {
  54714. baseSetAttr(el, key, value);
  54715. } else if (isBooleanAttr(key)) {
  54716. // set attribute for blank value
  54717. // e.g. <option disabled>Select one</option>
  54718. if (isFalsyAttrValue(value)) {
  54719. el.removeAttribute(key);
  54720. } else {
  54721. // technically allowfullscreen is a boolean attribute for <iframe>,
  54722. // but Flash expects a value of "true" when used on <embed> tag
  54723. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  54724. ? 'true'
  54725. : key;
  54726. el.setAttribute(key, value);
  54727. }
  54728. } else if (isEnumeratedAttr(key)) {
  54729. el.setAttribute(key, convertEnumeratedValue(key, value));
  54730. } else if (isXlink(key)) {
  54731. if (isFalsyAttrValue(value)) {
  54732. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  54733. } else {
  54734. el.setAttributeNS(xlinkNS, key, value);
  54735. }
  54736. } else {
  54737. baseSetAttr(el, key, value);
  54738. }
  54739. }
  54740. function baseSetAttr (el, key, value) {
  54741. if (isFalsyAttrValue(value)) {
  54742. el.removeAttribute(key);
  54743. } else {
  54744. // #7138: IE10 & 11 fires input event when setting placeholder on
  54745. // <textarea>... block the first input event and remove the blocker
  54746. // immediately.
  54747. /* istanbul ignore if */
  54748. if (
  54749. isIE && !isIE9 &&
  54750. el.tagName === 'TEXTAREA' &&
  54751. key === 'placeholder' && value !== '' && !el.__ieph
  54752. ) {
  54753. var blocker = function (e) {
  54754. e.stopImmediatePropagation();
  54755. el.removeEventListener('input', blocker);
  54756. };
  54757. el.addEventListener('input', blocker);
  54758. // $flow-disable-line
  54759. el.__ieph = true; /* IE placeholder patched */
  54760. }
  54761. el.setAttribute(key, value);
  54762. }
  54763. }
  54764. var attrs = {
  54765. create: updateAttrs,
  54766. update: updateAttrs
  54767. };
  54768. /* */
  54769. function updateClass (oldVnode, vnode) {
  54770. var el = vnode.elm;
  54771. var data = vnode.data;
  54772. var oldData = oldVnode.data;
  54773. if (
  54774. isUndef(data.staticClass) &&
  54775. isUndef(data.class) && (
  54776. isUndef(oldData) || (
  54777. isUndef(oldData.staticClass) &&
  54778. isUndef(oldData.class)
  54779. )
  54780. )
  54781. ) {
  54782. return
  54783. }
  54784. var cls = genClassForVnode(vnode);
  54785. // handle transition classes
  54786. var transitionClass = el._transitionClasses;
  54787. if (isDef(transitionClass)) {
  54788. cls = concat(cls, stringifyClass(transitionClass));
  54789. }
  54790. // set the class
  54791. if (cls !== el._prevClass) {
  54792. el.setAttribute('class', cls);
  54793. el._prevClass = cls;
  54794. }
  54795. }
  54796. var klass = {
  54797. create: updateClass,
  54798. update: updateClass
  54799. };
  54800. /* */
  54801. var validDivisionCharRE = /[\w).+\-_$\]]/;
  54802. function parseFilters (exp) {
  54803. var inSingle = false;
  54804. var inDouble = false;
  54805. var inTemplateString = false;
  54806. var inRegex = false;
  54807. var curly = 0;
  54808. var square = 0;
  54809. var paren = 0;
  54810. var lastFilterIndex = 0;
  54811. var c, prev, i, expression, filters;
  54812. for (i = 0; i < exp.length; i++) {
  54813. prev = c;
  54814. c = exp.charCodeAt(i);
  54815. if (inSingle) {
  54816. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  54817. } else if (inDouble) {
  54818. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  54819. } else if (inTemplateString) {
  54820. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  54821. } else if (inRegex) {
  54822. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  54823. } else if (
  54824. c === 0x7C && // pipe
  54825. exp.charCodeAt(i + 1) !== 0x7C &&
  54826. exp.charCodeAt(i - 1) !== 0x7C &&
  54827. !curly && !square && !paren
  54828. ) {
  54829. if (expression === undefined) {
  54830. // first filter, end of expression
  54831. lastFilterIndex = i + 1;
  54832. expression = exp.slice(0, i).trim();
  54833. } else {
  54834. pushFilter();
  54835. }
  54836. } else {
  54837. switch (c) {
  54838. case 0x22: inDouble = true; break // "
  54839. case 0x27: inSingle = true; break // '
  54840. case 0x60: inTemplateString = true; break // `
  54841. case 0x28: paren++; break // (
  54842. case 0x29: paren--; break // )
  54843. case 0x5B: square++; break // [
  54844. case 0x5D: square--; break // ]
  54845. case 0x7B: curly++; break // {
  54846. case 0x7D: curly--; break // }
  54847. }
  54848. if (c === 0x2f) { // /
  54849. var j = i - 1;
  54850. var p = (void 0);
  54851. // find first non-whitespace prev char
  54852. for (; j >= 0; j--) {
  54853. p = exp.charAt(j);
  54854. if (p !== ' ') { break }
  54855. }
  54856. if (!p || !validDivisionCharRE.test(p)) {
  54857. inRegex = true;
  54858. }
  54859. }
  54860. }
  54861. }
  54862. if (expression === undefined) {
  54863. expression = exp.slice(0, i).trim();
  54864. } else if (lastFilterIndex !== 0) {
  54865. pushFilter();
  54866. }
  54867. function pushFilter () {
  54868. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  54869. lastFilterIndex = i + 1;
  54870. }
  54871. if (filters) {
  54872. for (i = 0; i < filters.length; i++) {
  54873. expression = wrapFilter(expression, filters[i]);
  54874. }
  54875. }
  54876. return expression
  54877. }
  54878. function wrapFilter (exp, filter) {
  54879. var i = filter.indexOf('(');
  54880. if (i < 0) {
  54881. // _f: resolveFilter
  54882. return ("_f(\"" + filter + "\")(" + exp + ")")
  54883. } else {
  54884. var name = filter.slice(0, i);
  54885. var args = filter.slice(i + 1);
  54886. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  54887. }
  54888. }
  54889. /* */
  54890. /* eslint-disable no-unused-vars */
  54891. function baseWarn (msg, range) {
  54892. console.error(("[Vue compiler]: " + msg));
  54893. }
  54894. /* eslint-enable no-unused-vars */
  54895. function pluckModuleFunction (
  54896. modules,
  54897. key
  54898. ) {
  54899. return modules
  54900. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  54901. : []
  54902. }
  54903. function addProp (el, name, value, range, dynamic) {
  54904. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54905. el.plain = false;
  54906. }
  54907. function addAttr (el, name, value, range, dynamic) {
  54908. var attrs = dynamic
  54909. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  54910. : (el.attrs || (el.attrs = []));
  54911. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54912. el.plain = false;
  54913. }
  54914. // add a raw attr (use this in preTransforms)
  54915. function addRawAttr (el, name, value, range) {
  54916. el.attrsMap[name] = value;
  54917. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  54918. }
  54919. function addDirective (
  54920. el,
  54921. name,
  54922. rawName,
  54923. value,
  54924. arg,
  54925. isDynamicArg,
  54926. modifiers,
  54927. range
  54928. ) {
  54929. (el.directives || (el.directives = [])).push(rangeSetItem({
  54930. name: name,
  54931. rawName: rawName,
  54932. value: value,
  54933. arg: arg,
  54934. isDynamicArg: isDynamicArg,
  54935. modifiers: modifiers
  54936. }, range));
  54937. el.plain = false;
  54938. }
  54939. function prependModifierMarker (symbol, name, dynamic) {
  54940. return dynamic
  54941. ? ("_p(" + name + ",\"" + symbol + "\")")
  54942. : symbol + name // mark the event as captured
  54943. }
  54944. function addHandler (
  54945. el,
  54946. name,
  54947. value,
  54948. modifiers,
  54949. important,
  54950. warn,
  54951. range,
  54952. dynamic
  54953. ) {
  54954. modifiers = modifiers || emptyObject;
  54955. // warn prevent and passive modifier
  54956. /* istanbul ignore if */
  54957. if (
  54958. warn &&
  54959. modifiers.prevent && modifiers.passive
  54960. ) {
  54961. warn(
  54962. 'passive and prevent can\'t be used together. ' +
  54963. 'Passive handler can\'t prevent default event.',
  54964. range
  54965. );
  54966. }
  54967. // normalize click.right and click.middle since they don't actually fire
  54968. // this is technically browser-specific, but at least for now browsers are
  54969. // the only target envs that have right/middle clicks.
  54970. if (modifiers.right) {
  54971. if (dynamic) {
  54972. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  54973. } else if (name === 'click') {
  54974. name = 'contextmenu';
  54975. delete modifiers.right;
  54976. }
  54977. } else if (modifiers.middle) {
  54978. if (dynamic) {
  54979. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  54980. } else if (name === 'click') {
  54981. name = 'mouseup';
  54982. }
  54983. }
  54984. // check capture modifier
  54985. if (modifiers.capture) {
  54986. delete modifiers.capture;
  54987. name = prependModifierMarker('!', name, dynamic);
  54988. }
  54989. if (modifiers.once) {
  54990. delete modifiers.once;
  54991. name = prependModifierMarker('~', name, dynamic);
  54992. }
  54993. /* istanbul ignore if */
  54994. if (modifiers.passive) {
  54995. delete modifiers.passive;
  54996. name = prependModifierMarker('&', name, dynamic);
  54997. }
  54998. var events;
  54999. if (modifiers.native) {
  55000. delete modifiers.native;
  55001. events = el.nativeEvents || (el.nativeEvents = {});
  55002. } else {
  55003. events = el.events || (el.events = {});
  55004. }
  55005. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55006. if (modifiers !== emptyObject) {
  55007. newHandler.modifiers = modifiers;
  55008. }
  55009. var handlers = events[name];
  55010. /* istanbul ignore if */
  55011. if (Array.isArray(handlers)) {
  55012. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55013. } else if (handlers) {
  55014. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55015. } else {
  55016. events[name] = newHandler;
  55017. }
  55018. el.plain = false;
  55019. }
  55020. function getRawBindingAttr (
  55021. el,
  55022. name
  55023. ) {
  55024. return el.rawAttrsMap[':' + name] ||
  55025. el.rawAttrsMap['v-bind:' + name] ||
  55026. el.rawAttrsMap[name]
  55027. }
  55028. function getBindingAttr (
  55029. el,
  55030. name,
  55031. getStatic
  55032. ) {
  55033. var dynamicValue =
  55034. getAndRemoveAttr(el, ':' + name) ||
  55035. getAndRemoveAttr(el, 'v-bind:' + name);
  55036. if (dynamicValue != null) {
  55037. return parseFilters(dynamicValue)
  55038. } else if (getStatic !== false) {
  55039. var staticValue = getAndRemoveAttr(el, name);
  55040. if (staticValue != null) {
  55041. return JSON.stringify(staticValue)
  55042. }
  55043. }
  55044. }
  55045. // note: this only removes the attr from the Array (attrsList) so that it
  55046. // doesn't get processed by processAttrs.
  55047. // By default it does NOT remove it from the map (attrsMap) because the map is
  55048. // needed during codegen.
  55049. function getAndRemoveAttr (
  55050. el,
  55051. name,
  55052. removeFromMap
  55053. ) {
  55054. var val;
  55055. if ((val = el.attrsMap[name]) != null) {
  55056. var list = el.attrsList;
  55057. for (var i = 0, l = list.length; i < l; i++) {
  55058. if (list[i].name === name) {
  55059. list.splice(i, 1);
  55060. break
  55061. }
  55062. }
  55063. }
  55064. if (removeFromMap) {
  55065. delete el.attrsMap[name];
  55066. }
  55067. return val
  55068. }
  55069. function getAndRemoveAttrByRegex (
  55070. el,
  55071. name
  55072. ) {
  55073. var list = el.attrsList;
  55074. for (var i = 0, l = list.length; i < l; i++) {
  55075. var attr = list[i];
  55076. if (name.test(attr.name)) {
  55077. list.splice(i, 1);
  55078. return attr
  55079. }
  55080. }
  55081. }
  55082. function rangeSetItem (
  55083. item,
  55084. range
  55085. ) {
  55086. if (range) {
  55087. if (range.start != null) {
  55088. item.start = range.start;
  55089. }
  55090. if (range.end != null) {
  55091. item.end = range.end;
  55092. }
  55093. }
  55094. return item
  55095. }
  55096. /* */
  55097. /**
  55098. * Cross-platform code generation for component v-model
  55099. */
  55100. function genComponentModel (
  55101. el,
  55102. value,
  55103. modifiers
  55104. ) {
  55105. var ref = modifiers || {};
  55106. var number = ref.number;
  55107. var trim = ref.trim;
  55108. var baseValueExpression = '$$v';
  55109. var valueExpression = baseValueExpression;
  55110. if (trim) {
  55111. valueExpression =
  55112. "(typeof " + baseValueExpression + " === 'string'" +
  55113. "? " + baseValueExpression + ".trim()" +
  55114. ": " + baseValueExpression + ")";
  55115. }
  55116. if (number) {
  55117. valueExpression = "_n(" + valueExpression + ")";
  55118. }
  55119. var assignment = genAssignmentCode(value, valueExpression);
  55120. el.model = {
  55121. value: ("(" + value + ")"),
  55122. expression: JSON.stringify(value),
  55123. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55124. };
  55125. }
  55126. /**
  55127. * Cross-platform codegen helper for generating v-model value assignment code.
  55128. */
  55129. function genAssignmentCode (
  55130. value,
  55131. assignment
  55132. ) {
  55133. var res = parseModel(value);
  55134. if (res.key === null) {
  55135. return (value + "=" + assignment)
  55136. } else {
  55137. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55138. }
  55139. }
  55140. /**
  55141. * Parse a v-model expression into a base path and a final key segment.
  55142. * Handles both dot-path and possible square brackets.
  55143. *
  55144. * Possible cases:
  55145. *
  55146. * - test
  55147. * - test[key]
  55148. * - test[test1[key]]
  55149. * - test["a"][key]
  55150. * - xxx.test[a[a].test1[key]]
  55151. * - test.xxx.a["asa"][test1[key]]
  55152. *
  55153. */
  55154. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55155. function parseModel (val) {
  55156. // Fix https://github.com/vuejs/vue/pull/7730
  55157. // allow v-model="obj.val " (trailing whitespace)
  55158. val = val.trim();
  55159. len = val.length;
  55160. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55161. index$1 = val.lastIndexOf('.');
  55162. if (index$1 > -1) {
  55163. return {
  55164. exp: val.slice(0, index$1),
  55165. key: '"' + val.slice(index$1 + 1) + '"'
  55166. }
  55167. } else {
  55168. return {
  55169. exp: val,
  55170. key: null
  55171. }
  55172. }
  55173. }
  55174. str = val;
  55175. index$1 = expressionPos = expressionEndPos = 0;
  55176. while (!eof()) {
  55177. chr = next();
  55178. /* istanbul ignore if */
  55179. if (isStringStart(chr)) {
  55180. parseString(chr);
  55181. } else if (chr === 0x5B) {
  55182. parseBracket(chr);
  55183. }
  55184. }
  55185. return {
  55186. exp: val.slice(0, expressionPos),
  55187. key: val.slice(expressionPos + 1, expressionEndPos)
  55188. }
  55189. }
  55190. function next () {
  55191. return str.charCodeAt(++index$1)
  55192. }
  55193. function eof () {
  55194. return index$1 >= len
  55195. }
  55196. function isStringStart (chr) {
  55197. return chr === 0x22 || chr === 0x27
  55198. }
  55199. function parseBracket (chr) {
  55200. var inBracket = 1;
  55201. expressionPos = index$1;
  55202. while (!eof()) {
  55203. chr = next();
  55204. if (isStringStart(chr)) {
  55205. parseString(chr);
  55206. continue
  55207. }
  55208. if (chr === 0x5B) { inBracket++; }
  55209. if (chr === 0x5D) { inBracket--; }
  55210. if (inBracket === 0) {
  55211. expressionEndPos = index$1;
  55212. break
  55213. }
  55214. }
  55215. }
  55216. function parseString (chr) {
  55217. var stringQuote = chr;
  55218. while (!eof()) {
  55219. chr = next();
  55220. if (chr === stringQuote) {
  55221. break
  55222. }
  55223. }
  55224. }
  55225. /* */
  55226. var warn$1;
  55227. // in some cases, the event used has to be determined at runtime
  55228. // so we used some reserved tokens during compile.
  55229. var RANGE_TOKEN = '__r';
  55230. var CHECKBOX_RADIO_TOKEN = '__c';
  55231. function model (
  55232. el,
  55233. dir,
  55234. _warn
  55235. ) {
  55236. warn$1 = _warn;
  55237. var value = dir.value;
  55238. var modifiers = dir.modifiers;
  55239. var tag = el.tag;
  55240. var type = el.attrsMap.type;
  55241. {
  55242. // inputs with type="file" are read only and setting the input's
  55243. // value will throw an error.
  55244. if (tag === 'input' && type === 'file') {
  55245. warn$1(
  55246. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55247. "File inputs are read only. Use a v-on:change listener instead.",
  55248. el.rawAttrsMap['v-model']
  55249. );
  55250. }
  55251. }
  55252. if (el.component) {
  55253. genComponentModel(el, value, modifiers);
  55254. // component v-model doesn't need extra runtime
  55255. return false
  55256. } else if (tag === 'select') {
  55257. genSelect(el, value, modifiers);
  55258. } else if (tag === 'input' && type === 'checkbox') {
  55259. genCheckboxModel(el, value, modifiers);
  55260. } else if (tag === 'input' && type === 'radio') {
  55261. genRadioModel(el, value, modifiers);
  55262. } else if (tag === 'input' || tag === 'textarea') {
  55263. genDefaultModel(el, value, modifiers);
  55264. } else if (!config.isReservedTag(tag)) {
  55265. genComponentModel(el, value, modifiers);
  55266. // component v-model doesn't need extra runtime
  55267. return false
  55268. } else {
  55269. warn$1(
  55270. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55271. "v-model is not supported on this element type. " +
  55272. 'If you are working with contenteditable, it\'s recommended to ' +
  55273. 'wrap a library dedicated for that purpose inside a custom component.',
  55274. el.rawAttrsMap['v-model']
  55275. );
  55276. }
  55277. // ensure runtime directive metadata
  55278. return true
  55279. }
  55280. function genCheckboxModel (
  55281. el,
  55282. value,
  55283. modifiers
  55284. ) {
  55285. var number = modifiers && modifiers.number;
  55286. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55287. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55288. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55289. addProp(el, 'checked',
  55290. "Array.isArray(" + value + ")" +
  55291. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55292. trueValueBinding === 'true'
  55293. ? (":(" + value + ")")
  55294. : (":_q(" + value + "," + trueValueBinding + ")")
  55295. )
  55296. );
  55297. addHandler(el, 'change',
  55298. "var $$a=" + value + "," +
  55299. '$$el=$event.target,' +
  55300. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55301. 'if(Array.isArray($$a)){' +
  55302. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55303. '$$i=_i($$a,$$v);' +
  55304. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55305. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55306. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55307. null, true
  55308. );
  55309. }
  55310. function genRadioModel (
  55311. el,
  55312. value,
  55313. modifiers
  55314. ) {
  55315. var number = modifiers && modifiers.number;
  55316. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55317. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55318. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  55319. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  55320. }
  55321. function genSelect (
  55322. el,
  55323. value,
  55324. modifiers
  55325. ) {
  55326. var number = modifiers && modifiers.number;
  55327. var selectedVal = "Array.prototype.filter" +
  55328. ".call($event.target.options,function(o){return o.selected})" +
  55329. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  55330. "return " + (number ? '_n(val)' : 'val') + "})";
  55331. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  55332. var code = "var $$selectedVal = " + selectedVal + ";";
  55333. code = code + " " + (genAssignmentCode(value, assignment));
  55334. addHandler(el, 'change', code, null, true);
  55335. }
  55336. function genDefaultModel (
  55337. el,
  55338. value,
  55339. modifiers
  55340. ) {
  55341. var type = el.attrsMap.type;
  55342. // warn if v-bind:value conflicts with v-model
  55343. // except for inputs with v-bind:type
  55344. {
  55345. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  55346. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  55347. if (value$1 && !typeBinding) {
  55348. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  55349. warn$1(
  55350. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  55351. 'because the latter already expands to a value binding internally',
  55352. el.rawAttrsMap[binding]
  55353. );
  55354. }
  55355. }
  55356. var ref = modifiers || {};
  55357. var lazy = ref.lazy;
  55358. var number = ref.number;
  55359. var trim = ref.trim;
  55360. var needCompositionGuard = !lazy && type !== 'range';
  55361. var event = lazy
  55362. ? 'change'
  55363. : type === 'range'
  55364. ? RANGE_TOKEN
  55365. : 'input';
  55366. var valueExpression = '$event.target.value';
  55367. if (trim) {
  55368. valueExpression = "$event.target.value.trim()";
  55369. }
  55370. if (number) {
  55371. valueExpression = "_n(" + valueExpression + ")";
  55372. }
  55373. var code = genAssignmentCode(value, valueExpression);
  55374. if (needCompositionGuard) {
  55375. code = "if($event.target.composing)return;" + code;
  55376. }
  55377. addProp(el, 'value', ("(" + value + ")"));
  55378. addHandler(el, event, code, null, true);
  55379. if (trim || number) {
  55380. addHandler(el, 'blur', '$forceUpdate()');
  55381. }
  55382. }
  55383. /* */
  55384. // normalize v-model event tokens that can only be determined at runtime.
  55385. // it's important to place the event as the first in the array because
  55386. // the whole point is ensuring the v-model callback gets called before
  55387. // user-attached handlers.
  55388. function normalizeEvents (on) {
  55389. /* istanbul ignore if */
  55390. if (isDef(on[RANGE_TOKEN])) {
  55391. // IE input[type=range] only supports `change` event
  55392. var event = isIE ? 'change' : 'input';
  55393. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  55394. delete on[RANGE_TOKEN];
  55395. }
  55396. // This was originally intended to fix #4521 but no longer necessary
  55397. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  55398. /* istanbul ignore if */
  55399. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  55400. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  55401. delete on[CHECKBOX_RADIO_TOKEN];
  55402. }
  55403. }
  55404. var target$1;
  55405. function createOnceHandler$1 (event, handler, capture) {
  55406. var _target = target$1; // save current target element in closure
  55407. return function onceHandler () {
  55408. var res = handler.apply(null, arguments);
  55409. if (res !== null) {
  55410. remove$2(event, onceHandler, capture, _target);
  55411. }
  55412. }
  55413. }
  55414. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  55415. // implementation and does not fire microtasks in between event propagation, so
  55416. // safe to exclude.
  55417. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  55418. function add$1 (
  55419. name,
  55420. handler,
  55421. capture,
  55422. passive
  55423. ) {
  55424. // async edge case #6566: inner click event triggers patch, event handler
  55425. // attached to outer element during patch, and triggered again. This
  55426. // happens because browsers fire microtask ticks between event propagation.
  55427. // the solution is simple: we save the timestamp when a handler is attached,
  55428. // and the handler would only fire if the event passed to it was fired
  55429. // AFTER it was attached.
  55430. if (useMicrotaskFix) {
  55431. var attachedTimestamp = currentFlushTimestamp;
  55432. var original = handler;
  55433. handler = original._wrapper = function (e) {
  55434. if (
  55435. // no bubbling, should always fire.
  55436. // this is just a safety net in case event.timeStamp is unreliable in
  55437. // certain weird environments...
  55438. e.target === e.currentTarget ||
  55439. // event is fired after handler attachment
  55440. e.timeStamp >= attachedTimestamp ||
  55441. // bail for environments that have buggy event.timeStamp implementations
  55442. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  55443. // #9681 QtWebEngine event.timeStamp is negative value
  55444. e.timeStamp <= 0 ||
  55445. // #9448 bail if event is fired in another document in a multi-page
  55446. // electron/nw.js app, since event.timeStamp will be using a different
  55447. // starting reference
  55448. e.target.ownerDocument !== document
  55449. ) {
  55450. return original.apply(this, arguments)
  55451. }
  55452. };
  55453. }
  55454. target$1.addEventListener(
  55455. name,
  55456. handler,
  55457. supportsPassive
  55458. ? { capture: capture, passive: passive }
  55459. : capture
  55460. );
  55461. }
  55462. function remove$2 (
  55463. name,
  55464. handler,
  55465. capture,
  55466. _target
  55467. ) {
  55468. (_target || target$1).removeEventListener(
  55469. name,
  55470. handler._wrapper || handler,
  55471. capture
  55472. );
  55473. }
  55474. function updateDOMListeners (oldVnode, vnode) {
  55475. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  55476. return
  55477. }
  55478. var on = vnode.data.on || {};
  55479. var oldOn = oldVnode.data.on || {};
  55480. target$1 = vnode.elm;
  55481. normalizeEvents(on);
  55482. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  55483. target$1 = undefined;
  55484. }
  55485. var events = {
  55486. create: updateDOMListeners,
  55487. update: updateDOMListeners
  55488. };
  55489. /* */
  55490. var svgContainer;
  55491. function updateDOMProps (oldVnode, vnode) {
  55492. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  55493. return
  55494. }
  55495. var key, cur;
  55496. var elm = vnode.elm;
  55497. var oldProps = oldVnode.data.domProps || {};
  55498. var props = vnode.data.domProps || {};
  55499. // clone observed objects, as the user probably wants to mutate it
  55500. if (isDef(props.__ob__)) {
  55501. props = vnode.data.domProps = extend({}, props);
  55502. }
  55503. for (key in oldProps) {
  55504. if (!(key in props)) {
  55505. elm[key] = '';
  55506. }
  55507. }
  55508. for (key in props) {
  55509. cur = props[key];
  55510. // ignore children if the node has textContent or innerHTML,
  55511. // as these will throw away existing DOM nodes and cause removal errors
  55512. // on subsequent patches (#3360)
  55513. if (key === 'textContent' || key === 'innerHTML') {
  55514. if (vnode.children) { vnode.children.length = 0; }
  55515. if (cur === oldProps[key]) { continue }
  55516. // #6601 work around Chrome version <= 55 bug where single textNode
  55517. // replaced by innerHTML/textContent retains its parentNode property
  55518. if (elm.childNodes.length === 1) {
  55519. elm.removeChild(elm.childNodes[0]);
  55520. }
  55521. }
  55522. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  55523. // store value as _value as well since
  55524. // non-string values will be stringified
  55525. elm._value = cur;
  55526. // avoid resetting cursor position when value is the same
  55527. var strCur = isUndef(cur) ? '' : String(cur);
  55528. if (shouldUpdateValue(elm, strCur)) {
  55529. elm.value = strCur;
  55530. }
  55531. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  55532. // IE doesn't support innerHTML for SVG elements
  55533. svgContainer = svgContainer || document.createElement('div');
  55534. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  55535. var svg = svgContainer.firstChild;
  55536. while (elm.firstChild) {
  55537. elm.removeChild(elm.firstChild);
  55538. }
  55539. while (svg.firstChild) {
  55540. elm.appendChild(svg.firstChild);
  55541. }
  55542. } else if (
  55543. // skip the update if old and new VDOM state is the same.
  55544. // `value` is handled separately because the DOM value may be temporarily
  55545. // out of sync with VDOM state due to focus, composition and modifiers.
  55546. // This #4521 by skipping the unnecesarry `checked` update.
  55547. cur !== oldProps[key]
  55548. ) {
  55549. // some property updates can throw
  55550. // e.g. `value` on <progress> w/ non-finite value
  55551. try {
  55552. elm[key] = cur;
  55553. } catch (e) {}
  55554. }
  55555. }
  55556. }
  55557. // check platforms/web/util/attrs.js acceptValue
  55558. function shouldUpdateValue (elm, checkVal) {
  55559. return (!elm.composing && (
  55560. elm.tagName === 'OPTION' ||
  55561. isNotInFocusAndDirty(elm, checkVal) ||
  55562. isDirtyWithModifiers(elm, checkVal)
  55563. ))
  55564. }
  55565. function isNotInFocusAndDirty (elm, checkVal) {
  55566. // return true when textbox (.number and .trim) loses focus and its value is
  55567. // not equal to the updated value
  55568. var notInFocus = true;
  55569. // #6157
  55570. // work around IE bug when accessing document.activeElement in an iframe
  55571. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  55572. return notInFocus && elm.value !== checkVal
  55573. }
  55574. function isDirtyWithModifiers (elm, newVal) {
  55575. var value = elm.value;
  55576. var modifiers = elm._vModifiers; // injected by v-model runtime
  55577. if (isDef(modifiers)) {
  55578. if (modifiers.number) {
  55579. return toNumber(value) !== toNumber(newVal)
  55580. }
  55581. if (modifiers.trim) {
  55582. return value.trim() !== newVal.trim()
  55583. }
  55584. }
  55585. return value !== newVal
  55586. }
  55587. var domProps = {
  55588. create: updateDOMProps,
  55589. update: updateDOMProps
  55590. };
  55591. /* */
  55592. var parseStyleText = cached(function (cssText) {
  55593. var res = {};
  55594. var listDelimiter = /;(?![^(]*\))/g;
  55595. var propertyDelimiter = /:(.+)/;
  55596. cssText.split(listDelimiter).forEach(function (item) {
  55597. if (item) {
  55598. var tmp = item.split(propertyDelimiter);
  55599. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  55600. }
  55601. });
  55602. return res
  55603. });
  55604. // merge static and dynamic style data on the same vnode
  55605. function normalizeStyleData (data) {
  55606. var style = normalizeStyleBinding(data.style);
  55607. // static style is pre-processed into an object during compilation
  55608. // and is always a fresh object, so it's safe to merge into it
  55609. return data.staticStyle
  55610. ? extend(data.staticStyle, style)
  55611. : style
  55612. }
  55613. // normalize possible array / string values into Object
  55614. function normalizeStyleBinding (bindingStyle) {
  55615. if (Array.isArray(bindingStyle)) {
  55616. return toObject(bindingStyle)
  55617. }
  55618. if (typeof bindingStyle === 'string') {
  55619. return parseStyleText(bindingStyle)
  55620. }
  55621. return bindingStyle
  55622. }
  55623. /**
  55624. * parent component style should be after child's
  55625. * so that parent component's style could override it
  55626. */
  55627. function getStyle (vnode, checkChild) {
  55628. var res = {};
  55629. var styleData;
  55630. if (checkChild) {
  55631. var childNode = vnode;
  55632. while (childNode.componentInstance) {
  55633. childNode = childNode.componentInstance._vnode;
  55634. if (
  55635. childNode && childNode.data &&
  55636. (styleData = normalizeStyleData(childNode.data))
  55637. ) {
  55638. extend(res, styleData);
  55639. }
  55640. }
  55641. }
  55642. if ((styleData = normalizeStyleData(vnode.data))) {
  55643. extend(res, styleData);
  55644. }
  55645. var parentNode = vnode;
  55646. while ((parentNode = parentNode.parent)) {
  55647. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  55648. extend(res, styleData);
  55649. }
  55650. }
  55651. return res
  55652. }
  55653. /* */
  55654. var cssVarRE = /^--/;
  55655. var importantRE = /\s*!important$/;
  55656. var setProp = function (el, name, val) {
  55657. /* istanbul ignore if */
  55658. if (cssVarRE.test(name)) {
  55659. el.style.setProperty(name, val);
  55660. } else if (importantRE.test(val)) {
  55661. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  55662. } else {
  55663. var normalizedName = normalize(name);
  55664. if (Array.isArray(val)) {
  55665. // Support values array created by autoprefixer, e.g.
  55666. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  55667. // Set them one by one, and the browser will only set those it can recognize
  55668. for (var i = 0, len = val.length; i < len; i++) {
  55669. el.style[normalizedName] = val[i];
  55670. }
  55671. } else {
  55672. el.style[normalizedName] = val;
  55673. }
  55674. }
  55675. };
  55676. var vendorNames = ['Webkit', 'Moz', 'ms'];
  55677. var emptyStyle;
  55678. var normalize = cached(function (prop) {
  55679. emptyStyle = emptyStyle || document.createElement('div').style;
  55680. prop = camelize(prop);
  55681. if (prop !== 'filter' && (prop in emptyStyle)) {
  55682. return prop
  55683. }
  55684. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  55685. for (var i = 0; i < vendorNames.length; i++) {
  55686. var name = vendorNames[i] + capName;
  55687. if (name in emptyStyle) {
  55688. return name
  55689. }
  55690. }
  55691. });
  55692. function updateStyle (oldVnode, vnode) {
  55693. var data = vnode.data;
  55694. var oldData = oldVnode.data;
  55695. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  55696. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  55697. ) {
  55698. return
  55699. }
  55700. var cur, name;
  55701. var el = vnode.elm;
  55702. var oldStaticStyle = oldData.staticStyle;
  55703. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  55704. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  55705. var oldStyle = oldStaticStyle || oldStyleBinding;
  55706. var style = normalizeStyleBinding(vnode.data.style) || {};
  55707. // store normalized style under a different key for next diff
  55708. // make sure to clone it if it's reactive, since the user likely wants
  55709. // to mutate it.
  55710. vnode.data.normalizedStyle = isDef(style.__ob__)
  55711. ? extend({}, style)
  55712. : style;
  55713. var newStyle = getStyle(vnode, true);
  55714. for (name in oldStyle) {
  55715. if (isUndef(newStyle[name])) {
  55716. setProp(el, name, '');
  55717. }
  55718. }
  55719. for (name in newStyle) {
  55720. cur = newStyle[name];
  55721. if (cur !== oldStyle[name]) {
  55722. // ie9 setting to null has no effect, must use empty string
  55723. setProp(el, name, cur == null ? '' : cur);
  55724. }
  55725. }
  55726. }
  55727. var style = {
  55728. create: updateStyle,
  55729. update: updateStyle
  55730. };
  55731. /* */
  55732. var whitespaceRE = /\s+/;
  55733. /**
  55734. * Add class with compatibility for SVG since classList is not supported on
  55735. * SVG elements in IE
  55736. */
  55737. function addClass (el, cls) {
  55738. /* istanbul ignore if */
  55739. if (!cls || !(cls = cls.trim())) {
  55740. return
  55741. }
  55742. /* istanbul ignore else */
  55743. if (el.classList) {
  55744. if (cls.indexOf(' ') > -1) {
  55745. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  55746. } else {
  55747. el.classList.add(cls);
  55748. }
  55749. } else {
  55750. var cur = " " + (el.getAttribute('class') || '') + " ";
  55751. if (cur.indexOf(' ' + cls + ' ') < 0) {
  55752. el.setAttribute('class', (cur + cls).trim());
  55753. }
  55754. }
  55755. }
  55756. /**
  55757. * Remove class with compatibility for SVG since classList is not supported on
  55758. * SVG elements in IE
  55759. */
  55760. function removeClass (el, cls) {
  55761. /* istanbul ignore if */
  55762. if (!cls || !(cls = cls.trim())) {
  55763. return
  55764. }
  55765. /* istanbul ignore else */
  55766. if (el.classList) {
  55767. if (cls.indexOf(' ') > -1) {
  55768. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  55769. } else {
  55770. el.classList.remove(cls);
  55771. }
  55772. if (!el.classList.length) {
  55773. el.removeAttribute('class');
  55774. }
  55775. } else {
  55776. var cur = " " + (el.getAttribute('class') || '') + " ";
  55777. var tar = ' ' + cls + ' ';
  55778. while (cur.indexOf(tar) >= 0) {
  55779. cur = cur.replace(tar, ' ');
  55780. }
  55781. cur = cur.trim();
  55782. if (cur) {
  55783. el.setAttribute('class', cur);
  55784. } else {
  55785. el.removeAttribute('class');
  55786. }
  55787. }
  55788. }
  55789. /* */
  55790. function resolveTransition (def$$1) {
  55791. if (!def$$1) {
  55792. return
  55793. }
  55794. /* istanbul ignore else */
  55795. if (typeof def$$1 === 'object') {
  55796. var res = {};
  55797. if (def$$1.css !== false) {
  55798. extend(res, autoCssTransition(def$$1.name || 'v'));
  55799. }
  55800. extend(res, def$$1);
  55801. return res
  55802. } else if (typeof def$$1 === 'string') {
  55803. return autoCssTransition(def$$1)
  55804. }
  55805. }
  55806. var autoCssTransition = cached(function (name) {
  55807. return {
  55808. enterClass: (name + "-enter"),
  55809. enterToClass: (name + "-enter-to"),
  55810. enterActiveClass: (name + "-enter-active"),
  55811. leaveClass: (name + "-leave"),
  55812. leaveToClass: (name + "-leave-to"),
  55813. leaveActiveClass: (name + "-leave-active")
  55814. }
  55815. });
  55816. var hasTransition = inBrowser && !isIE9;
  55817. var TRANSITION = 'transition';
  55818. var ANIMATION = 'animation';
  55819. // Transition property/event sniffing
  55820. var transitionProp = 'transition';
  55821. var transitionEndEvent = 'transitionend';
  55822. var animationProp = 'animation';
  55823. var animationEndEvent = 'animationend';
  55824. if (hasTransition) {
  55825. /* istanbul ignore if */
  55826. if (window.ontransitionend === undefined &&
  55827. window.onwebkittransitionend !== undefined
  55828. ) {
  55829. transitionProp = 'WebkitTransition';
  55830. transitionEndEvent = 'webkitTransitionEnd';
  55831. }
  55832. if (window.onanimationend === undefined &&
  55833. window.onwebkitanimationend !== undefined
  55834. ) {
  55835. animationProp = 'WebkitAnimation';
  55836. animationEndEvent = 'webkitAnimationEnd';
  55837. }
  55838. }
  55839. // binding to window is necessary to make hot reload work in IE in strict mode
  55840. var raf = inBrowser
  55841. ? window.requestAnimationFrame
  55842. ? window.requestAnimationFrame.bind(window)
  55843. : setTimeout
  55844. : /* istanbul ignore next */ function (fn) { return fn(); };
  55845. function nextFrame (fn) {
  55846. raf(function () {
  55847. raf(fn);
  55848. });
  55849. }
  55850. function addTransitionClass (el, cls) {
  55851. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  55852. if (transitionClasses.indexOf(cls) < 0) {
  55853. transitionClasses.push(cls);
  55854. addClass(el, cls);
  55855. }
  55856. }
  55857. function removeTransitionClass (el, cls) {
  55858. if (el._transitionClasses) {
  55859. remove(el._transitionClasses, cls);
  55860. }
  55861. removeClass(el, cls);
  55862. }
  55863. function whenTransitionEnds (
  55864. el,
  55865. expectedType,
  55866. cb
  55867. ) {
  55868. var ref = getTransitionInfo(el, expectedType);
  55869. var type = ref.type;
  55870. var timeout = ref.timeout;
  55871. var propCount = ref.propCount;
  55872. if (!type) { return cb() }
  55873. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  55874. var ended = 0;
  55875. var end = function () {
  55876. el.removeEventListener(event, onEnd);
  55877. cb();
  55878. };
  55879. var onEnd = function (e) {
  55880. if (e.target === el) {
  55881. if (++ended >= propCount) {
  55882. end();
  55883. }
  55884. }
  55885. };
  55886. setTimeout(function () {
  55887. if (ended < propCount) {
  55888. end();
  55889. }
  55890. }, timeout + 1);
  55891. el.addEventListener(event, onEnd);
  55892. }
  55893. var transformRE = /\b(transform|all)(,|$)/;
  55894. function getTransitionInfo (el, expectedType) {
  55895. var styles = window.getComputedStyle(el);
  55896. // JSDOM may return undefined for transition properties
  55897. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  55898. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  55899. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  55900. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  55901. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  55902. var animationTimeout = getTimeout(animationDelays, animationDurations);
  55903. var type;
  55904. var timeout = 0;
  55905. var propCount = 0;
  55906. /* istanbul ignore if */
  55907. if (expectedType === TRANSITION) {
  55908. if (transitionTimeout > 0) {
  55909. type = TRANSITION;
  55910. timeout = transitionTimeout;
  55911. propCount = transitionDurations.length;
  55912. }
  55913. } else if (expectedType === ANIMATION) {
  55914. if (animationTimeout > 0) {
  55915. type = ANIMATION;
  55916. timeout = animationTimeout;
  55917. propCount = animationDurations.length;
  55918. }
  55919. } else {
  55920. timeout = Math.max(transitionTimeout, animationTimeout);
  55921. type = timeout > 0
  55922. ? transitionTimeout > animationTimeout
  55923. ? TRANSITION
  55924. : ANIMATION
  55925. : null;
  55926. propCount = type
  55927. ? type === TRANSITION
  55928. ? transitionDurations.length
  55929. : animationDurations.length
  55930. : 0;
  55931. }
  55932. var hasTransform =
  55933. type === TRANSITION &&
  55934. transformRE.test(styles[transitionProp + 'Property']);
  55935. return {
  55936. type: type,
  55937. timeout: timeout,
  55938. propCount: propCount,
  55939. hasTransform: hasTransform
  55940. }
  55941. }
  55942. function getTimeout (delays, durations) {
  55943. /* istanbul ignore next */
  55944. while (delays.length < durations.length) {
  55945. delays = delays.concat(delays);
  55946. }
  55947. return Math.max.apply(null, durations.map(function (d, i) {
  55948. return toMs(d) + toMs(delays[i])
  55949. }))
  55950. }
  55951. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  55952. // in a locale-dependent way, using a comma instead of a dot.
  55953. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  55954. // as a floor function) causing unexpected behaviors
  55955. function toMs (s) {
  55956. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  55957. }
  55958. /* */
  55959. function enter (vnode, toggleDisplay) {
  55960. var el = vnode.elm;
  55961. // call leave callback now
  55962. if (isDef(el._leaveCb)) {
  55963. el._leaveCb.cancelled = true;
  55964. el._leaveCb();
  55965. }
  55966. var data = resolveTransition(vnode.data.transition);
  55967. if (isUndef(data)) {
  55968. return
  55969. }
  55970. /* istanbul ignore if */
  55971. if (isDef(el._enterCb) || el.nodeType !== 1) {
  55972. return
  55973. }
  55974. var css = data.css;
  55975. var type = data.type;
  55976. var enterClass = data.enterClass;
  55977. var enterToClass = data.enterToClass;
  55978. var enterActiveClass = data.enterActiveClass;
  55979. var appearClass = data.appearClass;
  55980. var appearToClass = data.appearToClass;
  55981. var appearActiveClass = data.appearActiveClass;
  55982. var beforeEnter = data.beforeEnter;
  55983. var enter = data.enter;
  55984. var afterEnter = data.afterEnter;
  55985. var enterCancelled = data.enterCancelled;
  55986. var beforeAppear = data.beforeAppear;
  55987. var appear = data.appear;
  55988. var afterAppear = data.afterAppear;
  55989. var appearCancelled = data.appearCancelled;
  55990. var duration = data.duration;
  55991. // activeInstance will always be the <transition> component managing this
  55992. // transition. One edge case to check is when the <transition> is placed
  55993. // as the root node of a child component. In that case we need to check
  55994. // <transition>'s parent for appear check.
  55995. var context = activeInstance;
  55996. var transitionNode = activeInstance.$vnode;
  55997. while (transitionNode && transitionNode.parent) {
  55998. context = transitionNode.context;
  55999. transitionNode = transitionNode.parent;
  56000. }
  56001. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56002. if (isAppear && !appear && appear !== '') {
  56003. return
  56004. }
  56005. var startClass = isAppear && appearClass
  56006. ? appearClass
  56007. : enterClass;
  56008. var activeClass = isAppear && appearActiveClass
  56009. ? appearActiveClass
  56010. : enterActiveClass;
  56011. var toClass = isAppear && appearToClass
  56012. ? appearToClass
  56013. : enterToClass;
  56014. var beforeEnterHook = isAppear
  56015. ? (beforeAppear || beforeEnter)
  56016. : beforeEnter;
  56017. var enterHook = isAppear
  56018. ? (typeof appear === 'function' ? appear : enter)
  56019. : enter;
  56020. var afterEnterHook = isAppear
  56021. ? (afterAppear || afterEnter)
  56022. : afterEnter;
  56023. var enterCancelledHook = isAppear
  56024. ? (appearCancelled || enterCancelled)
  56025. : enterCancelled;
  56026. var explicitEnterDuration = toNumber(
  56027. isObject(duration)
  56028. ? duration.enter
  56029. : duration
  56030. );
  56031. if (explicitEnterDuration != null) {
  56032. checkDuration(explicitEnterDuration, 'enter', vnode);
  56033. }
  56034. var expectsCSS = css !== false && !isIE9;
  56035. var userWantsControl = getHookArgumentsLength(enterHook);
  56036. var cb = el._enterCb = once(function () {
  56037. if (expectsCSS) {
  56038. removeTransitionClass(el, toClass);
  56039. removeTransitionClass(el, activeClass);
  56040. }
  56041. if (cb.cancelled) {
  56042. if (expectsCSS) {
  56043. removeTransitionClass(el, startClass);
  56044. }
  56045. enterCancelledHook && enterCancelledHook(el);
  56046. } else {
  56047. afterEnterHook && afterEnterHook(el);
  56048. }
  56049. el._enterCb = null;
  56050. });
  56051. if (!vnode.data.show) {
  56052. // remove pending leave element on enter by injecting an insert hook
  56053. mergeVNodeHook(vnode, 'insert', function () {
  56054. var parent = el.parentNode;
  56055. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56056. if (pendingNode &&
  56057. pendingNode.tag === vnode.tag &&
  56058. pendingNode.elm._leaveCb
  56059. ) {
  56060. pendingNode.elm._leaveCb();
  56061. }
  56062. enterHook && enterHook(el, cb);
  56063. });
  56064. }
  56065. // start enter transition
  56066. beforeEnterHook && beforeEnterHook(el);
  56067. if (expectsCSS) {
  56068. addTransitionClass(el, startClass);
  56069. addTransitionClass(el, activeClass);
  56070. nextFrame(function () {
  56071. removeTransitionClass(el, startClass);
  56072. if (!cb.cancelled) {
  56073. addTransitionClass(el, toClass);
  56074. if (!userWantsControl) {
  56075. if (isValidDuration(explicitEnterDuration)) {
  56076. setTimeout(cb, explicitEnterDuration);
  56077. } else {
  56078. whenTransitionEnds(el, type, cb);
  56079. }
  56080. }
  56081. }
  56082. });
  56083. }
  56084. if (vnode.data.show) {
  56085. toggleDisplay && toggleDisplay();
  56086. enterHook && enterHook(el, cb);
  56087. }
  56088. if (!expectsCSS && !userWantsControl) {
  56089. cb();
  56090. }
  56091. }
  56092. function leave (vnode, rm) {
  56093. var el = vnode.elm;
  56094. // call enter callback now
  56095. if (isDef(el._enterCb)) {
  56096. el._enterCb.cancelled = true;
  56097. el._enterCb();
  56098. }
  56099. var data = resolveTransition(vnode.data.transition);
  56100. if (isUndef(data) || el.nodeType !== 1) {
  56101. return rm()
  56102. }
  56103. /* istanbul ignore if */
  56104. if (isDef(el._leaveCb)) {
  56105. return
  56106. }
  56107. var css = data.css;
  56108. var type = data.type;
  56109. var leaveClass = data.leaveClass;
  56110. var leaveToClass = data.leaveToClass;
  56111. var leaveActiveClass = data.leaveActiveClass;
  56112. var beforeLeave = data.beforeLeave;
  56113. var leave = data.leave;
  56114. var afterLeave = data.afterLeave;
  56115. var leaveCancelled = data.leaveCancelled;
  56116. var delayLeave = data.delayLeave;
  56117. var duration = data.duration;
  56118. var expectsCSS = css !== false && !isIE9;
  56119. var userWantsControl = getHookArgumentsLength(leave);
  56120. var explicitLeaveDuration = toNumber(
  56121. isObject(duration)
  56122. ? duration.leave
  56123. : duration
  56124. );
  56125. if (isDef(explicitLeaveDuration)) {
  56126. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56127. }
  56128. var cb = el._leaveCb = once(function () {
  56129. if (el.parentNode && el.parentNode._pending) {
  56130. el.parentNode._pending[vnode.key] = null;
  56131. }
  56132. if (expectsCSS) {
  56133. removeTransitionClass(el, leaveToClass);
  56134. removeTransitionClass(el, leaveActiveClass);
  56135. }
  56136. if (cb.cancelled) {
  56137. if (expectsCSS) {
  56138. removeTransitionClass(el, leaveClass);
  56139. }
  56140. leaveCancelled && leaveCancelled(el);
  56141. } else {
  56142. rm();
  56143. afterLeave && afterLeave(el);
  56144. }
  56145. el._leaveCb = null;
  56146. });
  56147. if (delayLeave) {
  56148. delayLeave(performLeave);
  56149. } else {
  56150. performLeave();
  56151. }
  56152. function performLeave () {
  56153. // the delayed leave may have already been cancelled
  56154. if (cb.cancelled) {
  56155. return
  56156. }
  56157. // record leaving element
  56158. if (!vnode.data.show && el.parentNode) {
  56159. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56160. }
  56161. beforeLeave && beforeLeave(el);
  56162. if (expectsCSS) {
  56163. addTransitionClass(el, leaveClass);
  56164. addTransitionClass(el, leaveActiveClass);
  56165. nextFrame(function () {
  56166. removeTransitionClass(el, leaveClass);
  56167. if (!cb.cancelled) {
  56168. addTransitionClass(el, leaveToClass);
  56169. if (!userWantsControl) {
  56170. if (isValidDuration(explicitLeaveDuration)) {
  56171. setTimeout(cb, explicitLeaveDuration);
  56172. } else {
  56173. whenTransitionEnds(el, type, cb);
  56174. }
  56175. }
  56176. }
  56177. });
  56178. }
  56179. leave && leave(el, cb);
  56180. if (!expectsCSS && !userWantsControl) {
  56181. cb();
  56182. }
  56183. }
  56184. }
  56185. // only used in dev mode
  56186. function checkDuration (val, name, vnode) {
  56187. if (typeof val !== 'number') {
  56188. warn(
  56189. "<transition> explicit " + name + " duration is not a valid number - " +
  56190. "got " + (JSON.stringify(val)) + ".",
  56191. vnode.context
  56192. );
  56193. } else if (isNaN(val)) {
  56194. warn(
  56195. "<transition> explicit " + name + " duration is NaN - " +
  56196. 'the duration expression might be incorrect.',
  56197. vnode.context
  56198. );
  56199. }
  56200. }
  56201. function isValidDuration (val) {
  56202. return typeof val === 'number' && !isNaN(val)
  56203. }
  56204. /**
  56205. * Normalize a transition hook's argument length. The hook may be:
  56206. * - a merged hook (invoker) with the original in .fns
  56207. * - a wrapped component method (check ._length)
  56208. * - a plain function (.length)
  56209. */
  56210. function getHookArgumentsLength (fn) {
  56211. if (isUndef(fn)) {
  56212. return false
  56213. }
  56214. var invokerFns = fn.fns;
  56215. if (isDef(invokerFns)) {
  56216. // invoker
  56217. return getHookArgumentsLength(
  56218. Array.isArray(invokerFns)
  56219. ? invokerFns[0]
  56220. : invokerFns
  56221. )
  56222. } else {
  56223. return (fn._length || fn.length) > 1
  56224. }
  56225. }
  56226. function _enter (_, vnode) {
  56227. if (vnode.data.show !== true) {
  56228. enter(vnode);
  56229. }
  56230. }
  56231. var transition = inBrowser ? {
  56232. create: _enter,
  56233. activate: _enter,
  56234. remove: function remove$$1 (vnode, rm) {
  56235. /* istanbul ignore else */
  56236. if (vnode.data.show !== true) {
  56237. leave(vnode, rm);
  56238. } else {
  56239. rm();
  56240. }
  56241. }
  56242. } : {};
  56243. var platformModules = [
  56244. attrs,
  56245. klass,
  56246. events,
  56247. domProps,
  56248. style,
  56249. transition
  56250. ];
  56251. /* */
  56252. // the directive module should be applied last, after all
  56253. // built-in modules have been applied.
  56254. var modules = platformModules.concat(baseModules);
  56255. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56256. /**
  56257. * Not type checking this file because flow doesn't like attaching
  56258. * properties to Elements.
  56259. */
  56260. /* istanbul ignore if */
  56261. if (isIE9) {
  56262. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56263. document.addEventListener('selectionchange', function () {
  56264. var el = document.activeElement;
  56265. if (el && el.vmodel) {
  56266. trigger(el, 'input');
  56267. }
  56268. });
  56269. }
  56270. var directive = {
  56271. inserted: function inserted (el, binding, vnode, oldVnode) {
  56272. if (vnode.tag === 'select') {
  56273. // #6903
  56274. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56275. mergeVNodeHook(vnode, 'postpatch', function () {
  56276. directive.componentUpdated(el, binding, vnode);
  56277. });
  56278. } else {
  56279. setSelected(el, binding, vnode.context);
  56280. }
  56281. el._vOptions = [].map.call(el.options, getValue);
  56282. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56283. el._vModifiers = binding.modifiers;
  56284. if (!binding.modifiers.lazy) {
  56285. el.addEventListener('compositionstart', onCompositionStart);
  56286. el.addEventListener('compositionend', onCompositionEnd);
  56287. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56288. // switching focus before confirming composition choice
  56289. // this also fixes the issue where some browsers e.g. iOS Chrome
  56290. // fires "change" instead of "input" on autocomplete.
  56291. el.addEventListener('change', onCompositionEnd);
  56292. /* istanbul ignore if */
  56293. if (isIE9) {
  56294. el.vmodel = true;
  56295. }
  56296. }
  56297. }
  56298. },
  56299. componentUpdated: function componentUpdated (el, binding, vnode) {
  56300. if (vnode.tag === 'select') {
  56301. setSelected(el, binding, vnode.context);
  56302. // in case the options rendered by v-for have changed,
  56303. // it's possible that the value is out-of-sync with the rendered options.
  56304. // detect such cases and filter out values that no longer has a matching
  56305. // option in the DOM.
  56306. var prevOptions = el._vOptions;
  56307. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56308. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56309. // trigger change event if
  56310. // no matching option found for at least one value
  56311. var needReset = el.multiple
  56312. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56313. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56314. if (needReset) {
  56315. trigger(el, 'change');
  56316. }
  56317. }
  56318. }
  56319. }
  56320. };
  56321. function setSelected (el, binding, vm) {
  56322. actuallySetSelected(el, binding, vm);
  56323. /* istanbul ignore if */
  56324. if (isIE || isEdge) {
  56325. setTimeout(function () {
  56326. actuallySetSelected(el, binding, vm);
  56327. }, 0);
  56328. }
  56329. }
  56330. function actuallySetSelected (el, binding, vm) {
  56331. var value = binding.value;
  56332. var isMultiple = el.multiple;
  56333. if (isMultiple && !Array.isArray(value)) {
  56334. warn(
  56335. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  56336. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  56337. vm
  56338. );
  56339. return
  56340. }
  56341. var selected, option;
  56342. for (var i = 0, l = el.options.length; i < l; i++) {
  56343. option = el.options[i];
  56344. if (isMultiple) {
  56345. selected = looseIndexOf(value, getValue(option)) > -1;
  56346. if (option.selected !== selected) {
  56347. option.selected = selected;
  56348. }
  56349. } else {
  56350. if (looseEqual(getValue(option), value)) {
  56351. if (el.selectedIndex !== i) {
  56352. el.selectedIndex = i;
  56353. }
  56354. return
  56355. }
  56356. }
  56357. }
  56358. if (!isMultiple) {
  56359. el.selectedIndex = -1;
  56360. }
  56361. }
  56362. function hasNoMatchingOption (value, options) {
  56363. return options.every(function (o) { return !looseEqual(o, value); })
  56364. }
  56365. function getValue (option) {
  56366. return '_value' in option
  56367. ? option._value
  56368. : option.value
  56369. }
  56370. function onCompositionStart (e) {
  56371. e.target.composing = true;
  56372. }
  56373. function onCompositionEnd (e) {
  56374. // prevent triggering an input event for no reason
  56375. if (!e.target.composing) { return }
  56376. e.target.composing = false;
  56377. trigger(e.target, 'input');
  56378. }
  56379. function trigger (el, type) {
  56380. var e = document.createEvent('HTMLEvents');
  56381. e.initEvent(type, true, true);
  56382. el.dispatchEvent(e);
  56383. }
  56384. /* */
  56385. // recursively search for possible transition defined inside the component root
  56386. function locateNode (vnode) {
  56387. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  56388. ? locateNode(vnode.componentInstance._vnode)
  56389. : vnode
  56390. }
  56391. var show = {
  56392. bind: function bind (el, ref, vnode) {
  56393. var value = ref.value;
  56394. vnode = locateNode(vnode);
  56395. var transition$$1 = vnode.data && vnode.data.transition;
  56396. var originalDisplay = el.__vOriginalDisplay =
  56397. el.style.display === 'none' ? '' : el.style.display;
  56398. if (value && transition$$1) {
  56399. vnode.data.show = true;
  56400. enter(vnode, function () {
  56401. el.style.display = originalDisplay;
  56402. });
  56403. } else {
  56404. el.style.display = value ? originalDisplay : 'none';
  56405. }
  56406. },
  56407. update: function update (el, ref, vnode) {
  56408. var value = ref.value;
  56409. var oldValue = ref.oldValue;
  56410. /* istanbul ignore if */
  56411. if (!value === !oldValue) { return }
  56412. vnode = locateNode(vnode);
  56413. var transition$$1 = vnode.data && vnode.data.transition;
  56414. if (transition$$1) {
  56415. vnode.data.show = true;
  56416. if (value) {
  56417. enter(vnode, function () {
  56418. el.style.display = el.__vOriginalDisplay;
  56419. });
  56420. } else {
  56421. leave(vnode, function () {
  56422. el.style.display = 'none';
  56423. });
  56424. }
  56425. } else {
  56426. el.style.display = value ? el.__vOriginalDisplay : 'none';
  56427. }
  56428. },
  56429. unbind: function unbind (
  56430. el,
  56431. binding,
  56432. vnode,
  56433. oldVnode,
  56434. isDestroy
  56435. ) {
  56436. if (!isDestroy) {
  56437. el.style.display = el.__vOriginalDisplay;
  56438. }
  56439. }
  56440. };
  56441. var platformDirectives = {
  56442. model: directive,
  56443. show: show
  56444. };
  56445. /* */
  56446. var transitionProps = {
  56447. name: String,
  56448. appear: Boolean,
  56449. css: Boolean,
  56450. mode: String,
  56451. type: String,
  56452. enterClass: String,
  56453. leaveClass: String,
  56454. enterToClass: String,
  56455. leaveToClass: String,
  56456. enterActiveClass: String,
  56457. leaveActiveClass: String,
  56458. appearClass: String,
  56459. appearActiveClass: String,
  56460. appearToClass: String,
  56461. duration: [Number, String, Object]
  56462. };
  56463. // in case the child is also an abstract component, e.g. <keep-alive>
  56464. // we want to recursively retrieve the real component to be rendered
  56465. function getRealChild (vnode) {
  56466. var compOptions = vnode && vnode.componentOptions;
  56467. if (compOptions && compOptions.Ctor.options.abstract) {
  56468. return getRealChild(getFirstComponentChild(compOptions.children))
  56469. } else {
  56470. return vnode
  56471. }
  56472. }
  56473. function extractTransitionData (comp) {
  56474. var data = {};
  56475. var options = comp.$options;
  56476. // props
  56477. for (var key in options.propsData) {
  56478. data[key] = comp[key];
  56479. }
  56480. // events.
  56481. // extract listeners and pass them directly to the transition methods
  56482. var listeners = options._parentListeners;
  56483. for (var key$1 in listeners) {
  56484. data[camelize(key$1)] = listeners[key$1];
  56485. }
  56486. return data
  56487. }
  56488. function placeholder (h, rawChild) {
  56489. if (/\d-keep-alive$/.test(rawChild.tag)) {
  56490. return h('keep-alive', {
  56491. props: rawChild.componentOptions.propsData
  56492. })
  56493. }
  56494. }
  56495. function hasParentTransition (vnode) {
  56496. while ((vnode = vnode.parent)) {
  56497. if (vnode.data.transition) {
  56498. return true
  56499. }
  56500. }
  56501. }
  56502. function isSameChild (child, oldChild) {
  56503. return oldChild.key === child.key && oldChild.tag === child.tag
  56504. }
  56505. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  56506. var isVShowDirective = function (d) { return d.name === 'show'; };
  56507. var Transition = {
  56508. name: 'transition',
  56509. props: transitionProps,
  56510. abstract: true,
  56511. render: function render (h) {
  56512. var this$1 = this;
  56513. var children = this.$slots.default;
  56514. if (!children) {
  56515. return
  56516. }
  56517. // filter out text nodes (possible whitespaces)
  56518. children = children.filter(isNotTextNode);
  56519. /* istanbul ignore if */
  56520. if (!children.length) {
  56521. return
  56522. }
  56523. // warn multiple elements
  56524. if (children.length > 1) {
  56525. warn(
  56526. '<transition> can only be used on a single element. Use ' +
  56527. '<transition-group> for lists.',
  56528. this.$parent
  56529. );
  56530. }
  56531. var mode = this.mode;
  56532. // warn invalid mode
  56533. if (mode && mode !== 'in-out' && mode !== 'out-in'
  56534. ) {
  56535. warn(
  56536. 'invalid <transition> mode: ' + mode,
  56537. this.$parent
  56538. );
  56539. }
  56540. var rawChild = children[0];
  56541. // if this is a component root node and the component's
  56542. // parent container node also has transition, skip.
  56543. if (hasParentTransition(this.$vnode)) {
  56544. return rawChild
  56545. }
  56546. // apply transition data to child
  56547. // use getRealChild() to ignore abstract components e.g. keep-alive
  56548. var child = getRealChild(rawChild);
  56549. /* istanbul ignore if */
  56550. if (!child) {
  56551. return rawChild
  56552. }
  56553. if (this._leaving) {
  56554. return placeholder(h, rawChild)
  56555. }
  56556. // ensure a key that is unique to the vnode type and to this transition
  56557. // component instance. This key will be used to remove pending leaving nodes
  56558. // during entering.
  56559. var id = "__transition-" + (this._uid) + "-";
  56560. child.key = child.key == null
  56561. ? child.isComment
  56562. ? id + 'comment'
  56563. : id + child.tag
  56564. : isPrimitive(child.key)
  56565. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  56566. : child.key;
  56567. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  56568. var oldRawChild = this._vnode;
  56569. var oldChild = getRealChild(oldRawChild);
  56570. // mark v-show
  56571. // so that the transition module can hand over the control to the directive
  56572. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  56573. child.data.show = true;
  56574. }
  56575. if (
  56576. oldChild &&
  56577. oldChild.data &&
  56578. !isSameChild(child, oldChild) &&
  56579. !isAsyncPlaceholder(oldChild) &&
  56580. // #6687 component root is a comment node
  56581. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  56582. ) {
  56583. // replace old child transition data with fresh one
  56584. // important for dynamic transitions!
  56585. var oldData = oldChild.data.transition = extend({}, data);
  56586. // handle transition mode
  56587. if (mode === 'out-in') {
  56588. // return placeholder node and queue update when leave finishes
  56589. this._leaving = true;
  56590. mergeVNodeHook(oldData, 'afterLeave', function () {
  56591. this$1._leaving = false;
  56592. this$1.$forceUpdate();
  56593. });
  56594. return placeholder(h, rawChild)
  56595. } else if (mode === 'in-out') {
  56596. if (isAsyncPlaceholder(child)) {
  56597. return oldRawChild
  56598. }
  56599. var delayedLeave;
  56600. var performLeave = function () { delayedLeave(); };
  56601. mergeVNodeHook(data, 'afterEnter', performLeave);
  56602. mergeVNodeHook(data, 'enterCancelled', performLeave);
  56603. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  56604. }
  56605. }
  56606. return rawChild
  56607. }
  56608. };
  56609. /* */
  56610. var props = extend({
  56611. tag: String,
  56612. moveClass: String
  56613. }, transitionProps);
  56614. delete props.mode;
  56615. var TransitionGroup = {
  56616. props: props,
  56617. beforeMount: function beforeMount () {
  56618. var this$1 = this;
  56619. var update = this._update;
  56620. this._update = function (vnode, hydrating) {
  56621. var restoreActiveInstance = setActiveInstance(this$1);
  56622. // force removing pass
  56623. this$1.__patch__(
  56624. this$1._vnode,
  56625. this$1.kept,
  56626. false, // hydrating
  56627. true // removeOnly (!important, avoids unnecessary moves)
  56628. );
  56629. this$1._vnode = this$1.kept;
  56630. restoreActiveInstance();
  56631. update.call(this$1, vnode, hydrating);
  56632. };
  56633. },
  56634. render: function render (h) {
  56635. var tag = this.tag || this.$vnode.data.tag || 'span';
  56636. var map = Object.create(null);
  56637. var prevChildren = this.prevChildren = this.children;
  56638. var rawChildren = this.$slots.default || [];
  56639. var children = this.children = [];
  56640. var transitionData = extractTransitionData(this);
  56641. for (var i = 0; i < rawChildren.length; i++) {
  56642. var c = rawChildren[i];
  56643. if (c.tag) {
  56644. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  56645. children.push(c);
  56646. map[c.key] = c
  56647. ;(c.data || (c.data = {})).transition = transitionData;
  56648. } else {
  56649. var opts = c.componentOptions;
  56650. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  56651. warn(("<transition-group> children must be keyed: <" + name + ">"));
  56652. }
  56653. }
  56654. }
  56655. if (prevChildren) {
  56656. var kept = [];
  56657. var removed = [];
  56658. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  56659. var c$1 = prevChildren[i$1];
  56660. c$1.data.transition = transitionData;
  56661. c$1.data.pos = c$1.elm.getBoundingClientRect();
  56662. if (map[c$1.key]) {
  56663. kept.push(c$1);
  56664. } else {
  56665. removed.push(c$1);
  56666. }
  56667. }
  56668. this.kept = h(tag, null, kept);
  56669. this.removed = removed;
  56670. }
  56671. return h(tag, null, children)
  56672. },
  56673. updated: function updated () {
  56674. var children = this.prevChildren;
  56675. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  56676. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  56677. return
  56678. }
  56679. // we divide the work into three loops to avoid mixing DOM reads and writes
  56680. // in each iteration - which helps prevent layout thrashing.
  56681. children.forEach(callPendingCbs);
  56682. children.forEach(recordPosition);
  56683. children.forEach(applyTranslation);
  56684. // force reflow to put everything in position
  56685. // assign to this to avoid being removed in tree-shaking
  56686. // $flow-disable-line
  56687. this._reflow = document.body.offsetHeight;
  56688. children.forEach(function (c) {
  56689. if (c.data.moved) {
  56690. var el = c.elm;
  56691. var s = el.style;
  56692. addTransitionClass(el, moveClass);
  56693. s.transform = s.WebkitTransform = s.transitionDuration = '';
  56694. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  56695. if (e && e.target !== el) {
  56696. return
  56697. }
  56698. if (!e || /transform$/.test(e.propertyName)) {
  56699. el.removeEventListener(transitionEndEvent, cb);
  56700. el._moveCb = null;
  56701. removeTransitionClass(el, moveClass);
  56702. }
  56703. });
  56704. }
  56705. });
  56706. },
  56707. methods: {
  56708. hasMove: function hasMove (el, moveClass) {
  56709. /* istanbul ignore if */
  56710. if (!hasTransition) {
  56711. return false
  56712. }
  56713. /* istanbul ignore if */
  56714. if (this._hasMove) {
  56715. return this._hasMove
  56716. }
  56717. // Detect whether an element with the move class applied has
  56718. // CSS transitions. Since the element may be inside an entering
  56719. // transition at this very moment, we make a clone of it and remove
  56720. // all other transition classes applied to ensure only the move class
  56721. // is applied.
  56722. var clone = el.cloneNode();
  56723. if (el._transitionClasses) {
  56724. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  56725. }
  56726. addClass(clone, moveClass);
  56727. clone.style.display = 'none';
  56728. this.$el.appendChild(clone);
  56729. var info = getTransitionInfo(clone);
  56730. this.$el.removeChild(clone);
  56731. return (this._hasMove = info.hasTransform)
  56732. }
  56733. }
  56734. };
  56735. function callPendingCbs (c) {
  56736. /* istanbul ignore if */
  56737. if (c.elm._moveCb) {
  56738. c.elm._moveCb();
  56739. }
  56740. /* istanbul ignore if */
  56741. if (c.elm._enterCb) {
  56742. c.elm._enterCb();
  56743. }
  56744. }
  56745. function recordPosition (c) {
  56746. c.data.newPos = c.elm.getBoundingClientRect();
  56747. }
  56748. function applyTranslation (c) {
  56749. var oldPos = c.data.pos;
  56750. var newPos = c.data.newPos;
  56751. var dx = oldPos.left - newPos.left;
  56752. var dy = oldPos.top - newPos.top;
  56753. if (dx || dy) {
  56754. c.data.moved = true;
  56755. var s = c.elm.style;
  56756. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  56757. s.transitionDuration = '0s';
  56758. }
  56759. }
  56760. var platformComponents = {
  56761. Transition: Transition,
  56762. TransitionGroup: TransitionGroup
  56763. };
  56764. /* */
  56765. // install platform specific utils
  56766. Vue.config.mustUseProp = mustUseProp;
  56767. Vue.config.isReservedTag = isReservedTag;
  56768. Vue.config.isReservedAttr = isReservedAttr;
  56769. Vue.config.getTagNamespace = getTagNamespace;
  56770. Vue.config.isUnknownElement = isUnknownElement;
  56771. // install platform runtime directives & components
  56772. extend(Vue.options.directives, platformDirectives);
  56773. extend(Vue.options.components, platformComponents);
  56774. // install platform patch function
  56775. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  56776. // public mount method
  56777. Vue.prototype.$mount = function (
  56778. el,
  56779. hydrating
  56780. ) {
  56781. el = el && inBrowser ? query(el) : undefined;
  56782. return mountComponent(this, el, hydrating)
  56783. };
  56784. // devtools global hook
  56785. /* istanbul ignore next */
  56786. if (inBrowser) {
  56787. setTimeout(function () {
  56788. if (config.devtools) {
  56789. if (devtools) {
  56790. devtools.emit('init', Vue);
  56791. } else {
  56792. console[console.info ? 'info' : 'log'](
  56793. 'Download the Vue Devtools extension for a better development experience:\n' +
  56794. 'https://github.com/vuejs/vue-devtools'
  56795. );
  56796. }
  56797. }
  56798. if (config.productionTip !== false &&
  56799. typeof console !== 'undefined'
  56800. ) {
  56801. console[console.info ? 'info' : 'log'](
  56802. "You are running Vue in development mode.\n" +
  56803. "Make sure to turn on production mode when deploying for production.\n" +
  56804. "See more tips at https://vuejs.org/guide/deployment.html"
  56805. );
  56806. }
  56807. }, 0);
  56808. }
  56809. /* */
  56810. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  56811. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  56812. var buildRegex = cached(function (delimiters) {
  56813. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  56814. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  56815. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  56816. });
  56817. function parseText (
  56818. text,
  56819. delimiters
  56820. ) {
  56821. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  56822. if (!tagRE.test(text)) {
  56823. return
  56824. }
  56825. var tokens = [];
  56826. var rawTokens = [];
  56827. var lastIndex = tagRE.lastIndex = 0;
  56828. var match, index, tokenValue;
  56829. while ((match = tagRE.exec(text))) {
  56830. index = match.index;
  56831. // push text token
  56832. if (index > lastIndex) {
  56833. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  56834. tokens.push(JSON.stringify(tokenValue));
  56835. }
  56836. // tag token
  56837. var exp = parseFilters(match[1].trim());
  56838. tokens.push(("_s(" + exp + ")"));
  56839. rawTokens.push({ '@binding': exp });
  56840. lastIndex = index + match[0].length;
  56841. }
  56842. if (lastIndex < text.length) {
  56843. rawTokens.push(tokenValue = text.slice(lastIndex));
  56844. tokens.push(JSON.stringify(tokenValue));
  56845. }
  56846. return {
  56847. expression: tokens.join('+'),
  56848. tokens: rawTokens
  56849. }
  56850. }
  56851. /* */
  56852. function transformNode (el, options) {
  56853. var warn = options.warn || baseWarn;
  56854. var staticClass = getAndRemoveAttr(el, 'class');
  56855. if (staticClass) {
  56856. var res = parseText(staticClass, options.delimiters);
  56857. if (res) {
  56858. warn(
  56859. "class=\"" + staticClass + "\": " +
  56860. 'Interpolation inside attributes has been removed. ' +
  56861. 'Use v-bind or the colon shorthand instead. For example, ' +
  56862. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  56863. el.rawAttrsMap['class']
  56864. );
  56865. }
  56866. }
  56867. if (staticClass) {
  56868. el.staticClass = JSON.stringify(staticClass);
  56869. }
  56870. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  56871. if (classBinding) {
  56872. el.classBinding = classBinding;
  56873. }
  56874. }
  56875. function genData (el) {
  56876. var data = '';
  56877. if (el.staticClass) {
  56878. data += "staticClass:" + (el.staticClass) + ",";
  56879. }
  56880. if (el.classBinding) {
  56881. data += "class:" + (el.classBinding) + ",";
  56882. }
  56883. return data
  56884. }
  56885. var klass$1 = {
  56886. staticKeys: ['staticClass'],
  56887. transformNode: transformNode,
  56888. genData: genData
  56889. };
  56890. /* */
  56891. function transformNode$1 (el, options) {
  56892. var warn = options.warn || baseWarn;
  56893. var staticStyle = getAndRemoveAttr(el, 'style');
  56894. if (staticStyle) {
  56895. /* istanbul ignore if */
  56896. {
  56897. var res = parseText(staticStyle, options.delimiters);
  56898. if (res) {
  56899. warn(
  56900. "style=\"" + staticStyle + "\": " +
  56901. 'Interpolation inside attributes has been removed. ' +
  56902. 'Use v-bind or the colon shorthand instead. For example, ' +
  56903. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  56904. el.rawAttrsMap['style']
  56905. );
  56906. }
  56907. }
  56908. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  56909. }
  56910. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  56911. if (styleBinding) {
  56912. el.styleBinding = styleBinding;
  56913. }
  56914. }
  56915. function genData$1 (el) {
  56916. var data = '';
  56917. if (el.staticStyle) {
  56918. data += "staticStyle:" + (el.staticStyle) + ",";
  56919. }
  56920. if (el.styleBinding) {
  56921. data += "style:(" + (el.styleBinding) + "),";
  56922. }
  56923. return data
  56924. }
  56925. var style$1 = {
  56926. staticKeys: ['staticStyle'],
  56927. transformNode: transformNode$1,
  56928. genData: genData$1
  56929. };
  56930. /* */
  56931. var decoder;
  56932. var he = {
  56933. decode: function decode (html) {
  56934. decoder = decoder || document.createElement('div');
  56935. decoder.innerHTML = html;
  56936. return decoder.textContent
  56937. }
  56938. };
  56939. /* */
  56940. var isUnaryTag = makeMap(
  56941. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  56942. 'link,meta,param,source,track,wbr'
  56943. );
  56944. // Elements that you can, intentionally, leave open
  56945. // (and which close themselves)
  56946. var canBeLeftOpenTag = makeMap(
  56947. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  56948. );
  56949. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  56950. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  56951. var isNonPhrasingTag = makeMap(
  56952. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  56953. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  56954. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  56955. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  56956. 'title,tr,track'
  56957. );
  56958. /**
  56959. * Not type-checking this file because it's mostly vendor code.
  56960. */
  56961. // Regular Expressions for parsing tags and attributes
  56962. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56963. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56964. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  56965. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  56966. var startTagOpen = new RegExp(("^<" + qnameCapture));
  56967. var startTagClose = /^\s*(\/?)>/;
  56968. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  56969. var doctype = /^<!DOCTYPE [^>]+>/i;
  56970. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  56971. var comment = /^<!\--/;
  56972. var conditionalComment = /^<!\[/;
  56973. // Special Elements (can contain anything)
  56974. var isPlainTextElement = makeMap('script,style,textarea', true);
  56975. var reCache = {};
  56976. var decodingMap = {
  56977. '&lt;': '<',
  56978. '&gt;': '>',
  56979. '&quot;': '"',
  56980. '&amp;': '&',
  56981. '&#10;': '\n',
  56982. '&#9;': '\t',
  56983. '&#39;': "'"
  56984. };
  56985. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  56986. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  56987. // #5992
  56988. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  56989. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  56990. function decodeAttr (value, shouldDecodeNewlines) {
  56991. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  56992. return value.replace(re, function (match) { return decodingMap[match]; })
  56993. }
  56994. function parseHTML (html, options) {
  56995. var stack = [];
  56996. var expectHTML = options.expectHTML;
  56997. var isUnaryTag$$1 = options.isUnaryTag || no;
  56998. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  56999. var index = 0;
  57000. var last, lastTag;
  57001. while (html) {
  57002. last = html;
  57003. // Make sure we're not in a plaintext content element like script/style
  57004. if (!lastTag || !isPlainTextElement(lastTag)) {
  57005. var textEnd = html.indexOf('<');
  57006. if (textEnd === 0) {
  57007. // Comment:
  57008. if (comment.test(html)) {
  57009. var commentEnd = html.indexOf('-->');
  57010. if (commentEnd >= 0) {
  57011. if (options.shouldKeepComment) {
  57012. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57013. }
  57014. advance(commentEnd + 3);
  57015. continue
  57016. }
  57017. }
  57018. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57019. if (conditionalComment.test(html)) {
  57020. var conditionalEnd = html.indexOf(']>');
  57021. if (conditionalEnd >= 0) {
  57022. advance(conditionalEnd + 2);
  57023. continue
  57024. }
  57025. }
  57026. // Doctype:
  57027. var doctypeMatch = html.match(doctype);
  57028. if (doctypeMatch) {
  57029. advance(doctypeMatch[0].length);
  57030. continue
  57031. }
  57032. // End tag:
  57033. var endTagMatch = html.match(endTag);
  57034. if (endTagMatch) {
  57035. var curIndex = index;
  57036. advance(endTagMatch[0].length);
  57037. parseEndTag(endTagMatch[1], curIndex, index);
  57038. continue
  57039. }
  57040. // Start tag:
  57041. var startTagMatch = parseStartTag();
  57042. if (startTagMatch) {
  57043. handleStartTag(startTagMatch);
  57044. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57045. advance(1);
  57046. }
  57047. continue
  57048. }
  57049. }
  57050. var text = (void 0), rest = (void 0), next = (void 0);
  57051. if (textEnd >= 0) {
  57052. rest = html.slice(textEnd);
  57053. while (
  57054. !endTag.test(rest) &&
  57055. !startTagOpen.test(rest) &&
  57056. !comment.test(rest) &&
  57057. !conditionalComment.test(rest)
  57058. ) {
  57059. // < in plain text, be forgiving and treat it as text
  57060. next = rest.indexOf('<', 1);
  57061. if (next < 0) { break }
  57062. textEnd += next;
  57063. rest = html.slice(textEnd);
  57064. }
  57065. text = html.substring(0, textEnd);
  57066. }
  57067. if (textEnd < 0) {
  57068. text = html;
  57069. }
  57070. if (text) {
  57071. advance(text.length);
  57072. }
  57073. if (options.chars && text) {
  57074. options.chars(text, index - text.length, index);
  57075. }
  57076. } else {
  57077. var endTagLength = 0;
  57078. var stackedTag = lastTag.toLowerCase();
  57079. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57080. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57081. endTagLength = endTag.length;
  57082. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57083. text = text
  57084. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57085. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57086. }
  57087. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57088. text = text.slice(1);
  57089. }
  57090. if (options.chars) {
  57091. options.chars(text);
  57092. }
  57093. return ''
  57094. });
  57095. index += html.length - rest$1.length;
  57096. html = rest$1;
  57097. parseEndTag(stackedTag, index - endTagLength, index);
  57098. }
  57099. if (html === last) {
  57100. options.chars && options.chars(html);
  57101. if (!stack.length && options.warn) {
  57102. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57103. }
  57104. break
  57105. }
  57106. }
  57107. // Clean up any remaining tags
  57108. parseEndTag();
  57109. function advance (n) {
  57110. index += n;
  57111. html = html.substring(n);
  57112. }
  57113. function parseStartTag () {
  57114. var start = html.match(startTagOpen);
  57115. if (start) {
  57116. var match = {
  57117. tagName: start[1],
  57118. attrs: [],
  57119. start: index
  57120. };
  57121. advance(start[0].length);
  57122. var end, attr;
  57123. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57124. attr.start = index;
  57125. advance(attr[0].length);
  57126. attr.end = index;
  57127. match.attrs.push(attr);
  57128. }
  57129. if (end) {
  57130. match.unarySlash = end[1];
  57131. advance(end[0].length);
  57132. match.end = index;
  57133. return match
  57134. }
  57135. }
  57136. }
  57137. function handleStartTag (match) {
  57138. var tagName = match.tagName;
  57139. var unarySlash = match.unarySlash;
  57140. if (expectHTML) {
  57141. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57142. parseEndTag(lastTag);
  57143. }
  57144. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57145. parseEndTag(tagName);
  57146. }
  57147. }
  57148. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57149. var l = match.attrs.length;
  57150. var attrs = new Array(l);
  57151. for (var i = 0; i < l; i++) {
  57152. var args = match.attrs[i];
  57153. var value = args[3] || args[4] || args[5] || '';
  57154. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57155. ? options.shouldDecodeNewlinesForHref
  57156. : options.shouldDecodeNewlines;
  57157. attrs[i] = {
  57158. name: args[1],
  57159. value: decodeAttr(value, shouldDecodeNewlines)
  57160. };
  57161. if (options.outputSourceRange) {
  57162. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57163. attrs[i].end = args.end;
  57164. }
  57165. }
  57166. if (!unary) {
  57167. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57168. lastTag = tagName;
  57169. }
  57170. if (options.start) {
  57171. options.start(tagName, attrs, unary, match.start, match.end);
  57172. }
  57173. }
  57174. function parseEndTag (tagName, start, end) {
  57175. var pos, lowerCasedTagName;
  57176. if (start == null) { start = index; }
  57177. if (end == null) { end = index; }
  57178. // Find the closest opened tag of the same type
  57179. if (tagName) {
  57180. lowerCasedTagName = tagName.toLowerCase();
  57181. for (pos = stack.length - 1; pos >= 0; pos--) {
  57182. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57183. break
  57184. }
  57185. }
  57186. } else {
  57187. // If no tag name is provided, clean shop
  57188. pos = 0;
  57189. }
  57190. if (pos >= 0) {
  57191. // Close all the open elements, up the stack
  57192. for (var i = stack.length - 1; i >= pos; i--) {
  57193. if (i > pos || !tagName &&
  57194. options.warn
  57195. ) {
  57196. options.warn(
  57197. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57198. { start: stack[i].start, end: stack[i].end }
  57199. );
  57200. }
  57201. if (options.end) {
  57202. options.end(stack[i].tag, start, end);
  57203. }
  57204. }
  57205. // Remove the open elements from the stack
  57206. stack.length = pos;
  57207. lastTag = pos && stack[pos - 1].tag;
  57208. } else if (lowerCasedTagName === 'br') {
  57209. if (options.start) {
  57210. options.start(tagName, [], true, start, end);
  57211. }
  57212. } else if (lowerCasedTagName === 'p') {
  57213. if (options.start) {
  57214. options.start(tagName, [], false, start, end);
  57215. }
  57216. if (options.end) {
  57217. options.end(tagName, start, end);
  57218. }
  57219. }
  57220. }
  57221. }
  57222. /* */
  57223. var onRE = /^@|^v-on:/;
  57224. var dirRE = /^v-|^@|^:|^#/;
  57225. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57226. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57227. var stripParensRE = /^\(|\)$/g;
  57228. var dynamicArgRE = /^\[.*\]$/;
  57229. var argRE = /:(.*)$/;
  57230. var bindRE = /^:|^\.|^v-bind:/;
  57231. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57232. var slotRE = /^v-slot(:|$)|^#/;
  57233. var lineBreakRE = /[\r\n]/;
  57234. var whitespaceRE$1 = /\s+/g;
  57235. var invalidAttributeRE = /[\s"'<>\/=]/;
  57236. var decodeHTMLCached = cached(he.decode);
  57237. var emptySlotScopeToken = "_empty_";
  57238. // configurable state
  57239. var warn$2;
  57240. var delimiters;
  57241. var transforms;
  57242. var preTransforms;
  57243. var postTransforms;
  57244. var platformIsPreTag;
  57245. var platformMustUseProp;
  57246. var platformGetTagNamespace;
  57247. var maybeComponent;
  57248. function createASTElement (
  57249. tag,
  57250. attrs,
  57251. parent
  57252. ) {
  57253. return {
  57254. type: 1,
  57255. tag: tag,
  57256. attrsList: attrs,
  57257. attrsMap: makeAttrsMap(attrs),
  57258. rawAttrsMap: {},
  57259. parent: parent,
  57260. children: []
  57261. }
  57262. }
  57263. /**
  57264. * Convert HTML string to AST.
  57265. */
  57266. function parse (
  57267. template,
  57268. options
  57269. ) {
  57270. warn$2 = options.warn || baseWarn;
  57271. platformIsPreTag = options.isPreTag || no;
  57272. platformMustUseProp = options.mustUseProp || no;
  57273. platformGetTagNamespace = options.getTagNamespace || no;
  57274. var isReservedTag = options.isReservedTag || no;
  57275. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57276. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57277. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57278. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57279. delimiters = options.delimiters;
  57280. var stack = [];
  57281. var preserveWhitespace = options.preserveWhitespace !== false;
  57282. var whitespaceOption = options.whitespace;
  57283. var root;
  57284. var currentParent;
  57285. var inVPre = false;
  57286. var inPre = false;
  57287. var warned = false;
  57288. function warnOnce (msg, range) {
  57289. if (!warned) {
  57290. warned = true;
  57291. warn$2(msg, range);
  57292. }
  57293. }
  57294. function closeElement (element) {
  57295. trimEndingWhitespace(element);
  57296. if (!inVPre && !element.processed) {
  57297. element = processElement(element, options);
  57298. }
  57299. // tree management
  57300. if (!stack.length && element !== root) {
  57301. // allow root elements with v-if, v-else-if and v-else
  57302. if (root.if && (element.elseif || element.else)) {
  57303. {
  57304. checkRootConstraints(element);
  57305. }
  57306. addIfCondition(root, {
  57307. exp: element.elseif,
  57308. block: element
  57309. });
  57310. } else {
  57311. warnOnce(
  57312. "Component template should contain exactly one root element. " +
  57313. "If you are using v-if on multiple elements, " +
  57314. "use v-else-if to chain them instead.",
  57315. { start: element.start }
  57316. );
  57317. }
  57318. }
  57319. if (currentParent && !element.forbidden) {
  57320. if (element.elseif || element.else) {
  57321. processIfConditions(element, currentParent);
  57322. } else {
  57323. if (element.slotScope) {
  57324. // scoped slot
  57325. // keep it in the children list so that v-else(-if) conditions can
  57326. // find it as the prev node.
  57327. var name = element.slotTarget || '"default"'
  57328. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  57329. }
  57330. currentParent.children.push(element);
  57331. element.parent = currentParent;
  57332. }
  57333. }
  57334. // final children cleanup
  57335. // filter out scoped slots
  57336. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  57337. // remove trailing whitespace node again
  57338. trimEndingWhitespace(element);
  57339. // check pre state
  57340. if (element.pre) {
  57341. inVPre = false;
  57342. }
  57343. if (platformIsPreTag(element.tag)) {
  57344. inPre = false;
  57345. }
  57346. // apply post-transforms
  57347. for (var i = 0; i < postTransforms.length; i++) {
  57348. postTransforms[i](element, options);
  57349. }
  57350. }
  57351. function trimEndingWhitespace (el) {
  57352. // remove trailing whitespace node
  57353. if (!inPre) {
  57354. var lastNode;
  57355. while (
  57356. (lastNode = el.children[el.children.length - 1]) &&
  57357. lastNode.type === 3 &&
  57358. lastNode.text === ' '
  57359. ) {
  57360. el.children.pop();
  57361. }
  57362. }
  57363. }
  57364. function checkRootConstraints (el) {
  57365. if (el.tag === 'slot' || el.tag === 'template') {
  57366. warnOnce(
  57367. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  57368. 'contain multiple nodes.',
  57369. { start: el.start }
  57370. );
  57371. }
  57372. if (el.attrsMap.hasOwnProperty('v-for')) {
  57373. warnOnce(
  57374. 'Cannot use v-for on stateful component root element because ' +
  57375. 'it renders multiple elements.',
  57376. el.rawAttrsMap['v-for']
  57377. );
  57378. }
  57379. }
  57380. parseHTML(template, {
  57381. warn: warn$2,
  57382. expectHTML: options.expectHTML,
  57383. isUnaryTag: options.isUnaryTag,
  57384. canBeLeftOpenTag: options.canBeLeftOpenTag,
  57385. shouldDecodeNewlines: options.shouldDecodeNewlines,
  57386. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  57387. shouldKeepComment: options.comments,
  57388. outputSourceRange: options.outputSourceRange,
  57389. start: function start (tag, attrs, unary, start$1, end) {
  57390. // check namespace.
  57391. // inherit parent ns if there is one
  57392. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  57393. // handle IE svg bug
  57394. /* istanbul ignore if */
  57395. if (isIE && ns === 'svg') {
  57396. attrs = guardIESVGBug(attrs);
  57397. }
  57398. var element = createASTElement(tag, attrs, currentParent);
  57399. if (ns) {
  57400. element.ns = ns;
  57401. }
  57402. {
  57403. if (options.outputSourceRange) {
  57404. element.start = start$1;
  57405. element.end = end;
  57406. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  57407. cumulated[attr.name] = attr;
  57408. return cumulated
  57409. }, {});
  57410. }
  57411. attrs.forEach(function (attr) {
  57412. if (invalidAttributeRE.test(attr.name)) {
  57413. warn$2(
  57414. "Invalid dynamic argument expression: attribute names cannot contain " +
  57415. "spaces, quotes, <, >, / or =.",
  57416. {
  57417. start: attr.start + attr.name.indexOf("["),
  57418. end: attr.start + attr.name.length
  57419. }
  57420. );
  57421. }
  57422. });
  57423. }
  57424. if (isForbiddenTag(element) && !isServerRendering()) {
  57425. element.forbidden = true;
  57426. warn$2(
  57427. 'Templates should only be responsible for mapping the state to the ' +
  57428. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  57429. "<" + tag + ">" + ', as they will not be parsed.',
  57430. { start: element.start }
  57431. );
  57432. }
  57433. // apply pre-transforms
  57434. for (var i = 0; i < preTransforms.length; i++) {
  57435. element = preTransforms[i](element, options) || element;
  57436. }
  57437. if (!inVPre) {
  57438. processPre(element);
  57439. if (element.pre) {
  57440. inVPre = true;
  57441. }
  57442. }
  57443. if (platformIsPreTag(element.tag)) {
  57444. inPre = true;
  57445. }
  57446. if (inVPre) {
  57447. processRawAttrs(element);
  57448. } else if (!element.processed) {
  57449. // structural directives
  57450. processFor(element);
  57451. processIf(element);
  57452. processOnce(element);
  57453. }
  57454. if (!root) {
  57455. root = element;
  57456. {
  57457. checkRootConstraints(root);
  57458. }
  57459. }
  57460. if (!unary) {
  57461. currentParent = element;
  57462. stack.push(element);
  57463. } else {
  57464. closeElement(element);
  57465. }
  57466. },
  57467. end: function end (tag, start, end$1) {
  57468. var element = stack[stack.length - 1];
  57469. // pop stack
  57470. stack.length -= 1;
  57471. currentParent = stack[stack.length - 1];
  57472. if (options.outputSourceRange) {
  57473. element.end = end$1;
  57474. }
  57475. closeElement(element);
  57476. },
  57477. chars: function chars (text, start, end) {
  57478. if (!currentParent) {
  57479. {
  57480. if (text === template) {
  57481. warnOnce(
  57482. 'Component template requires a root element, rather than just text.',
  57483. { start: start }
  57484. );
  57485. } else if ((text = text.trim())) {
  57486. warnOnce(
  57487. ("text \"" + text + "\" outside root element will be ignored."),
  57488. { start: start }
  57489. );
  57490. }
  57491. }
  57492. return
  57493. }
  57494. // IE textarea placeholder bug
  57495. /* istanbul ignore if */
  57496. if (isIE &&
  57497. currentParent.tag === 'textarea' &&
  57498. currentParent.attrsMap.placeholder === text
  57499. ) {
  57500. return
  57501. }
  57502. var children = currentParent.children;
  57503. if (inPre || text.trim()) {
  57504. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  57505. } else if (!children.length) {
  57506. // remove the whitespace-only node right after an opening tag
  57507. text = '';
  57508. } else if (whitespaceOption) {
  57509. if (whitespaceOption === 'condense') {
  57510. // in condense mode, remove the whitespace node if it contains
  57511. // line break, otherwise condense to a single space
  57512. text = lineBreakRE.test(text) ? '' : ' ';
  57513. } else {
  57514. text = ' ';
  57515. }
  57516. } else {
  57517. text = preserveWhitespace ? ' ' : '';
  57518. }
  57519. if (text) {
  57520. if (!inPre && whitespaceOption === 'condense') {
  57521. // condense consecutive whitespaces into single space
  57522. text = text.replace(whitespaceRE$1, ' ');
  57523. }
  57524. var res;
  57525. var child;
  57526. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  57527. child = {
  57528. type: 2,
  57529. expression: res.expression,
  57530. tokens: res.tokens,
  57531. text: text
  57532. };
  57533. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  57534. child = {
  57535. type: 3,
  57536. text: text
  57537. };
  57538. }
  57539. if (child) {
  57540. if (options.outputSourceRange) {
  57541. child.start = start;
  57542. child.end = end;
  57543. }
  57544. children.push(child);
  57545. }
  57546. }
  57547. },
  57548. comment: function comment (text, start, end) {
  57549. // adding anyting as a sibling to the root node is forbidden
  57550. // comments should still be allowed, but ignored
  57551. if (currentParent) {
  57552. var child = {
  57553. type: 3,
  57554. text: text,
  57555. isComment: true
  57556. };
  57557. if (options.outputSourceRange) {
  57558. child.start = start;
  57559. child.end = end;
  57560. }
  57561. currentParent.children.push(child);
  57562. }
  57563. }
  57564. });
  57565. return root
  57566. }
  57567. function processPre (el) {
  57568. if (getAndRemoveAttr(el, 'v-pre') != null) {
  57569. el.pre = true;
  57570. }
  57571. }
  57572. function processRawAttrs (el) {
  57573. var list = el.attrsList;
  57574. var len = list.length;
  57575. if (len) {
  57576. var attrs = el.attrs = new Array(len);
  57577. for (var i = 0; i < len; i++) {
  57578. attrs[i] = {
  57579. name: list[i].name,
  57580. value: JSON.stringify(list[i].value)
  57581. };
  57582. if (list[i].start != null) {
  57583. attrs[i].start = list[i].start;
  57584. attrs[i].end = list[i].end;
  57585. }
  57586. }
  57587. } else if (!el.pre) {
  57588. // non root node in pre blocks with no attributes
  57589. el.plain = true;
  57590. }
  57591. }
  57592. function processElement (
  57593. element,
  57594. options
  57595. ) {
  57596. processKey(element);
  57597. // determine whether this is a plain element after
  57598. // removing structural attributes
  57599. element.plain = (
  57600. !element.key &&
  57601. !element.scopedSlots &&
  57602. !element.attrsList.length
  57603. );
  57604. processRef(element);
  57605. processSlotContent(element);
  57606. processSlotOutlet(element);
  57607. processComponent(element);
  57608. for (var i = 0; i < transforms.length; i++) {
  57609. element = transforms[i](element, options) || element;
  57610. }
  57611. processAttrs(element);
  57612. return element
  57613. }
  57614. function processKey (el) {
  57615. var exp = getBindingAttr(el, 'key');
  57616. if (exp) {
  57617. {
  57618. if (el.tag === 'template') {
  57619. warn$2(
  57620. "<template> cannot be keyed. Place the key on real elements instead.",
  57621. getRawBindingAttr(el, 'key')
  57622. );
  57623. }
  57624. if (el.for) {
  57625. var iterator = el.iterator2 || el.iterator1;
  57626. var parent = el.parent;
  57627. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  57628. warn$2(
  57629. "Do not use v-for index as key on <transition-group> children, " +
  57630. "this is the same as not using keys.",
  57631. getRawBindingAttr(el, 'key'),
  57632. true /* tip */
  57633. );
  57634. }
  57635. }
  57636. }
  57637. el.key = exp;
  57638. }
  57639. }
  57640. function processRef (el) {
  57641. var ref = getBindingAttr(el, 'ref');
  57642. if (ref) {
  57643. el.ref = ref;
  57644. el.refInFor = checkInFor(el);
  57645. }
  57646. }
  57647. function processFor (el) {
  57648. var exp;
  57649. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  57650. var res = parseFor(exp);
  57651. if (res) {
  57652. extend(el, res);
  57653. } else {
  57654. warn$2(
  57655. ("Invalid v-for expression: " + exp),
  57656. el.rawAttrsMap['v-for']
  57657. );
  57658. }
  57659. }
  57660. }
  57661. function parseFor (exp) {
  57662. var inMatch = exp.match(forAliasRE);
  57663. if (!inMatch) { return }
  57664. var res = {};
  57665. res.for = inMatch[2].trim();
  57666. var alias = inMatch[1].trim().replace(stripParensRE, '');
  57667. var iteratorMatch = alias.match(forIteratorRE);
  57668. if (iteratorMatch) {
  57669. res.alias = alias.replace(forIteratorRE, '').trim();
  57670. res.iterator1 = iteratorMatch[1].trim();
  57671. if (iteratorMatch[2]) {
  57672. res.iterator2 = iteratorMatch[2].trim();
  57673. }
  57674. } else {
  57675. res.alias = alias;
  57676. }
  57677. return res
  57678. }
  57679. function processIf (el) {
  57680. var exp = getAndRemoveAttr(el, 'v-if');
  57681. if (exp) {
  57682. el.if = exp;
  57683. addIfCondition(el, {
  57684. exp: exp,
  57685. block: el
  57686. });
  57687. } else {
  57688. if (getAndRemoveAttr(el, 'v-else') != null) {
  57689. el.else = true;
  57690. }
  57691. var elseif = getAndRemoveAttr(el, 'v-else-if');
  57692. if (elseif) {
  57693. el.elseif = elseif;
  57694. }
  57695. }
  57696. }
  57697. function processIfConditions (el, parent) {
  57698. var prev = findPrevElement(parent.children);
  57699. if (prev && prev.if) {
  57700. addIfCondition(prev, {
  57701. exp: el.elseif,
  57702. block: el
  57703. });
  57704. } else {
  57705. warn$2(
  57706. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  57707. "used on element <" + (el.tag) + "> without corresponding v-if.",
  57708. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  57709. );
  57710. }
  57711. }
  57712. function findPrevElement (children) {
  57713. var i = children.length;
  57714. while (i--) {
  57715. if (children[i].type === 1) {
  57716. return children[i]
  57717. } else {
  57718. if (children[i].text !== ' ') {
  57719. warn$2(
  57720. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  57721. "will be ignored.",
  57722. children[i]
  57723. );
  57724. }
  57725. children.pop();
  57726. }
  57727. }
  57728. }
  57729. function addIfCondition (el, condition) {
  57730. if (!el.ifConditions) {
  57731. el.ifConditions = [];
  57732. }
  57733. el.ifConditions.push(condition);
  57734. }
  57735. function processOnce (el) {
  57736. var once$$1 = getAndRemoveAttr(el, 'v-once');
  57737. if (once$$1 != null) {
  57738. el.once = true;
  57739. }
  57740. }
  57741. // handle content being passed to a component as slot,
  57742. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  57743. function processSlotContent (el) {
  57744. var slotScope;
  57745. if (el.tag === 'template') {
  57746. slotScope = getAndRemoveAttr(el, 'scope');
  57747. /* istanbul ignore if */
  57748. if (slotScope) {
  57749. warn$2(
  57750. "the \"scope\" attribute for scoped slots have been deprecated and " +
  57751. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  57752. "can also be used on plain elements in addition to <template> to " +
  57753. "denote scoped slots.",
  57754. el.rawAttrsMap['scope'],
  57755. true
  57756. );
  57757. }
  57758. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  57759. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  57760. /* istanbul ignore if */
  57761. if (el.attrsMap['v-for']) {
  57762. warn$2(
  57763. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  57764. "(v-for takes higher priority). Use a wrapper <template> for the " +
  57765. "scoped slot to make it clearer.",
  57766. el.rawAttrsMap['slot-scope'],
  57767. true
  57768. );
  57769. }
  57770. el.slotScope = slotScope;
  57771. }
  57772. // slot="xxx"
  57773. var slotTarget = getBindingAttr(el, 'slot');
  57774. if (slotTarget) {
  57775. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  57776. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  57777. // preserve slot as an attribute for native shadow DOM compat
  57778. // only for non-scoped slots.
  57779. if (el.tag !== 'template' && !el.slotScope) {
  57780. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  57781. }
  57782. }
  57783. // 2.6 v-slot syntax
  57784. {
  57785. if (el.tag === 'template') {
  57786. // v-slot on <template>
  57787. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  57788. if (slotBinding) {
  57789. {
  57790. if (el.slotTarget || el.slotScope) {
  57791. warn$2(
  57792. "Unexpected mixed usage of different slot syntaxes.",
  57793. el
  57794. );
  57795. }
  57796. if (el.parent && !maybeComponent(el.parent)) {
  57797. warn$2(
  57798. "<template v-slot> can only appear at the root level inside " +
  57799. "the receiving component",
  57800. el
  57801. );
  57802. }
  57803. }
  57804. var ref = getSlotName(slotBinding);
  57805. var name = ref.name;
  57806. var dynamic = ref.dynamic;
  57807. el.slotTarget = name;
  57808. el.slotTargetDynamic = dynamic;
  57809. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  57810. }
  57811. } else {
  57812. // v-slot on component, denotes default slot
  57813. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  57814. if (slotBinding$1) {
  57815. {
  57816. if (!maybeComponent(el)) {
  57817. warn$2(
  57818. "v-slot can only be used on components or <template>.",
  57819. slotBinding$1
  57820. );
  57821. }
  57822. if (el.slotScope || el.slotTarget) {
  57823. warn$2(
  57824. "Unexpected mixed usage of different slot syntaxes.",
  57825. el
  57826. );
  57827. }
  57828. if (el.scopedSlots) {
  57829. warn$2(
  57830. "To avoid scope ambiguity, the default slot should also use " +
  57831. "<template> syntax when there are other named slots.",
  57832. slotBinding$1
  57833. );
  57834. }
  57835. }
  57836. // add the component's children to its default slot
  57837. var slots = el.scopedSlots || (el.scopedSlots = {});
  57838. var ref$1 = getSlotName(slotBinding$1);
  57839. var name$1 = ref$1.name;
  57840. var dynamic$1 = ref$1.dynamic;
  57841. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  57842. slotContainer.slotTarget = name$1;
  57843. slotContainer.slotTargetDynamic = dynamic$1;
  57844. slotContainer.children = el.children.filter(function (c) {
  57845. if (!c.slotScope) {
  57846. c.parent = slotContainer;
  57847. return true
  57848. }
  57849. });
  57850. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  57851. // remove children as they are returned from scopedSlots now
  57852. el.children = [];
  57853. // mark el non-plain so data gets generated
  57854. el.plain = false;
  57855. }
  57856. }
  57857. }
  57858. }
  57859. function getSlotName (binding) {
  57860. var name = binding.name.replace(slotRE, '');
  57861. if (!name) {
  57862. if (binding.name[0] !== '#') {
  57863. name = 'default';
  57864. } else {
  57865. warn$2(
  57866. "v-slot shorthand syntax requires a slot name.",
  57867. binding
  57868. );
  57869. }
  57870. }
  57871. return dynamicArgRE.test(name)
  57872. // dynamic [name]
  57873. ? { name: name.slice(1, -1), dynamic: true }
  57874. // static name
  57875. : { name: ("\"" + name + "\""), dynamic: false }
  57876. }
  57877. // handle <slot/> outlets
  57878. function processSlotOutlet (el) {
  57879. if (el.tag === 'slot') {
  57880. el.slotName = getBindingAttr(el, 'name');
  57881. if (el.key) {
  57882. warn$2(
  57883. "`key` does not work on <slot> because slots are abstract outlets " +
  57884. "and can possibly expand into multiple elements. " +
  57885. "Use the key on a wrapping element instead.",
  57886. getRawBindingAttr(el, 'key')
  57887. );
  57888. }
  57889. }
  57890. }
  57891. function processComponent (el) {
  57892. var binding;
  57893. if ((binding = getBindingAttr(el, 'is'))) {
  57894. el.component = binding;
  57895. }
  57896. if (getAndRemoveAttr(el, 'inline-template') != null) {
  57897. el.inlineTemplate = true;
  57898. }
  57899. }
  57900. function processAttrs (el) {
  57901. var list = el.attrsList;
  57902. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  57903. for (i = 0, l = list.length; i < l; i++) {
  57904. name = rawName = list[i].name;
  57905. value = list[i].value;
  57906. if (dirRE.test(name)) {
  57907. // mark element as dynamic
  57908. el.hasBindings = true;
  57909. // modifiers
  57910. modifiers = parseModifiers(name.replace(dirRE, ''));
  57911. // support .foo shorthand syntax for the .prop modifier
  57912. if (modifiers) {
  57913. name = name.replace(modifierRE, '');
  57914. }
  57915. if (bindRE.test(name)) { // v-bind
  57916. name = name.replace(bindRE, '');
  57917. value = parseFilters(value);
  57918. isDynamic = dynamicArgRE.test(name);
  57919. if (isDynamic) {
  57920. name = name.slice(1, -1);
  57921. }
  57922. if (
  57923. value.trim().length === 0
  57924. ) {
  57925. warn$2(
  57926. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  57927. );
  57928. }
  57929. if (modifiers) {
  57930. if (modifiers.prop && !isDynamic) {
  57931. name = camelize(name);
  57932. if (name === 'innerHtml') { name = 'innerHTML'; }
  57933. }
  57934. if (modifiers.camel && !isDynamic) {
  57935. name = camelize(name);
  57936. }
  57937. if (modifiers.sync) {
  57938. syncGen = genAssignmentCode(value, "$event");
  57939. if (!isDynamic) {
  57940. addHandler(
  57941. el,
  57942. ("update:" + (camelize(name))),
  57943. syncGen,
  57944. null,
  57945. false,
  57946. warn$2,
  57947. list[i]
  57948. );
  57949. if (hyphenate(name) !== camelize(name)) {
  57950. addHandler(
  57951. el,
  57952. ("update:" + (hyphenate(name))),
  57953. syncGen,
  57954. null,
  57955. false,
  57956. warn$2,
  57957. list[i]
  57958. );
  57959. }
  57960. } else {
  57961. // handler w/ dynamic event name
  57962. addHandler(
  57963. el,
  57964. ("\"update:\"+(" + name + ")"),
  57965. syncGen,
  57966. null,
  57967. false,
  57968. warn$2,
  57969. list[i],
  57970. true // dynamic
  57971. );
  57972. }
  57973. }
  57974. }
  57975. if ((modifiers && modifiers.prop) || (
  57976. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  57977. )) {
  57978. addProp(el, name, value, list[i], isDynamic);
  57979. } else {
  57980. addAttr(el, name, value, list[i], isDynamic);
  57981. }
  57982. } else if (onRE.test(name)) { // v-on
  57983. name = name.replace(onRE, '');
  57984. isDynamic = dynamicArgRE.test(name);
  57985. if (isDynamic) {
  57986. name = name.slice(1, -1);
  57987. }
  57988. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  57989. } else { // normal directives
  57990. name = name.replace(dirRE, '');
  57991. // parse arg
  57992. var argMatch = name.match(argRE);
  57993. var arg = argMatch && argMatch[1];
  57994. isDynamic = false;
  57995. if (arg) {
  57996. name = name.slice(0, -(arg.length + 1));
  57997. if (dynamicArgRE.test(arg)) {
  57998. arg = arg.slice(1, -1);
  57999. isDynamic = true;
  58000. }
  58001. }
  58002. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58003. if (name === 'model') {
  58004. checkForAliasModel(el, value);
  58005. }
  58006. }
  58007. } else {
  58008. // literal attribute
  58009. {
  58010. var res = parseText(value, delimiters);
  58011. if (res) {
  58012. warn$2(
  58013. name + "=\"" + value + "\": " +
  58014. 'Interpolation inside attributes has been removed. ' +
  58015. 'Use v-bind or the colon shorthand instead. For example, ' +
  58016. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58017. list[i]
  58018. );
  58019. }
  58020. }
  58021. addAttr(el, name, JSON.stringify(value), list[i]);
  58022. // #6887 firefox doesn't update muted state if set via attribute
  58023. // even immediately after element creation
  58024. if (!el.component &&
  58025. name === 'muted' &&
  58026. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58027. addProp(el, name, 'true', list[i]);
  58028. }
  58029. }
  58030. }
  58031. }
  58032. function checkInFor (el) {
  58033. var parent = el;
  58034. while (parent) {
  58035. if (parent.for !== undefined) {
  58036. return true
  58037. }
  58038. parent = parent.parent;
  58039. }
  58040. return false
  58041. }
  58042. function parseModifiers (name) {
  58043. var match = name.match(modifierRE);
  58044. if (match) {
  58045. var ret = {};
  58046. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58047. return ret
  58048. }
  58049. }
  58050. function makeAttrsMap (attrs) {
  58051. var map = {};
  58052. for (var i = 0, l = attrs.length; i < l; i++) {
  58053. if (
  58054. map[attrs[i].name] && !isIE && !isEdge
  58055. ) {
  58056. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58057. }
  58058. map[attrs[i].name] = attrs[i].value;
  58059. }
  58060. return map
  58061. }
  58062. // for script (e.g. type="x/template") or style, do not decode content
  58063. function isTextTag (el) {
  58064. return el.tag === 'script' || el.tag === 'style'
  58065. }
  58066. function isForbiddenTag (el) {
  58067. return (
  58068. el.tag === 'style' ||
  58069. (el.tag === 'script' && (
  58070. !el.attrsMap.type ||
  58071. el.attrsMap.type === 'text/javascript'
  58072. ))
  58073. )
  58074. }
  58075. var ieNSBug = /^xmlns:NS\d+/;
  58076. var ieNSPrefix = /^NS\d+:/;
  58077. /* istanbul ignore next */
  58078. function guardIESVGBug (attrs) {
  58079. var res = [];
  58080. for (var i = 0; i < attrs.length; i++) {
  58081. var attr = attrs[i];
  58082. if (!ieNSBug.test(attr.name)) {
  58083. attr.name = attr.name.replace(ieNSPrefix, '');
  58084. res.push(attr);
  58085. }
  58086. }
  58087. return res
  58088. }
  58089. function checkForAliasModel (el, value) {
  58090. var _el = el;
  58091. while (_el) {
  58092. if (_el.for && _el.alias === value) {
  58093. warn$2(
  58094. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58095. "You are binding v-model directly to a v-for iteration alias. " +
  58096. "This will not be able to modify the v-for source array because " +
  58097. "writing to the alias is like modifying a function local variable. " +
  58098. "Consider using an array of objects and use v-model on an object property instead.",
  58099. el.rawAttrsMap['v-model']
  58100. );
  58101. }
  58102. _el = _el.parent;
  58103. }
  58104. }
  58105. /* */
  58106. function preTransformNode (el, options) {
  58107. if (el.tag === 'input') {
  58108. var map = el.attrsMap;
  58109. if (!map['v-model']) {
  58110. return
  58111. }
  58112. var typeBinding;
  58113. if (map[':type'] || map['v-bind:type']) {
  58114. typeBinding = getBindingAttr(el, 'type');
  58115. }
  58116. if (!map.type && !typeBinding && map['v-bind']) {
  58117. typeBinding = "(" + (map['v-bind']) + ").type";
  58118. }
  58119. if (typeBinding) {
  58120. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58121. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58122. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58123. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58124. // 1. checkbox
  58125. var branch0 = cloneASTElement(el);
  58126. // process for on the main node
  58127. processFor(branch0);
  58128. addRawAttr(branch0, 'type', 'checkbox');
  58129. processElement(branch0, options);
  58130. branch0.processed = true; // prevent it from double-processed
  58131. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58132. addIfCondition(branch0, {
  58133. exp: branch0.if,
  58134. block: branch0
  58135. });
  58136. // 2. add radio else-if condition
  58137. var branch1 = cloneASTElement(el);
  58138. getAndRemoveAttr(branch1, 'v-for', true);
  58139. addRawAttr(branch1, 'type', 'radio');
  58140. processElement(branch1, options);
  58141. addIfCondition(branch0, {
  58142. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58143. block: branch1
  58144. });
  58145. // 3. other
  58146. var branch2 = cloneASTElement(el);
  58147. getAndRemoveAttr(branch2, 'v-for', true);
  58148. addRawAttr(branch2, ':type', typeBinding);
  58149. processElement(branch2, options);
  58150. addIfCondition(branch0, {
  58151. exp: ifCondition,
  58152. block: branch2
  58153. });
  58154. if (hasElse) {
  58155. branch0.else = true;
  58156. } else if (elseIfCondition) {
  58157. branch0.elseif = elseIfCondition;
  58158. }
  58159. return branch0
  58160. }
  58161. }
  58162. }
  58163. function cloneASTElement (el) {
  58164. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58165. }
  58166. var model$1 = {
  58167. preTransformNode: preTransformNode
  58168. };
  58169. var modules$1 = [
  58170. klass$1,
  58171. style$1,
  58172. model$1
  58173. ];
  58174. /* */
  58175. function text (el, dir) {
  58176. if (dir.value) {
  58177. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58178. }
  58179. }
  58180. /* */
  58181. function html (el, dir) {
  58182. if (dir.value) {
  58183. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58184. }
  58185. }
  58186. var directives$1 = {
  58187. model: model,
  58188. text: text,
  58189. html: html
  58190. };
  58191. /* */
  58192. var baseOptions = {
  58193. expectHTML: true,
  58194. modules: modules$1,
  58195. directives: directives$1,
  58196. isPreTag: isPreTag,
  58197. isUnaryTag: isUnaryTag,
  58198. mustUseProp: mustUseProp,
  58199. canBeLeftOpenTag: canBeLeftOpenTag,
  58200. isReservedTag: isReservedTag,
  58201. getTagNamespace: getTagNamespace,
  58202. staticKeys: genStaticKeys(modules$1)
  58203. };
  58204. /* */
  58205. var isStaticKey;
  58206. var isPlatformReservedTag;
  58207. var genStaticKeysCached = cached(genStaticKeys$1);
  58208. /**
  58209. * Goal of the optimizer: walk the generated template AST tree
  58210. * and detect sub-trees that are purely static, i.e. parts of
  58211. * the DOM that never needs to change.
  58212. *
  58213. * Once we detect these sub-trees, we can:
  58214. *
  58215. * 1. Hoist them into constants, so that we no longer need to
  58216. * create fresh nodes for them on each re-render;
  58217. * 2. Completely skip them in the patching process.
  58218. */
  58219. function optimize (root, options) {
  58220. if (!root) { return }
  58221. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58222. isPlatformReservedTag = options.isReservedTag || no;
  58223. // first pass: mark all non-static nodes.
  58224. markStatic$1(root);
  58225. // second pass: mark static roots.
  58226. markStaticRoots(root, false);
  58227. }
  58228. function genStaticKeys$1 (keys) {
  58229. return makeMap(
  58230. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58231. (keys ? ',' + keys : '')
  58232. )
  58233. }
  58234. function markStatic$1 (node) {
  58235. node.static = isStatic(node);
  58236. if (node.type === 1) {
  58237. // do not make component slot content static. this avoids
  58238. // 1. components not able to mutate slot nodes
  58239. // 2. static slot content fails for hot-reloading
  58240. if (
  58241. !isPlatformReservedTag(node.tag) &&
  58242. node.tag !== 'slot' &&
  58243. node.attrsMap['inline-template'] == null
  58244. ) {
  58245. return
  58246. }
  58247. for (var i = 0, l = node.children.length; i < l; i++) {
  58248. var child = node.children[i];
  58249. markStatic$1(child);
  58250. if (!child.static) {
  58251. node.static = false;
  58252. }
  58253. }
  58254. if (node.ifConditions) {
  58255. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58256. var block = node.ifConditions[i$1].block;
  58257. markStatic$1(block);
  58258. if (!block.static) {
  58259. node.static = false;
  58260. }
  58261. }
  58262. }
  58263. }
  58264. }
  58265. function markStaticRoots (node, isInFor) {
  58266. if (node.type === 1) {
  58267. if (node.static || node.once) {
  58268. node.staticInFor = isInFor;
  58269. }
  58270. // For a node to qualify as a static root, it should have children that
  58271. // are not just static text. Otherwise the cost of hoisting out will
  58272. // outweigh the benefits and it's better off to just always render it fresh.
  58273. if (node.static && node.children.length && !(
  58274. node.children.length === 1 &&
  58275. node.children[0].type === 3
  58276. )) {
  58277. node.staticRoot = true;
  58278. return
  58279. } else {
  58280. node.staticRoot = false;
  58281. }
  58282. if (node.children) {
  58283. for (var i = 0, l = node.children.length; i < l; i++) {
  58284. markStaticRoots(node.children[i], isInFor || !!node.for);
  58285. }
  58286. }
  58287. if (node.ifConditions) {
  58288. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58289. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58290. }
  58291. }
  58292. }
  58293. }
  58294. function isStatic (node) {
  58295. if (node.type === 2) { // expression
  58296. return false
  58297. }
  58298. if (node.type === 3) { // text
  58299. return true
  58300. }
  58301. return !!(node.pre || (
  58302. !node.hasBindings && // no dynamic bindings
  58303. !node.if && !node.for && // not v-if or v-for or v-else
  58304. !isBuiltInTag(node.tag) && // not a built-in
  58305. isPlatformReservedTag(node.tag) && // not a component
  58306. !isDirectChildOfTemplateFor(node) &&
  58307. Object.keys(node).every(isStaticKey)
  58308. ))
  58309. }
  58310. function isDirectChildOfTemplateFor (node) {
  58311. while (node.parent) {
  58312. node = node.parent;
  58313. if (node.tag !== 'template') {
  58314. return false
  58315. }
  58316. if (node.for) {
  58317. return true
  58318. }
  58319. }
  58320. return false
  58321. }
  58322. /* */
  58323. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  58324. var fnInvokeRE = /\([^)]*?\);*$/;
  58325. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  58326. // KeyboardEvent.keyCode aliases
  58327. var keyCodes = {
  58328. esc: 27,
  58329. tab: 9,
  58330. enter: 13,
  58331. space: 32,
  58332. up: 38,
  58333. left: 37,
  58334. right: 39,
  58335. down: 40,
  58336. 'delete': [8, 46]
  58337. };
  58338. // KeyboardEvent.key aliases
  58339. var keyNames = {
  58340. // #7880: IE11 and Edge use `Esc` for Escape key name.
  58341. esc: ['Esc', 'Escape'],
  58342. tab: 'Tab',
  58343. enter: 'Enter',
  58344. // #9112: IE11 uses `Spacebar` for Space key name.
  58345. space: [' ', 'Spacebar'],
  58346. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  58347. up: ['Up', 'ArrowUp'],
  58348. left: ['Left', 'ArrowLeft'],
  58349. right: ['Right', 'ArrowRight'],
  58350. down: ['Down', 'ArrowDown'],
  58351. // #9112: IE11 uses `Del` for Delete key name.
  58352. 'delete': ['Backspace', 'Delete', 'Del']
  58353. };
  58354. // #4868: modifiers that prevent the execution of the listener
  58355. // need to explicitly return null so that we can determine whether to remove
  58356. // the listener for .once
  58357. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  58358. var modifierCode = {
  58359. stop: '$event.stopPropagation();',
  58360. prevent: '$event.preventDefault();',
  58361. self: genGuard("$event.target !== $event.currentTarget"),
  58362. ctrl: genGuard("!$event.ctrlKey"),
  58363. shift: genGuard("!$event.shiftKey"),
  58364. alt: genGuard("!$event.altKey"),
  58365. meta: genGuard("!$event.metaKey"),
  58366. left: genGuard("'button' in $event && $event.button !== 0"),
  58367. middle: genGuard("'button' in $event && $event.button !== 1"),
  58368. right: genGuard("'button' in $event && $event.button !== 2")
  58369. };
  58370. function genHandlers (
  58371. events,
  58372. isNative
  58373. ) {
  58374. var prefix = isNative ? 'nativeOn:' : 'on:';
  58375. var staticHandlers = "";
  58376. var dynamicHandlers = "";
  58377. for (var name in events) {
  58378. var handlerCode = genHandler(events[name]);
  58379. if (events[name] && events[name].dynamic) {
  58380. dynamicHandlers += name + "," + handlerCode + ",";
  58381. } else {
  58382. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  58383. }
  58384. }
  58385. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  58386. if (dynamicHandlers) {
  58387. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  58388. } else {
  58389. return prefix + staticHandlers
  58390. }
  58391. }
  58392. function genHandler (handler) {
  58393. if (!handler) {
  58394. return 'function(){}'
  58395. }
  58396. if (Array.isArray(handler)) {
  58397. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  58398. }
  58399. var isMethodPath = simplePathRE.test(handler.value);
  58400. var isFunctionExpression = fnExpRE.test(handler.value);
  58401. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  58402. if (!handler.modifiers) {
  58403. if (isMethodPath || isFunctionExpression) {
  58404. return handler.value
  58405. }
  58406. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  58407. } else {
  58408. var code = '';
  58409. var genModifierCode = '';
  58410. var keys = [];
  58411. for (var key in handler.modifiers) {
  58412. if (modifierCode[key]) {
  58413. genModifierCode += modifierCode[key];
  58414. // left/right
  58415. if (keyCodes[key]) {
  58416. keys.push(key);
  58417. }
  58418. } else if (key === 'exact') {
  58419. var modifiers = (handler.modifiers);
  58420. genModifierCode += genGuard(
  58421. ['ctrl', 'shift', 'alt', 'meta']
  58422. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  58423. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  58424. .join('||')
  58425. );
  58426. } else {
  58427. keys.push(key);
  58428. }
  58429. }
  58430. if (keys.length) {
  58431. code += genKeyFilter(keys);
  58432. }
  58433. // Make sure modifiers like prevent and stop get executed after key filtering
  58434. if (genModifierCode) {
  58435. code += genModifierCode;
  58436. }
  58437. var handlerCode = isMethodPath
  58438. ? ("return " + (handler.value) + "($event)")
  58439. : isFunctionExpression
  58440. ? ("return (" + (handler.value) + ")($event)")
  58441. : isFunctionInvocation
  58442. ? ("return " + (handler.value))
  58443. : handler.value;
  58444. return ("function($event){" + code + handlerCode + "}")
  58445. }
  58446. }
  58447. function genKeyFilter (keys) {
  58448. return (
  58449. // make sure the key filters only apply to KeyboardEvents
  58450. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  58451. // key events that do not have keyCode property...
  58452. "if(!$event.type.indexOf('key')&&" +
  58453. (keys.map(genFilterCode).join('&&')) + ")return null;"
  58454. )
  58455. }
  58456. function genFilterCode (key) {
  58457. var keyVal = parseInt(key, 10);
  58458. if (keyVal) {
  58459. return ("$event.keyCode!==" + keyVal)
  58460. }
  58461. var keyCode = keyCodes[key];
  58462. var keyName = keyNames[key];
  58463. return (
  58464. "_k($event.keyCode," +
  58465. (JSON.stringify(key)) + "," +
  58466. (JSON.stringify(keyCode)) + "," +
  58467. "$event.key," +
  58468. "" + (JSON.stringify(keyName)) +
  58469. ")"
  58470. )
  58471. }
  58472. /* */
  58473. function on (el, dir) {
  58474. if (dir.modifiers) {
  58475. warn("v-on without argument does not support modifiers.");
  58476. }
  58477. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  58478. }
  58479. /* */
  58480. function bind$1 (el, dir) {
  58481. el.wrapData = function (code) {
  58482. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  58483. };
  58484. }
  58485. /* */
  58486. var baseDirectives = {
  58487. on: on,
  58488. bind: bind$1,
  58489. cloak: noop
  58490. };
  58491. /* */
  58492. var CodegenState = function CodegenState (options) {
  58493. this.options = options;
  58494. this.warn = options.warn || baseWarn;
  58495. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  58496. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  58497. this.directives = extend(extend({}, baseDirectives), options.directives);
  58498. var isReservedTag = options.isReservedTag || no;
  58499. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  58500. this.onceId = 0;
  58501. this.staticRenderFns = [];
  58502. this.pre = false;
  58503. };
  58504. function generate (
  58505. ast,
  58506. options
  58507. ) {
  58508. var state = new CodegenState(options);
  58509. var code = ast ? genElement(ast, state) : '_c("div")';
  58510. return {
  58511. render: ("with(this){return " + code + "}"),
  58512. staticRenderFns: state.staticRenderFns
  58513. }
  58514. }
  58515. function genElement (el, state) {
  58516. if (el.parent) {
  58517. el.pre = el.pre || el.parent.pre;
  58518. }
  58519. if (el.staticRoot && !el.staticProcessed) {
  58520. return genStatic(el, state)
  58521. } else if (el.once && !el.onceProcessed) {
  58522. return genOnce(el, state)
  58523. } else if (el.for && !el.forProcessed) {
  58524. return genFor(el, state)
  58525. } else if (el.if && !el.ifProcessed) {
  58526. return genIf(el, state)
  58527. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  58528. return genChildren(el, state) || 'void 0'
  58529. } else if (el.tag === 'slot') {
  58530. return genSlot(el, state)
  58531. } else {
  58532. // component or element
  58533. var code;
  58534. if (el.component) {
  58535. code = genComponent(el.component, el, state);
  58536. } else {
  58537. var data;
  58538. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  58539. data = genData$2(el, state);
  58540. }
  58541. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58542. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  58543. }
  58544. // module transforms
  58545. for (var i = 0; i < state.transforms.length; i++) {
  58546. code = state.transforms[i](el, code);
  58547. }
  58548. return code
  58549. }
  58550. }
  58551. // hoist static sub-trees out
  58552. function genStatic (el, state) {
  58553. el.staticProcessed = true;
  58554. // Some elements (templates) need to behave differently inside of a v-pre
  58555. // node. All pre nodes are static roots, so we can use this as a location to
  58556. // wrap a state change and reset it upon exiting the pre node.
  58557. var originalPreState = state.pre;
  58558. if (el.pre) {
  58559. state.pre = el.pre;
  58560. }
  58561. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  58562. state.pre = originalPreState;
  58563. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  58564. }
  58565. // v-once
  58566. function genOnce (el, state) {
  58567. el.onceProcessed = true;
  58568. if (el.if && !el.ifProcessed) {
  58569. return genIf(el, state)
  58570. } else if (el.staticInFor) {
  58571. var key = '';
  58572. var parent = el.parent;
  58573. while (parent) {
  58574. if (parent.for) {
  58575. key = parent.key;
  58576. break
  58577. }
  58578. parent = parent.parent;
  58579. }
  58580. if (!key) {
  58581. state.warn(
  58582. "v-once can only be used inside v-for that is keyed. ",
  58583. el.rawAttrsMap['v-once']
  58584. );
  58585. return genElement(el, state)
  58586. }
  58587. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  58588. } else {
  58589. return genStatic(el, state)
  58590. }
  58591. }
  58592. function genIf (
  58593. el,
  58594. state,
  58595. altGen,
  58596. altEmpty
  58597. ) {
  58598. el.ifProcessed = true; // avoid recursion
  58599. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  58600. }
  58601. function genIfConditions (
  58602. conditions,
  58603. state,
  58604. altGen,
  58605. altEmpty
  58606. ) {
  58607. if (!conditions.length) {
  58608. return altEmpty || '_e()'
  58609. }
  58610. var condition = conditions.shift();
  58611. if (condition.exp) {
  58612. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  58613. } else {
  58614. return ("" + (genTernaryExp(condition.block)))
  58615. }
  58616. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  58617. function genTernaryExp (el) {
  58618. return altGen
  58619. ? altGen(el, state)
  58620. : el.once
  58621. ? genOnce(el, state)
  58622. : genElement(el, state)
  58623. }
  58624. }
  58625. function genFor (
  58626. el,
  58627. state,
  58628. altGen,
  58629. altHelper
  58630. ) {
  58631. var exp = el.for;
  58632. var alias = el.alias;
  58633. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  58634. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  58635. if (state.maybeComponent(el) &&
  58636. el.tag !== 'slot' &&
  58637. el.tag !== 'template' &&
  58638. !el.key
  58639. ) {
  58640. state.warn(
  58641. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  58642. "v-for should have explicit keys. " +
  58643. "See https://vuejs.org/guide/list.html#key for more info.",
  58644. el.rawAttrsMap['v-for'],
  58645. true /* tip */
  58646. );
  58647. }
  58648. el.forProcessed = true; // avoid recursion
  58649. return (altHelper || '_l') + "((" + exp + ")," +
  58650. "function(" + alias + iterator1 + iterator2 + "){" +
  58651. "return " + ((altGen || genElement)(el, state)) +
  58652. '})'
  58653. }
  58654. function genData$2 (el, state) {
  58655. var data = '{';
  58656. // directives first.
  58657. // directives may mutate the el's other properties before they are generated.
  58658. var dirs = genDirectives(el, state);
  58659. if (dirs) { data += dirs + ','; }
  58660. // key
  58661. if (el.key) {
  58662. data += "key:" + (el.key) + ",";
  58663. }
  58664. // ref
  58665. if (el.ref) {
  58666. data += "ref:" + (el.ref) + ",";
  58667. }
  58668. if (el.refInFor) {
  58669. data += "refInFor:true,";
  58670. }
  58671. // pre
  58672. if (el.pre) {
  58673. data += "pre:true,";
  58674. }
  58675. // record original tag name for components using "is" attribute
  58676. if (el.component) {
  58677. data += "tag:\"" + (el.tag) + "\",";
  58678. }
  58679. // module data generation functions
  58680. for (var i = 0; i < state.dataGenFns.length; i++) {
  58681. data += state.dataGenFns[i](el);
  58682. }
  58683. // attributes
  58684. if (el.attrs) {
  58685. data += "attrs:" + (genProps(el.attrs)) + ",";
  58686. }
  58687. // DOM props
  58688. if (el.props) {
  58689. data += "domProps:" + (genProps(el.props)) + ",";
  58690. }
  58691. // event handlers
  58692. if (el.events) {
  58693. data += (genHandlers(el.events, false)) + ",";
  58694. }
  58695. if (el.nativeEvents) {
  58696. data += (genHandlers(el.nativeEvents, true)) + ",";
  58697. }
  58698. // slot target
  58699. // only for non-scoped slots
  58700. if (el.slotTarget && !el.slotScope) {
  58701. data += "slot:" + (el.slotTarget) + ",";
  58702. }
  58703. // scoped slots
  58704. if (el.scopedSlots) {
  58705. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  58706. }
  58707. // component v-model
  58708. if (el.model) {
  58709. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  58710. }
  58711. // inline-template
  58712. if (el.inlineTemplate) {
  58713. var inlineTemplate = genInlineTemplate(el, state);
  58714. if (inlineTemplate) {
  58715. data += inlineTemplate + ",";
  58716. }
  58717. }
  58718. data = data.replace(/,$/, '') + '}';
  58719. // v-bind dynamic argument wrap
  58720. // v-bind with dynamic arguments must be applied using the same v-bind object
  58721. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  58722. if (el.dynamicAttrs) {
  58723. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  58724. }
  58725. // v-bind data wrap
  58726. if (el.wrapData) {
  58727. data = el.wrapData(data);
  58728. }
  58729. // v-on data wrap
  58730. if (el.wrapListeners) {
  58731. data = el.wrapListeners(data);
  58732. }
  58733. return data
  58734. }
  58735. function genDirectives (el, state) {
  58736. var dirs = el.directives;
  58737. if (!dirs) { return }
  58738. var res = 'directives:[';
  58739. var hasRuntime = false;
  58740. var i, l, dir, needRuntime;
  58741. for (i = 0, l = dirs.length; i < l; i++) {
  58742. dir = dirs[i];
  58743. needRuntime = true;
  58744. var gen = state.directives[dir.name];
  58745. if (gen) {
  58746. // compile-time directive that manipulates AST.
  58747. // returns true if it also needs a runtime counterpart.
  58748. needRuntime = !!gen(el, dir, state.warn);
  58749. }
  58750. if (needRuntime) {
  58751. hasRuntime = true;
  58752. 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))) : '') + "},";
  58753. }
  58754. }
  58755. if (hasRuntime) {
  58756. return res.slice(0, -1) + ']'
  58757. }
  58758. }
  58759. function genInlineTemplate (el, state) {
  58760. var ast = el.children[0];
  58761. if (el.children.length !== 1 || ast.type !== 1) {
  58762. state.warn(
  58763. 'Inline-template components must have exactly one child element.',
  58764. { start: el.start }
  58765. );
  58766. }
  58767. if (ast && ast.type === 1) {
  58768. var inlineRenderFns = generate(ast, state.options);
  58769. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  58770. }
  58771. }
  58772. function genScopedSlots (
  58773. el,
  58774. slots,
  58775. state
  58776. ) {
  58777. // by default scoped slots are considered "stable", this allows child
  58778. // components with only scoped slots to skip forced updates from parent.
  58779. // but in some cases we have to bail-out of this optimization
  58780. // for example if the slot contains dynamic names, has v-if or v-for on them...
  58781. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  58782. var slot = slots[key];
  58783. return (
  58784. slot.slotTargetDynamic ||
  58785. slot.if ||
  58786. slot.for ||
  58787. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  58788. )
  58789. });
  58790. // #9534: if a component with scoped slots is inside a conditional branch,
  58791. // it's possible for the same component to be reused but with different
  58792. // compiled slot content. To avoid that, we generate a unique key based on
  58793. // the generated code of all the slot contents.
  58794. var needsKey = !!el.if;
  58795. // OR when it is inside another scoped slot or v-for (the reactivity may be
  58796. // disconnected due to the intermediate scope variable)
  58797. // #9438, #9506
  58798. // TODO: this can be further optimized by properly analyzing in-scope bindings
  58799. // and skip force updating ones that do not actually use scope variables.
  58800. if (!needsForceUpdate) {
  58801. var parent = el.parent;
  58802. while (parent) {
  58803. if (
  58804. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  58805. parent.for
  58806. ) {
  58807. needsForceUpdate = true;
  58808. break
  58809. }
  58810. if (parent.if) {
  58811. needsKey = true;
  58812. }
  58813. parent = parent.parent;
  58814. }
  58815. }
  58816. var generatedSlots = Object.keys(slots)
  58817. .map(function (key) { return genScopedSlot(slots[key], state); })
  58818. .join(',');
  58819. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  58820. }
  58821. function hash(str) {
  58822. var hash = 5381;
  58823. var i = str.length;
  58824. while(i) {
  58825. hash = (hash * 33) ^ str.charCodeAt(--i);
  58826. }
  58827. return hash >>> 0
  58828. }
  58829. function containsSlotChild (el) {
  58830. if (el.type === 1) {
  58831. if (el.tag === 'slot') {
  58832. return true
  58833. }
  58834. return el.children.some(containsSlotChild)
  58835. }
  58836. return false
  58837. }
  58838. function genScopedSlot (
  58839. el,
  58840. state
  58841. ) {
  58842. var isLegacySyntax = el.attrsMap['slot-scope'];
  58843. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  58844. return genIf(el, state, genScopedSlot, "null")
  58845. }
  58846. if (el.for && !el.forProcessed) {
  58847. return genFor(el, state, genScopedSlot)
  58848. }
  58849. var slotScope = el.slotScope === emptySlotScopeToken
  58850. ? ""
  58851. : String(el.slotScope);
  58852. var fn = "function(" + slotScope + "){" +
  58853. "return " + (el.tag === 'template'
  58854. ? el.if && isLegacySyntax
  58855. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  58856. : genChildren(el, state) || 'undefined'
  58857. : genElement(el, state)) + "}";
  58858. // reverse proxy v-slot without scope on this.$slots
  58859. var reverseProxy = slotScope ? "" : ",proxy:true";
  58860. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  58861. }
  58862. function genChildren (
  58863. el,
  58864. state,
  58865. checkSkip,
  58866. altGenElement,
  58867. altGenNode
  58868. ) {
  58869. var children = el.children;
  58870. if (children.length) {
  58871. var el$1 = children[0];
  58872. // optimize single v-for
  58873. if (children.length === 1 &&
  58874. el$1.for &&
  58875. el$1.tag !== 'template' &&
  58876. el$1.tag !== 'slot'
  58877. ) {
  58878. var normalizationType = checkSkip
  58879. ? state.maybeComponent(el$1) ? ",1" : ",0"
  58880. : "";
  58881. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  58882. }
  58883. var normalizationType$1 = checkSkip
  58884. ? getNormalizationType(children, state.maybeComponent)
  58885. : 0;
  58886. var gen = altGenNode || genNode;
  58887. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  58888. }
  58889. }
  58890. // determine the normalization needed for the children array.
  58891. // 0: no normalization needed
  58892. // 1: simple normalization needed (possible 1-level deep nested array)
  58893. // 2: full normalization needed
  58894. function getNormalizationType (
  58895. children,
  58896. maybeComponent
  58897. ) {
  58898. var res = 0;
  58899. for (var i = 0; i < children.length; i++) {
  58900. var el = children[i];
  58901. if (el.type !== 1) {
  58902. continue
  58903. }
  58904. if (needsNormalization(el) ||
  58905. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  58906. res = 2;
  58907. break
  58908. }
  58909. if (maybeComponent(el) ||
  58910. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  58911. res = 1;
  58912. }
  58913. }
  58914. return res
  58915. }
  58916. function needsNormalization (el) {
  58917. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  58918. }
  58919. function genNode (node, state) {
  58920. if (node.type === 1) {
  58921. return genElement(node, state)
  58922. } else if (node.type === 3 && node.isComment) {
  58923. return genComment(node)
  58924. } else {
  58925. return genText(node)
  58926. }
  58927. }
  58928. function genText (text) {
  58929. return ("_v(" + (text.type === 2
  58930. ? text.expression // no need for () because already wrapped in _s()
  58931. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  58932. }
  58933. function genComment (comment) {
  58934. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  58935. }
  58936. function genSlot (el, state) {
  58937. var slotName = el.slotName || '"default"';
  58938. var children = genChildren(el, state);
  58939. var res = "_t(" + slotName + (children ? ("," + children) : '');
  58940. var attrs = el.attrs || el.dynamicAttrs
  58941. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  58942. // slot props are camelized
  58943. name: camelize(attr.name),
  58944. value: attr.value,
  58945. dynamic: attr.dynamic
  58946. }); }))
  58947. : null;
  58948. var bind$$1 = el.attrsMap['v-bind'];
  58949. if ((attrs || bind$$1) && !children) {
  58950. res += ",null";
  58951. }
  58952. if (attrs) {
  58953. res += "," + attrs;
  58954. }
  58955. if (bind$$1) {
  58956. res += (attrs ? '' : ',null') + "," + bind$$1;
  58957. }
  58958. return res + ')'
  58959. }
  58960. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  58961. function genComponent (
  58962. componentName,
  58963. el,
  58964. state
  58965. ) {
  58966. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58967. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  58968. }
  58969. function genProps (props) {
  58970. var staticProps = "";
  58971. var dynamicProps = "";
  58972. for (var i = 0; i < props.length; i++) {
  58973. var prop = props[i];
  58974. var value = transformSpecialNewlines(prop.value);
  58975. if (prop.dynamic) {
  58976. dynamicProps += (prop.name) + "," + value + ",";
  58977. } else {
  58978. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  58979. }
  58980. }
  58981. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  58982. if (dynamicProps) {
  58983. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  58984. } else {
  58985. return staticProps
  58986. }
  58987. }
  58988. // #3895, #4268
  58989. function transformSpecialNewlines (text) {
  58990. return text
  58991. .replace(/\u2028/g, '\\u2028')
  58992. .replace(/\u2029/g, '\\u2029')
  58993. }
  58994. /* */
  58995. // these keywords should not appear inside expressions, but operators like
  58996. // typeof, instanceof and in are allowed
  58997. var prohibitedKeywordRE = new RegExp('\\b' + (
  58998. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  58999. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59000. 'extends,finally,continue,debugger,function,arguments'
  59001. ).split(',').join('\\b|\\b') + '\\b');
  59002. // these unary operators should not be used as property/method names
  59003. var unaryOperatorsRE = new RegExp('\\b' + (
  59004. 'delete,typeof,void'
  59005. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59006. // strip strings in expressions
  59007. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59008. // detect problematic expressions in a template
  59009. function detectErrors (ast, warn) {
  59010. if (ast) {
  59011. checkNode(ast, warn);
  59012. }
  59013. }
  59014. function checkNode (node, warn) {
  59015. if (node.type === 1) {
  59016. for (var name in node.attrsMap) {
  59017. if (dirRE.test(name)) {
  59018. var value = node.attrsMap[name];
  59019. if (value) {
  59020. var range = node.rawAttrsMap[name];
  59021. if (name === 'v-for') {
  59022. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59023. } else if (name === 'v-slot' || name[0] === '#') {
  59024. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59025. } else if (onRE.test(name)) {
  59026. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59027. } else {
  59028. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59029. }
  59030. }
  59031. }
  59032. }
  59033. if (node.children) {
  59034. for (var i = 0; i < node.children.length; i++) {
  59035. checkNode(node.children[i], warn);
  59036. }
  59037. }
  59038. } else if (node.type === 2) {
  59039. checkExpression(node.expression, node.text, warn, node);
  59040. }
  59041. }
  59042. function checkEvent (exp, text, warn, range) {
  59043. var stripped = exp.replace(stripStringRE, '');
  59044. var keywordMatch = stripped.match(unaryOperatorsRE);
  59045. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59046. warn(
  59047. "avoid using JavaScript unary operator as property name: " +
  59048. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59049. range
  59050. );
  59051. }
  59052. checkExpression(exp, text, warn, range);
  59053. }
  59054. function checkFor (node, text, warn, range) {
  59055. checkExpression(node.for || '', text, warn, range);
  59056. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59057. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59058. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59059. }
  59060. function checkIdentifier (
  59061. ident,
  59062. type,
  59063. text,
  59064. warn,
  59065. range
  59066. ) {
  59067. if (typeof ident === 'string') {
  59068. try {
  59069. new Function(("var " + ident + "=_"));
  59070. } catch (e) {
  59071. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59072. }
  59073. }
  59074. }
  59075. function checkExpression (exp, text, warn, range) {
  59076. try {
  59077. new Function(("return " + exp));
  59078. } catch (e) {
  59079. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59080. if (keywordMatch) {
  59081. warn(
  59082. "avoid using JavaScript keyword as property name: " +
  59083. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59084. range
  59085. );
  59086. } else {
  59087. warn(
  59088. "invalid expression: " + (e.message) + " in\n\n" +
  59089. " " + exp + "\n\n" +
  59090. " Raw expression: " + (text.trim()) + "\n",
  59091. range
  59092. );
  59093. }
  59094. }
  59095. }
  59096. function checkFunctionParameterExpression (exp, text, warn, range) {
  59097. try {
  59098. new Function(exp, '');
  59099. } catch (e) {
  59100. warn(
  59101. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59102. " " + exp + "\n\n" +
  59103. " Raw expression: " + (text.trim()) + "\n",
  59104. range
  59105. );
  59106. }
  59107. }
  59108. /* */
  59109. var range = 2;
  59110. function generateCodeFrame (
  59111. source,
  59112. start,
  59113. end
  59114. ) {
  59115. if ( start === void 0 ) start = 0;
  59116. if ( end === void 0 ) end = source.length;
  59117. var lines = source.split(/\r?\n/);
  59118. var count = 0;
  59119. var res = [];
  59120. for (var i = 0; i < lines.length; i++) {
  59121. count += lines[i].length + 1;
  59122. if (count >= start) {
  59123. for (var j = i - range; j <= i + range || end > count; j++) {
  59124. if (j < 0 || j >= lines.length) { continue }
  59125. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59126. var lineLength = lines[j].length;
  59127. if (j === i) {
  59128. // push underline
  59129. var pad = start - (count - lineLength) + 1;
  59130. var length = end > count ? lineLength - pad : end - start;
  59131. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59132. } else if (j > i) {
  59133. if (end > count) {
  59134. var length$1 = Math.min(end - count, lineLength);
  59135. res.push(" | " + repeat$1("^", length$1));
  59136. }
  59137. count += lineLength + 1;
  59138. }
  59139. }
  59140. break
  59141. }
  59142. }
  59143. return res.join('\n')
  59144. }
  59145. function repeat$1 (str, n) {
  59146. var result = '';
  59147. if (n > 0) {
  59148. while (true) { // eslint-disable-line
  59149. if (n & 1) { result += str; }
  59150. n >>>= 1;
  59151. if (n <= 0) { break }
  59152. str += str;
  59153. }
  59154. }
  59155. return result
  59156. }
  59157. /* */
  59158. function createFunction (code, errors) {
  59159. try {
  59160. return new Function(code)
  59161. } catch (err) {
  59162. errors.push({ err: err, code: code });
  59163. return noop
  59164. }
  59165. }
  59166. function createCompileToFunctionFn (compile) {
  59167. var cache = Object.create(null);
  59168. return function compileToFunctions (
  59169. template,
  59170. options,
  59171. vm
  59172. ) {
  59173. options = extend({}, options);
  59174. var warn$$1 = options.warn || warn;
  59175. delete options.warn;
  59176. /* istanbul ignore if */
  59177. {
  59178. // detect possible CSP restriction
  59179. try {
  59180. new Function('return 1');
  59181. } catch (e) {
  59182. if (e.toString().match(/unsafe-eval|CSP/)) {
  59183. warn$$1(
  59184. 'It seems you are using the standalone build of Vue.js in an ' +
  59185. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59186. 'The template compiler cannot work in this environment. Consider ' +
  59187. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59188. 'templates into render functions.'
  59189. );
  59190. }
  59191. }
  59192. }
  59193. // check cache
  59194. var key = options.delimiters
  59195. ? String(options.delimiters) + template
  59196. : template;
  59197. if (cache[key]) {
  59198. return cache[key]
  59199. }
  59200. // compile
  59201. var compiled = compile(template, options);
  59202. // check compilation errors/tips
  59203. {
  59204. if (compiled.errors && compiled.errors.length) {
  59205. if (options.outputSourceRange) {
  59206. compiled.errors.forEach(function (e) {
  59207. warn$$1(
  59208. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59209. generateCodeFrame(template, e.start, e.end),
  59210. vm
  59211. );
  59212. });
  59213. } else {
  59214. warn$$1(
  59215. "Error compiling template:\n\n" + template + "\n\n" +
  59216. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59217. vm
  59218. );
  59219. }
  59220. }
  59221. if (compiled.tips && compiled.tips.length) {
  59222. if (options.outputSourceRange) {
  59223. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59224. } else {
  59225. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59226. }
  59227. }
  59228. }
  59229. // turn code into functions
  59230. var res = {};
  59231. var fnGenErrors = [];
  59232. res.render = createFunction(compiled.render, fnGenErrors);
  59233. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59234. return createFunction(code, fnGenErrors)
  59235. });
  59236. // check function generation errors.
  59237. // this should only happen if there is a bug in the compiler itself.
  59238. // mostly for codegen development use
  59239. /* istanbul ignore if */
  59240. {
  59241. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59242. warn$$1(
  59243. "Failed to generate render function:\n\n" +
  59244. fnGenErrors.map(function (ref) {
  59245. var err = ref.err;
  59246. var code = ref.code;
  59247. return ((err.toString()) + " in\n\n" + code + "\n");
  59248. }).join('\n'),
  59249. vm
  59250. );
  59251. }
  59252. }
  59253. return (cache[key] = res)
  59254. }
  59255. }
  59256. /* */
  59257. function createCompilerCreator (baseCompile) {
  59258. return function createCompiler (baseOptions) {
  59259. function compile (
  59260. template,
  59261. options
  59262. ) {
  59263. var finalOptions = Object.create(baseOptions);
  59264. var errors = [];
  59265. var tips = [];
  59266. var warn = function (msg, range, tip) {
  59267. (tip ? tips : errors).push(msg);
  59268. };
  59269. if (options) {
  59270. if (options.outputSourceRange) {
  59271. // $flow-disable-line
  59272. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59273. warn = function (msg, range, tip) {
  59274. var data = { msg: msg };
  59275. if (range) {
  59276. if (range.start != null) {
  59277. data.start = range.start + leadingSpaceLength;
  59278. }
  59279. if (range.end != null) {
  59280. data.end = range.end + leadingSpaceLength;
  59281. }
  59282. }
  59283. (tip ? tips : errors).push(data);
  59284. };
  59285. }
  59286. // merge custom modules
  59287. if (options.modules) {
  59288. finalOptions.modules =
  59289. (baseOptions.modules || []).concat(options.modules);
  59290. }
  59291. // merge custom directives
  59292. if (options.directives) {
  59293. finalOptions.directives = extend(
  59294. Object.create(baseOptions.directives || null),
  59295. options.directives
  59296. );
  59297. }
  59298. // copy other options
  59299. for (var key in options) {
  59300. if (key !== 'modules' && key !== 'directives') {
  59301. finalOptions[key] = options[key];
  59302. }
  59303. }
  59304. }
  59305. finalOptions.warn = warn;
  59306. var compiled = baseCompile(template.trim(), finalOptions);
  59307. {
  59308. detectErrors(compiled.ast, warn);
  59309. }
  59310. compiled.errors = errors;
  59311. compiled.tips = tips;
  59312. return compiled
  59313. }
  59314. return {
  59315. compile: compile,
  59316. compileToFunctions: createCompileToFunctionFn(compile)
  59317. }
  59318. }
  59319. }
  59320. /* */
  59321. // `createCompilerCreator` allows creating compilers that use alternative
  59322. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  59323. // Here we just export a default compiler using the default parts.
  59324. var createCompiler = createCompilerCreator(function baseCompile (
  59325. template,
  59326. options
  59327. ) {
  59328. var ast = parse(template.trim(), options);
  59329. if (options.optimize !== false) {
  59330. optimize(ast, options);
  59331. }
  59332. var code = generate(ast, options);
  59333. return {
  59334. ast: ast,
  59335. render: code.render,
  59336. staticRenderFns: code.staticRenderFns
  59337. }
  59338. });
  59339. /* */
  59340. var ref$1 = createCompiler(baseOptions);
  59341. var compile = ref$1.compile;
  59342. var compileToFunctions = ref$1.compileToFunctions;
  59343. /* */
  59344. // check whether current browser encodes a char inside attribute values
  59345. var div;
  59346. function getShouldDecode (href) {
  59347. div = div || document.createElement('div');
  59348. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  59349. return div.innerHTML.indexOf('&#10;') > 0
  59350. }
  59351. // #3663: IE encodes newlines inside attribute values while other browsers don't
  59352. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  59353. // #6828: chrome encodes content in a[href]
  59354. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  59355. /* */
  59356. var idToTemplate = cached(function (id) {
  59357. var el = query(id);
  59358. return el && el.innerHTML
  59359. });
  59360. var mount = Vue.prototype.$mount;
  59361. Vue.prototype.$mount = function (
  59362. el,
  59363. hydrating
  59364. ) {
  59365. el = el && query(el);
  59366. /* istanbul ignore if */
  59367. if (el === document.body || el === document.documentElement) {
  59368. warn(
  59369. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  59370. );
  59371. return this
  59372. }
  59373. var options = this.$options;
  59374. // resolve template/el and convert to render function
  59375. if (!options.render) {
  59376. var template = options.template;
  59377. if (template) {
  59378. if (typeof template === 'string') {
  59379. if (template.charAt(0) === '#') {
  59380. template = idToTemplate(template);
  59381. /* istanbul ignore if */
  59382. if (!template) {
  59383. warn(
  59384. ("Template element not found or is empty: " + (options.template)),
  59385. this
  59386. );
  59387. }
  59388. }
  59389. } else if (template.nodeType) {
  59390. template = template.innerHTML;
  59391. } else {
  59392. {
  59393. warn('invalid template option:' + template, this);
  59394. }
  59395. return this
  59396. }
  59397. } else if (el) {
  59398. template = getOuterHTML(el);
  59399. }
  59400. if (template) {
  59401. /* istanbul ignore if */
  59402. if (config.performance && mark) {
  59403. mark('compile');
  59404. }
  59405. var ref = compileToFunctions(template, {
  59406. outputSourceRange: "development" !== 'production',
  59407. shouldDecodeNewlines: shouldDecodeNewlines,
  59408. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  59409. delimiters: options.delimiters,
  59410. comments: options.comments
  59411. }, this);
  59412. var render = ref.render;
  59413. var staticRenderFns = ref.staticRenderFns;
  59414. options.render = render;
  59415. options.staticRenderFns = staticRenderFns;
  59416. /* istanbul ignore if */
  59417. if (config.performance && mark) {
  59418. mark('compile end');
  59419. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  59420. }
  59421. }
  59422. }
  59423. return mount.call(this, el, hydrating)
  59424. };
  59425. /**
  59426. * Get outerHTML of elements, taking care
  59427. * of SVG elements in IE as well.
  59428. */
  59429. function getOuterHTML (el) {
  59430. if (el.outerHTML) {
  59431. return el.outerHTML
  59432. } else {
  59433. var container = document.createElement('div');
  59434. container.appendChild(el.cloneNode(true));
  59435. return container.innerHTML
  59436. }
  59437. }
  59438. Vue.compile = compileToFunctions;
  59439. module.exports = Vue;
  59440. /* 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))
  59441. /***/ }),
  59442. /***/ "./node_modules/vue/dist/vue.common.js":
  59443. /*!*********************************************!*\
  59444. !*** ./node_modules/vue/dist/vue.common.js ***!
  59445. \*********************************************/
  59446. /*! no static exports found */
  59447. /***/ (function(module, exports, __webpack_require__) {
  59448. if (false) {} else {
  59449. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  59450. }
  59451. /***/ }),
  59452. /***/ "./node_modules/webpack/buildin/global.js":
  59453. /*!***********************************!*\
  59454. !*** (webpack)/buildin/global.js ***!
  59455. \***********************************/
  59456. /*! no static exports found */
  59457. /***/ (function(module, exports) {
  59458. var g;
  59459. // This works in non-strict mode
  59460. g = (function() {
  59461. return this;
  59462. })();
  59463. try {
  59464. // This works if eval is allowed (see CSP)
  59465. g = g || new Function("return this")();
  59466. } catch (e) {
  59467. // This works if the window reference is available
  59468. if (typeof window === "object") g = window;
  59469. }
  59470. // g can still be undefined, but nothing to do about it...
  59471. // We return undefined, instead of nothing here, so it's
  59472. // easier to handle this case. if(!global) { ...}
  59473. module.exports = g;
  59474. /***/ }),
  59475. /***/ "./node_modules/webpack/buildin/module.js":
  59476. /*!***********************************!*\
  59477. !*** (webpack)/buildin/module.js ***!
  59478. \***********************************/
  59479. /*! no static exports found */
  59480. /***/ (function(module, exports) {
  59481. module.exports = function(module) {
  59482. if (!module.webpackPolyfill) {
  59483. module.deprecate = function() {};
  59484. module.paths = [];
  59485. // module.parent = undefined by default
  59486. if (!module.children) module.children = [];
  59487. Object.defineProperty(module, "loaded", {
  59488. enumerable: true,
  59489. get: function() {
  59490. return module.l;
  59491. }
  59492. });
  59493. Object.defineProperty(module, "id", {
  59494. enumerable: true,
  59495. get: function() {
  59496. return module.i;
  59497. }
  59498. });
  59499. module.webpackPolyfill = 1;
  59500. }
  59501. return module;
  59502. };
  59503. /***/ }),
  59504. /***/ "./resources/js/app.js":
  59505. /*!*****************************!*\
  59506. !*** ./resources/js/app.js ***!
  59507. \*****************************/
  59508. /*! no exports provided */
  59509. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59510. "use strict";
  59511. __webpack_require__.r(__webpack_exports__);
  59512. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  59513. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  59514. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  59515. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  59516. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  59517. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  59518. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  59519. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  59520. /**
  59521. * First we will load all of this project's JavaScript dependencies which
  59522. * includes Vue and other libraries. It is a great starting point when
  59523. * building robust, powerful web applications using Vue and Laravel.
  59524. */
  59525. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  59526. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  59527. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  59528. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  59529. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  59530. mode: 'history',
  59531. routes: [{
  59532. path: '/',
  59533. name: 'home',
  59534. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  59535. }, {
  59536. path: '/login',
  59537. name: 'login',
  59538. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  59539. }, {
  59540. path: '/dashboard',
  59541. name: 'dashboard',
  59542. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  59543. }, {
  59544. path: '/workorders/:id',
  59545. name: 'workorders',
  59546. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  59547. props: true
  59548. }]
  59549. });
  59550. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  59551. el: '#app',
  59552. components: {
  59553. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  59554. },
  59555. router: router
  59556. });
  59557. $(function () {
  59558. $('[data-toggle="tooltip"]').tooltip();
  59559. });
  59560. var clipboard = new Clipboard('.btn-clip');
  59561. clipboard.on('success', function (e) {
  59562. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  59563. position: "right",
  59564. className: 'success'
  59565. });
  59566. e.clearSelection();
  59567. });
  59568. /***/ }),
  59569. /***/ "./resources/js/bootstrap.js":
  59570. /*!***********************************!*\
  59571. !*** ./resources/js/bootstrap.js ***!
  59572. \***********************************/
  59573. /*! no exports provided */
  59574. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59575. "use strict";
  59576. __webpack_require__.r(__webpack_exports__);
  59577. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  59578. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  59579. /**
  59580. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  59581. * for JavaScript based Bootstrap features such as modals and tabs. This
  59582. * code may be modified to fit the specific needs of your application.
  59583. */
  59584. try {
  59585. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  59586. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  59587. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  59588. } catch (e) {}
  59589. /**
  59590. * We'll load the axios HTTP library which allows us to easily issue requests
  59591. * to our Laravel back-end. This library automatically handles sending the
  59592. * CSRF token as a header based on the value of the "XSRF" token cookie.
  59593. */
  59594. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  59595. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  59596. /**
  59597. * Echo exposes an expressive API for subscribing to channels and listening
  59598. * for events that are broadcast by Laravel. Echo and event broadcasting
  59599. * allows your team to easily build robust real-time web applications.
  59600. */
  59601. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  59602. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  59603. broadcaster: 'pusher',
  59604. key: "upccrt",
  59605. authEndpoint: '/broadcasting/auth',
  59606. wsHost: window.location.hostname,
  59607. wsPort: 6001,
  59608. disableStats: true
  59609. });
  59610. /***/ }),
  59611. /***/ "./resources/js/components/AssetInfo.vue":
  59612. /*!***********************************************!*\
  59613. !*** ./resources/js/components/AssetInfo.vue ***!
  59614. \***********************************************/
  59615. /*! exports provided: default */
  59616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59617. "use strict";
  59618. __webpack_require__.r(__webpack_exports__);
  59619. /* 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&");
  59620. /* 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&");
  59621. /* 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");
  59622. /* normalize component */
  59623. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59624. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59625. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  59626. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59627. false,
  59628. null,
  59629. null,
  59630. null
  59631. )
  59632. /* hot reload */
  59633. if (false) { var api; }
  59634. component.options.__file = "resources/js/components/AssetInfo.vue"
  59635. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59636. /***/ }),
  59637. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  59638. /*!************************************************************************!*\
  59639. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  59640. \************************************************************************/
  59641. /*! exports provided: default */
  59642. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59643. "use strict";
  59644. __webpack_require__.r(__webpack_exports__);
  59645. /* 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&");
  59646. /* 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"]);
  59647. /***/ }),
  59648. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  59649. /*!******************************************************************************!*\
  59650. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  59651. \******************************************************************************/
  59652. /*! exports provided: render, staticRenderFns */
  59653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59654. "use strict";
  59655. __webpack_require__.r(__webpack_exports__);
  59656. /* 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&");
  59657. /* 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"]; });
  59658. /* 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"]; });
  59659. /***/ }),
  59660. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  59661. /*!********************************************************!*\
  59662. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  59663. \********************************************************/
  59664. /*! exports provided: default */
  59665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59666. "use strict";
  59667. __webpack_require__.r(__webpack_exports__);
  59668. /* 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&");
  59669. /* 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&");
  59670. /* 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");
  59671. /* normalize component */
  59672. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59673. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59674. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  59675. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59676. false,
  59677. null,
  59678. null,
  59679. null
  59680. )
  59681. /* hot reload */
  59682. if (false) { var api; }
  59683. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  59684. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59685. /***/ }),
  59686. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  59687. /*!*********************************************************************************!*\
  59688. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  59689. \*********************************************************************************/
  59690. /*! exports provided: default */
  59691. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59692. "use strict";
  59693. __webpack_require__.r(__webpack_exports__);
  59694. /* 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&");
  59695. /* 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"]);
  59696. /***/ }),
  59697. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  59698. /*!***************************************************************************************!*\
  59699. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  59700. \***************************************************************************************/
  59701. /*! exports provided: render, staticRenderFns */
  59702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59703. "use strict";
  59704. __webpack_require__.r(__webpack_exports__);
  59705. /* 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&");
  59706. /* 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"]; });
  59707. /* 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"]; });
  59708. /***/ }),
  59709. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  59710. /*!****************************************************************!*\
  59711. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  59712. \****************************************************************/
  59713. /*! exports provided: default */
  59714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59715. "use strict";
  59716. __webpack_require__.r(__webpack_exports__);
  59717. /* 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&");
  59718. /* 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&");
  59719. /* 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");
  59720. /* normalize component */
  59721. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59722. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59723. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  59724. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59725. false,
  59726. null,
  59727. null,
  59728. null
  59729. )
  59730. /* hot reload */
  59731. if (false) { var api; }
  59732. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  59733. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59734. /***/ }),
  59735. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  59736. /*!*****************************************************************************************!*\
  59737. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  59738. \*****************************************************************************************/
  59739. /*! exports provided: default */
  59740. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59741. "use strict";
  59742. __webpack_require__.r(__webpack_exports__);
  59743. /* 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&");
  59744. /* 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"]);
  59745. /***/ }),
  59746. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  59747. /*!***********************************************************************************************!*\
  59748. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  59749. \***********************************************************************************************/
  59750. /*! exports provided: render, staticRenderFns */
  59751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59752. "use strict";
  59753. __webpack_require__.r(__webpack_exports__);
  59754. /* 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&");
  59755. /* 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"]; });
  59756. /* 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"]; });
  59757. /***/ }),
  59758. /***/ "./resources/js/components/CircleSpinner.vue":
  59759. /*!***************************************************!*\
  59760. !*** ./resources/js/components/CircleSpinner.vue ***!
  59761. \***************************************************/
  59762. /*! no static exports found */
  59763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59764. "use strict";
  59765. __webpack_require__.r(__webpack_exports__);
  59766. /* 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&");
  59767. /* 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&");
  59768. /* 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__));
  59769. /* 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&");
  59770. /* 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");
  59771. /* normalize component */
  59772. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  59773. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59774. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  59775. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59776. false,
  59777. null,
  59778. "9a543b64",
  59779. null
  59780. )
  59781. /* hot reload */
  59782. if (false) { var api; }
  59783. component.options.__file = "resources/js/components/CircleSpinner.vue"
  59784. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59785. /***/ }),
  59786. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  59787. /*!****************************************************************************!*\
  59788. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  59789. \****************************************************************************/
  59790. /*! no static exports found */
  59791. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59792. "use strict";
  59793. __webpack_require__.r(__webpack_exports__);
  59794. /* 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&");
  59795. /* 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"]);
  59796. /***/ }),
  59797. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  59798. /*!************************************************************************************************************!*\
  59799. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  59800. \************************************************************************************************************/
  59801. /*! no static exports found */
  59802. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59803. "use strict";
  59804. __webpack_require__.r(__webpack_exports__);
  59805. /* 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&");
  59806. /* 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__);
  59807. /* 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__));
  59808. /* 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);
  59809. /***/ }),
  59810. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  59811. /*!**********************************************************************************************!*\
  59812. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  59813. \**********************************************************************************************/
  59814. /*! exports provided: render, staticRenderFns */
  59815. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59816. "use strict";
  59817. __webpack_require__.r(__webpack_exports__);
  59818. /* 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&");
  59819. /* 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"]; });
  59820. /* 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"]; });
  59821. /***/ }),
  59822. /***/ "./resources/js/components/Credential.vue":
  59823. /*!************************************************!*\
  59824. !*** ./resources/js/components/Credential.vue ***!
  59825. \************************************************/
  59826. /*! exports provided: default */
  59827. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59828. "use strict";
  59829. __webpack_require__.r(__webpack_exports__);
  59830. /* harmony import */ var _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Credential.vue?vue&type=template&id=58b8dcfc& */ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  59831. /* harmony import */ var _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Credential.vue?vue&type=script&lang=js& */ "./resources/js/components/Credential.vue?vue&type=script&lang=js&");
  59832. /* 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");
  59833. /* normalize component */
  59834. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59835. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59836. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  59837. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59838. false,
  59839. null,
  59840. null,
  59841. null
  59842. )
  59843. /* hot reload */
  59844. if (false) { var api; }
  59845. component.options.__file = "resources/js/components/Credential.vue"
  59846. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59847. /***/ }),
  59848. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  59849. /*!*************************************************************************!*\
  59850. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  59851. \*************************************************************************/
  59852. /*! exports provided: default */
  59853. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59854. "use strict";
  59855. __webpack_require__.r(__webpack_exports__);
  59856. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./Credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&");
  59857. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59858. /***/ }),
  59859. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  59860. /*!*******************************************************************************!*\
  59861. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  59862. \*******************************************************************************/
  59863. /*! exports provided: render, staticRenderFns */
  59864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59865. "use strict";
  59866. __webpack_require__.r(__webpack_exports__);
  59867. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./Credential.vue?vue&type=template&id=58b8dcfc& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  59868. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59869. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59870. /***/ }),
  59871. /***/ "./resources/js/components/CredentialFormModal.vue":
  59872. /*!*********************************************************!*\
  59873. !*** ./resources/js/components/CredentialFormModal.vue ***!
  59874. \*********************************************************/
  59875. /*! exports provided: default */
  59876. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59877. "use strict";
  59878. __webpack_require__.r(__webpack_exports__);
  59879. /* harmony import */ var _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  59880. /* harmony import */ var _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  59881. /* 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");
  59882. /* normalize component */
  59883. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59884. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59885. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  59886. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59887. false,
  59888. null,
  59889. null,
  59890. null
  59891. )
  59892. /* hot reload */
  59893. if (false) { var api; }
  59894. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  59895. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59896. /***/ }),
  59897. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  59898. /*!**********************************************************************************!*\
  59899. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  59900. \**********************************************************************************/
  59901. /*! exports provided: default */
  59902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59903. "use strict";
  59904. __webpack_require__.r(__webpack_exports__);
  59905. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_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!./CredentialFormModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  59906. /* 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_CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59907. /***/ }),
  59908. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  59909. /*!****************************************************************************************!*\
  59910. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  59911. \****************************************************************************************/
  59912. /*! exports provided: render, staticRenderFns */
  59913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59914. "use strict";
  59915. __webpack_require__.r(__webpack_exports__);
  59916. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_vue_vue_type_template_id_3cdb3697___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!./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  59917. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59918. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59919. /***/ }),
  59920. /***/ "./resources/js/components/CredentialList.vue":
  59921. /*!****************************************************!*\
  59922. !*** ./resources/js/components/CredentialList.vue ***!
  59923. \****************************************************/
  59924. /*! exports provided: default */
  59925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59926. "use strict";
  59927. __webpack_require__.r(__webpack_exports__);
  59928. /* harmony import */ var _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=template&id=7264bb80& */ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  59929. /* harmony import */ var _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  59930. /* 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");
  59931. /* normalize component */
  59932. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59933. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59934. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  59935. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59936. false,
  59937. null,
  59938. null,
  59939. null
  59940. )
  59941. /* hot reload */
  59942. if (false) { var api; }
  59943. component.options.__file = "resources/js/components/CredentialList.vue"
  59944. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59945. /***/ }),
  59946. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  59947. /*!*****************************************************************************!*\
  59948. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  59949. \*****************************************************************************/
  59950. /*! exports provided: default */
  59951. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59952. "use strict";
  59953. __webpack_require__.r(__webpack_exports__);
  59954. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_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!./CredentialList.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  59955. /* 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_CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59956. /***/ }),
  59957. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  59958. /*!***********************************************************************************!*\
  59959. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  59960. \***********************************************************************************/
  59961. /*! exports provided: render, staticRenderFns */
  59962. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59963. "use strict";
  59964. __webpack_require__.r(__webpack_exports__);
  59965. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_vue_vue_type_template_id_7264bb80___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!./CredentialList.vue?vue&type=template&id=7264bb80& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  59966. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59967. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59968. /***/ }),
  59969. /***/ "./resources/js/components/Modal.vue":
  59970. /*!*******************************************!*\
  59971. !*** ./resources/js/components/Modal.vue ***!
  59972. \*******************************************/
  59973. /*! exports provided: default */
  59974. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59975. "use strict";
  59976. __webpack_require__.r(__webpack_exports__);
  59977. /* 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&");
  59978. /* 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");
  59979. var script = {}
  59980. /* normalize component */
  59981. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  59982. script,
  59983. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59984. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59985. false,
  59986. null,
  59987. null,
  59988. null
  59989. )
  59990. /* hot reload */
  59991. if (false) { var api; }
  59992. component.options.__file = "resources/js/components/Modal.vue"
  59993. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59994. /***/ }),
  59995. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  59996. /*!**************************************************************************!*\
  59997. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  59998. \**************************************************************************/
  59999. /*! exports provided: render, staticRenderFns */
  60000. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60001. "use strict";
  60002. __webpack_require__.r(__webpack_exports__);
  60003. /* 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&");
  60004. /* 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"]; });
  60005. /* 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"]; });
  60006. /***/ }),
  60007. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60008. /*!*****************************************************!*\
  60009. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60010. \*****************************************************/
  60011. /*! exports provided: default */
  60012. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60013. "use strict";
  60014. __webpack_require__.r(__webpack_exports__);
  60015. /* 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&");
  60016. /* 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&");
  60017. /* 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");
  60018. /* normalize component */
  60019. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60020. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60021. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60022. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60023. false,
  60024. null,
  60025. null,
  60026. null
  60027. )
  60028. /* hot reload */
  60029. if (false) { var api; }
  60030. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60031. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60032. /***/ }),
  60033. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60034. /*!******************************************************************************!*\
  60035. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60036. \******************************************************************************/
  60037. /*! exports provided: default */
  60038. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60039. "use strict";
  60040. __webpack_require__.r(__webpack_exports__);
  60041. /* 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&");
  60042. /* 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"]);
  60043. /***/ }),
  60044. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60045. /*!************************************************************************************!*\
  60046. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60047. \************************************************************************************/
  60048. /*! exports provided: render, staticRenderFns */
  60049. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60050. "use strict";
  60051. __webpack_require__.r(__webpack_exports__);
  60052. /* 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&");
  60053. /* 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"]; });
  60054. /* 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"]; });
  60055. /***/ }),
  60056. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60057. /*!***************************************************!*\
  60058. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60059. \***************************************************/
  60060. /*! exports provided: default */
  60061. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60062. "use strict";
  60063. __webpack_require__.r(__webpack_exports__);
  60064. /* 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&");
  60065. /* 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&");
  60066. /* 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");
  60067. /* normalize component */
  60068. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60069. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60070. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60071. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60072. false,
  60073. null,
  60074. null,
  60075. null
  60076. )
  60077. /* hot reload */
  60078. if (false) { var api; }
  60079. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60080. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60081. /***/ }),
  60082. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60083. /*!****************************************************************************!*\
  60084. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60085. \****************************************************************************/
  60086. /*! exports provided: default */
  60087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60088. "use strict";
  60089. __webpack_require__.r(__webpack_exports__);
  60090. /* 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&");
  60091. /* 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"]);
  60092. /***/ }),
  60093. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60094. /*!**********************************************************************************!*\
  60095. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60096. \**********************************************************************************/
  60097. /*! exports provided: render, staticRenderFns */
  60098. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60099. "use strict";
  60100. __webpack_require__.r(__webpack_exports__);
  60101. /* 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&");
  60102. /* 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"]; });
  60103. /* 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"]; });
  60104. /***/ }),
  60105. /***/ "./resources/js/mixins/dateMixin.js":
  60106. /*!******************************************!*\
  60107. !*** ./resources/js/mixins/dateMixin.js ***!
  60108. \******************************************/
  60109. /*! exports provided: default */
  60110. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60111. "use strict";
  60112. __webpack_require__.r(__webpack_exports__);
  60113. /* harmony default export */ __webpack_exports__["default"] = ({
  60114. methods: {
  60115. treatAsUTC: function treatAsUTC(date) {
  60116. var result = new Date(date);
  60117. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60118. return result;
  60119. },
  60120. daysSinceToday: function daysSinceToday(date) {
  60121. var currentDate = new Date();
  60122. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60123. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60124. },
  60125. getHRDate: function getHRDate(dateString) {
  60126. var date = new Date(dateString);
  60127. return date.toLocaleString('default', {
  60128. month: 'short',
  60129. day: 'numeric',
  60130. year: 'numeric',
  60131. hour: 'numeric',
  60132. minute: 'numeric'
  60133. });
  60134. },
  60135. isZero: function isZero(dateString) {
  60136. return dateString === '0000-00-00 00:00:00';
  60137. }
  60138. }
  60139. });
  60140. /***/ }),
  60141. /***/ "./resources/js/notify.min.js":
  60142. /*!************************************!*\
  60143. !*** ./resources/js/notify.min.js ***!
  60144. \************************************/
  60145. /*! no static exports found */
  60146. /***/ (function(module, exports, __webpack_require__) {
  60147. 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); }
  60148. (function (e) {
  60149. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60150. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60151. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60152. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60153. })(function (e) {
  60154. function A(t, n, i) {
  60155. typeof i == "string" && (i = {
  60156. className: i
  60157. }), 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);
  60158. }
  60159. var t = [].indexOf || function (e) {
  60160. for (var t = 0, n = this.length; t < n; t++) {
  60161. if (t in this && this[t] === e) return t;
  60162. }
  60163. return -1;
  60164. },
  60165. n = "notify",
  60166. r = n + "js",
  60167. i = n + "!blank",
  60168. s = {
  60169. t: "top",
  60170. m: "middle",
  60171. b: "bottom",
  60172. l: "left",
  60173. c: "center",
  60174. r: "right"
  60175. },
  60176. o = ["l", "c", "r"],
  60177. u = ["t", "m", "b"],
  60178. a = ["t", "b", "l", "r"],
  60179. f = {
  60180. t: "b",
  60181. m: null,
  60182. b: "t",
  60183. l: "r",
  60184. c: null,
  60185. r: "l"
  60186. },
  60187. l = function l(t) {
  60188. var n;
  60189. return n = [], e.each(t.split(/\W+/), function (e, t) {
  60190. var r;
  60191. r = t.toLowerCase().charAt(0);
  60192. if (s[r]) return n.push(r);
  60193. }), n;
  60194. },
  60195. c = {},
  60196. h = {
  60197. name: "core",
  60198. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  60199. 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}"
  60200. },
  60201. p = {
  60202. "border-radius": ["-webkit-", "-moz-"]
  60203. },
  60204. d = function d(e) {
  60205. return c[e];
  60206. },
  60207. v = function v(e) {
  60208. if (!e) throw "Missing Style name";
  60209. c[e] && delete c[e];
  60210. },
  60211. m = function m(t, i) {
  60212. if (!t) throw "Missing Style name";
  60213. if (!i) throw "Missing Style definition";
  60214. if (!i.html) throw "Missing Style HTML";
  60215. var s = c[t];
  60216. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  60217. var o = "";
  60218. i.classes && e.each(i.classes, function (t, n) {
  60219. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  60220. return p[t] && e.each(p[t], function (e, r) {
  60221. return o += " " + r + t + ": " + n + ";\n";
  60222. }), o += " " + t + ": " + n + ";\n";
  60223. }), o += "}\n";
  60224. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  60225. var u = {},
  60226. a = e(i.html);
  60227. y("html", a, u), y("text", a, u), i.fields = u;
  60228. },
  60229. g = function g(t) {
  60230. var n, r, i;
  60231. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  60232. try {
  60233. r.html(t);
  60234. } catch (s) {
  60235. r[0].styleSheet.cssText = t;
  60236. }
  60237. return r;
  60238. },
  60239. y = function y(t, n, r) {
  60240. var s;
  60241. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  60242. var n;
  60243. n = e(this).attr(s), n || (n = i), r[n] = t;
  60244. });
  60245. },
  60246. b = function b(e, t) {
  60247. return e.is(t) ? e : e.find(t);
  60248. },
  60249. w = {
  60250. clickToHide: !0,
  60251. autoHide: !0,
  60252. autoHideDelay: 5e3,
  60253. arrowShow: !0,
  60254. arrowSize: 5,
  60255. breakNewLines: !0,
  60256. elementPosition: "bottom",
  60257. globalPosition: "top right",
  60258. style: "bootstrap",
  60259. className: "error",
  60260. showAnimation: "slideDown",
  60261. showDuration: 400,
  60262. hideAnimation: "slideUp",
  60263. hideDuration: 200,
  60264. gap: 5
  60265. },
  60266. E = function E(t, n) {
  60267. var r;
  60268. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  60269. },
  60270. S = function S(t) {
  60271. return e.extend(w, t);
  60272. },
  60273. x = function x(t) {
  60274. return e("<" + t + "></" + t + ">");
  60275. },
  60276. T = {},
  60277. N = function N(t) {
  60278. var n;
  60279. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  60280. return e(r).attr("name") === t.attr("name");
  60281. }), t = n.first()), t;
  60282. },
  60283. C = function C(e, t, n) {
  60284. var r, i;
  60285. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  60286. if (isNaN(n)) return;
  60287. 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;
  60288. },
  60289. k = function k(e, t, n) {
  60290. if (e === "l" || e === "t") return 0;
  60291. if (e === "c" || e === "m") return n / 2 - t / 2;
  60292. if (e === "r" || e === "b") return n - t;
  60293. throw "Invalid alignment";
  60294. },
  60295. L = function L(e) {
  60296. return L.e = L.e || x("div"), L.e.text(e).html();
  60297. };
  60298. A.prototype.loadHTML = function () {
  60299. var t;
  60300. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  60301. }, A.prototype.show = function (e, t) {
  60302. var n, r, i, s, o;
  60303. r = function (n) {
  60304. return function () {
  60305. !e && !n.elem && n.destroy();
  60306. if (t) return t();
  60307. };
  60308. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  60309. 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 {
  60310. if (!!o || !!e) return r();
  60311. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  60312. }
  60313. return n.push(r), i[s].apply(i, n);
  60314. }, A.prototype.setGlobalPosition = function () {
  60315. var t = this.getPosition(),
  60316. n = t[0],
  60317. i = t[1],
  60318. o = s[n],
  60319. u = s[i],
  60320. a = n + "|" + i,
  60321. f = T[a];
  60322. if (!f || !document.body.contains(f[0])) {
  60323. f = T[a] = x("div");
  60324. var l = {};
  60325. 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);
  60326. }
  60327. return f.prepend(this.wrapper);
  60328. }, A.prototype.setElementPosition = function () {
  60329. 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;
  60330. 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"];
  60331. for (w = 0, S = B.length; w < S; w++) {
  60332. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  60333. }
  60334. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  60335. if (!this.options.arrowShow) this.arrow.hide();else {
  60336. 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";
  60337. for (E = 0, x = a.length; E < x; E++) {
  60338. D = a[E], P = s[D];
  60339. if (D === L) continue;
  60340. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  60341. }
  60342. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  60343. }
  60344. 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);
  60345. if (r) return this.arrow.removeAttr("style").css(r);
  60346. }, A.prototype.getPosition = function () {
  60347. var e, n, r, i, s, f, c, h;
  60348. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  60349. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  60350. 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";
  60351. return e.length === 2 && (e[2] = e[1]), e;
  60352. }, A.prototype.getStyle = function (e) {
  60353. var t;
  60354. e || (e = this.options.style), e || (e = "default"), t = c[e];
  60355. if (!t) throw "Missing style: " + e;
  60356. return t;
  60357. }, A.prototype.updateClasses = function () {
  60358. var t, n;
  60359. 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) {
  60360. return r + "-" + n.name + "-" + e;
  60361. }).join(" "), this.userContainer.attr("class", t);
  60362. }, A.prototype.run = function (t, n) {
  60363. var r, s, o, u, a;
  60364. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  60365. if (this.container && !t) {
  60366. this.show(!1);
  60367. return;
  60368. }
  60369. if (!this.container && !t) return;
  60370. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  60371. for (o in s) {
  60372. r = s[o], u = this.userFields[o];
  60373. if (!u) continue;
  60374. 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);
  60375. }
  60376. 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));
  60377. }, A.prototype.destroy = function () {
  60378. this.wrapper.data(r, null), this.wrapper.remove();
  60379. }, e[n] = function (t, r, i) {
  60380. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  60381. }, e.fn[n] = function (t, n) {
  60382. return e(this).each(function () {
  60383. var i = N(e(this)).data(r);
  60384. i && i.destroy();
  60385. var s = new A(e(this), t, n);
  60386. }), this;
  60387. }, e.extend(e[n], {
  60388. defaults: S,
  60389. addStyle: m,
  60390. removeStyle: v,
  60391. pluginOptions: w,
  60392. getStyle: d,
  60393. insertCSS: g
  60394. }), m("bootstrap", {
  60395. html: "<div>\n<span data-notify-text></span>\n</div>",
  60396. classes: {
  60397. base: {
  60398. "font-weight": "bold",
  60399. padding: "8px 15px 8px 14px",
  60400. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  60401. "background-color": "#fcf8e3",
  60402. border: "1px solid #fbeed5",
  60403. "border-radius": "4px",
  60404. "white-space": "nowrap",
  60405. "padding-left": "25px",
  60406. "background-repeat": "no-repeat",
  60407. "background-position": "3px 7px"
  60408. },
  60409. error: {
  60410. color: "#B94A48",
  60411. "background-color": "#F2DEDE",
  60412. "border-color": "#EED3D7",
  60413. "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=)"
  60414. },
  60415. success: {
  60416. color: "#468847",
  60417. "background-color": "#DFF0D8",
  60418. "border-color": "#D6E9C6",
  60419. "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==)"
  60420. },
  60421. info: {
  60422. color: "#3A87AD",
  60423. "background-color": "#D9EDF7",
  60424. "border-color": "#BCE8F1",
  60425. "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=)"
  60426. },
  60427. warn: {
  60428. color: "#C09853",
  60429. "background-color": "#FCF8E3",
  60430. "border-color": "#FBEED5",
  60431. "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)"
  60432. }
  60433. }
  60434. }), e(function () {
  60435. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  60436. e(this).trigger("notify-hide");
  60437. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  60438. var n = e(this).data(r);
  60439. n && n.show(!1);
  60440. });
  60441. });
  60442. });
  60443. /***/ }),
  60444. /***/ "./resources/js/views/App.vue":
  60445. /*!************************************!*\
  60446. !*** ./resources/js/views/App.vue ***!
  60447. \************************************/
  60448. /*! exports provided: default */
  60449. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60450. "use strict";
  60451. __webpack_require__.r(__webpack_exports__);
  60452. /* 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&");
  60453. /* 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&");
  60454. /* 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");
  60455. /* normalize component */
  60456. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60457. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60458. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60459. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60460. false,
  60461. null,
  60462. null,
  60463. null
  60464. )
  60465. /* hot reload */
  60466. if (false) { var api; }
  60467. component.options.__file = "resources/js/views/App.vue"
  60468. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60469. /***/ }),
  60470. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  60471. /*!*************************************************************!*\
  60472. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  60473. \*************************************************************/
  60474. /*! exports provided: default */
  60475. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60476. "use strict";
  60477. __webpack_require__.r(__webpack_exports__);
  60478. /* 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&");
  60479. /* 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"]);
  60480. /***/ }),
  60481. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  60482. /*!*******************************************************************!*\
  60483. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  60484. \*******************************************************************/
  60485. /*! exports provided: render, staticRenderFns */
  60486. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60487. "use strict";
  60488. __webpack_require__.r(__webpack_exports__);
  60489. /* 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&");
  60490. /* 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"]; });
  60491. /* 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"]; });
  60492. /***/ }),
  60493. /***/ "./resources/js/views/Dashboard.vue":
  60494. /*!******************************************!*\
  60495. !*** ./resources/js/views/Dashboard.vue ***!
  60496. \******************************************/
  60497. /*! exports provided: default */
  60498. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60499. "use strict";
  60500. __webpack_require__.r(__webpack_exports__);
  60501. /* 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&");
  60502. /* 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&");
  60503. /* 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");
  60504. /* normalize component */
  60505. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60506. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60507. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60508. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60509. false,
  60510. null,
  60511. null,
  60512. null
  60513. )
  60514. /* hot reload */
  60515. if (false) { var api; }
  60516. component.options.__file = "resources/js/views/Dashboard.vue"
  60517. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60518. /***/ }),
  60519. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  60520. /*!*******************************************************************!*\
  60521. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  60522. \*******************************************************************/
  60523. /*! exports provided: default */
  60524. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60525. "use strict";
  60526. __webpack_require__.r(__webpack_exports__);
  60527. /* 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&");
  60528. /* 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"]);
  60529. /***/ }),
  60530. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  60531. /*!*************************************************************************!*\
  60532. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  60533. \*************************************************************************/
  60534. /*! exports provided: render, staticRenderFns */
  60535. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60536. "use strict";
  60537. __webpack_require__.r(__webpack_exports__);
  60538. /* 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&");
  60539. /* 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"]; });
  60540. /* 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"]; });
  60541. /***/ }),
  60542. /***/ "./resources/js/views/Login.vue":
  60543. /*!**************************************!*\
  60544. !*** ./resources/js/views/Login.vue ***!
  60545. \**************************************/
  60546. /*! exports provided: default */
  60547. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60548. "use strict";
  60549. __webpack_require__.r(__webpack_exports__);
  60550. /* 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&");
  60551. /* 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&");
  60552. /* 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");
  60553. /* normalize component */
  60554. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60555. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60556. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60557. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60558. false,
  60559. null,
  60560. null,
  60561. null
  60562. )
  60563. /* hot reload */
  60564. if (false) { var api; }
  60565. component.options.__file = "resources/js/views/Login.vue"
  60566. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60567. /***/ }),
  60568. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  60569. /*!***************************************************************!*\
  60570. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  60571. \***************************************************************/
  60572. /*! exports provided: default */
  60573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60574. "use strict";
  60575. __webpack_require__.r(__webpack_exports__);
  60576. /* 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&");
  60577. /* 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"]);
  60578. /***/ }),
  60579. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  60580. /*!*********************************************************************!*\
  60581. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  60582. \*********************************************************************/
  60583. /*! exports provided: render, staticRenderFns */
  60584. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60585. "use strict";
  60586. __webpack_require__.r(__webpack_exports__);
  60587. /* 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&");
  60588. /* 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"]; });
  60589. /* 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"]; });
  60590. /***/ }),
  60591. /***/ "./resources/js/views/Welcome.vue":
  60592. /*!****************************************!*\
  60593. !*** ./resources/js/views/Welcome.vue ***!
  60594. \****************************************/
  60595. /*! exports provided: default */
  60596. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60597. "use strict";
  60598. __webpack_require__.r(__webpack_exports__);
  60599. /* 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&");
  60600. /* 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&");
  60601. /* 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&");
  60602. /* 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");
  60603. /* normalize component */
  60604. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60605. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60606. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60607. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60608. false,
  60609. null,
  60610. "1ae8ae93",
  60611. null
  60612. )
  60613. /* hot reload */
  60614. if (false) { var api; }
  60615. component.options.__file = "resources/js/views/Welcome.vue"
  60616. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60617. /***/ }),
  60618. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  60619. /*!*****************************************************************!*\
  60620. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  60621. \*****************************************************************/
  60622. /*! exports provided: default */
  60623. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60624. "use strict";
  60625. __webpack_require__.r(__webpack_exports__);
  60626. /* 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&");
  60627. /* 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"]);
  60628. /***/ }),
  60629. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  60630. /*!*************************************************************************************************!*\
  60631. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  60632. \*************************************************************************************************/
  60633. /*! no static exports found */
  60634. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60635. "use strict";
  60636. __webpack_require__.r(__webpack_exports__);
  60637. /* 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&");
  60638. /* 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__);
  60639. /* 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__));
  60640. /* 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);
  60641. /***/ }),
  60642. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  60643. /*!***********************************************************************************!*\
  60644. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  60645. \***********************************************************************************/
  60646. /*! exports provided: render, staticRenderFns */
  60647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60648. "use strict";
  60649. __webpack_require__.r(__webpack_exports__);
  60650. /* 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&");
  60651. /* 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"]; });
  60652. /* 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"]; });
  60653. /***/ }),
  60654. /***/ "./resources/js/views/WorkOrder.vue":
  60655. /*!******************************************!*\
  60656. !*** ./resources/js/views/WorkOrder.vue ***!
  60657. \******************************************/
  60658. /*! exports provided: default */
  60659. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60660. "use strict";
  60661. __webpack_require__.r(__webpack_exports__);
  60662. /* 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&");
  60663. /* 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&");
  60664. /* 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");
  60665. /* normalize component */
  60666. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60667. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60668. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  60669. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60670. false,
  60671. null,
  60672. null,
  60673. null
  60674. )
  60675. /* hot reload */
  60676. if (false) { var api; }
  60677. component.options.__file = "resources/js/views/WorkOrder.vue"
  60678. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60679. /***/ }),
  60680. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  60681. /*!*******************************************************************!*\
  60682. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  60683. \*******************************************************************/
  60684. /*! exports provided: default */
  60685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60686. "use strict";
  60687. __webpack_require__.r(__webpack_exports__);
  60688. /* 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&");
  60689. /* 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"]);
  60690. /***/ }),
  60691. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  60692. /*!*************************************************************************!*\
  60693. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  60694. \*************************************************************************/
  60695. /*! exports provided: render, staticRenderFns */
  60696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60697. "use strict";
  60698. __webpack_require__.r(__webpack_exports__);
  60699. /* 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&");
  60700. /* 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"]; });
  60701. /* 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"]; });
  60702. /***/ }),
  60703. /***/ "./resources/sass/app.scss":
  60704. /*!*********************************!*\
  60705. !*** ./resources/sass/app.scss ***!
  60706. \*********************************/
  60707. /*! no static exports found */
  60708. /***/ (function(module, exports) {
  60709. // removed by extract-text-webpack-plugin
  60710. /***/ }),
  60711. /***/ 0:
  60712. /*!*************************************************************!*\
  60713. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  60714. \*************************************************************/
  60715. /*! no static exports found */
  60716. /***/ (function(module, exports, __webpack_require__) {
  60717. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  60718. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  60719. /***/ })
  60720. /******/ });