app.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  1574. /*!********************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  1576. \********************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. /* harmony import */ var _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/AssetInfoEditModal.vue */ "./resources/js/components/AssetInfoEditModal.vue");
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. /* harmony default export */ __webpack_exports__["default"] = ({
  1596. components: {
  1597. AssetInfoEditModal: _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1598. },
  1599. props: ['asset'],
  1600. mounted: function mounted() {
  1601. var _this = this;
  1602. Echo.channel('asset.' + this.asset.pcid).listen('AssetUpdated', function (e) {
  1603. _this.asset = e.data;
  1604. });
  1605. }
  1606. });
  1607. /***/ }),
  1608. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1609. /*!*****************************************************************************************************************************************************************************!*\
  1610. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  1611. \*****************************************************************************************************************************************************************************/
  1612. /*! exports provided: default */
  1613. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1614. "use strict";
  1615. __webpack_require__.r(__webpack_exports__);
  1616. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1617. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. components: {
  1669. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1670. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1671. },
  1672. props: ['populateWith', 'modalId'],
  1673. data: function data() {
  1674. return {
  1675. // Essentially makes a copy of the object. Otherwise
  1676. // We would have a reference to the exising object causing
  1677. // unwanted mutations in the parent component.
  1678. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1679. assetSaving: false
  1680. };
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. var _this = this;
  1685. this.assetSaving = true;
  1686. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1687. _this.assetSaving = false;
  1688. $("#".concat(_this.modalId)).modal('hide');
  1689. })["catch"](function (error) {
  1690. _this.assetSaving = false;
  1691. });
  1692. }
  1693. }
  1694. });
  1695. /***/ }),
  1696. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1697. /*!*************************************************************************************************************************************************************************************!*\
  1698. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  1699. \*************************************************************************************************************************************************************************************/
  1700. /*! exports provided: default */
  1701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1702. "use strict";
  1703. __webpack_require__.r(__webpack_exports__);
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. /* harmony default export */ __webpack_exports__["default"] = ({
  1726. props: {
  1727. value: null,
  1728. // An object with the following format
  1729. // {
  1730. // key: value,
  1731. // key: value,
  1732. // }
  1733. options: {
  1734. type: Object,
  1735. required: true
  1736. },
  1737. allowCustom: {
  1738. type: Boolean,
  1739. "default": false
  1740. }
  1741. },
  1742. data: function data() {
  1743. return {
  1744. searchText: '',
  1745. selectedOption: null,
  1746. open: false,
  1747. // allows for checking whether button was clicked or text was typed.
  1748. // If button was clicked, we show all options without having to clear
  1749. // out any searchText that was autofilled when page loaded.
  1750. isSearching: false
  1751. };
  1752. },
  1753. computed: {
  1754. matches: function matches() {
  1755. var _this = this;
  1756. // If button was clicked, show all options, if typing, filter
  1757. // options based on searchText
  1758. return Object.entries(this.options).filter(function (option) {
  1759. var optionText = option[1].toUpperCase();
  1760. if (_this.isSearching) {
  1761. return optionText.match(_this.searchText.toUpperCase());
  1762. } else {
  1763. return optionText.match('');
  1764. }
  1765. });
  1766. }
  1767. },
  1768. methods: {
  1769. // if button is clicked, show all options
  1770. setOpen: function setOpen(isOpen) {
  1771. this.open = isOpen;
  1772. this.isSearching = false;
  1773. },
  1774. // if typing in the box, start filtering options
  1775. searchChanged: function searchChanged() {
  1776. if (!this.open) {
  1777. this.open = true;
  1778. }
  1779. if (!this.isSearching) {
  1780. this.isSearching = true;
  1781. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1782. if (this.allowCustom) {
  1783. this.$emit('input', {
  1784. 'id': 'custom',
  1785. 'name': this.searchText
  1786. });
  1787. }
  1788. },
  1789. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1790. // a suggestion is selected
  1791. suggestionSelected: function suggestionSelected(suggestion) {
  1792. this.open = false;
  1793. this.searchText = suggestion[1];
  1794. this.$emit('input', {
  1795. 'id': suggestion[0],
  1796. 'name': suggestion[1]
  1797. });
  1798. },
  1799. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1800. if (this.allowCustom) {
  1801. this.searchText = this.value.name;
  1802. } else {
  1803. if (newValue.id > -1) {
  1804. // Find the matching text for the supplied option value
  1805. for (var id in this.options) {
  1806. if (this.options.hasOwnProperty(id)) {
  1807. if (this.options[id] === this.options[newValue.id]) {
  1808. this.searchText = this.options[id];
  1809. }
  1810. }
  1811. }
  1812. }
  1813. }
  1814. }
  1815. },
  1816. mounted: function mounted() {
  1817. this.updateComponentWithValue(this.value);
  1818. },
  1819. watch: {
  1820. value: function value(newValue) {
  1821. this.updateComponentWithValue(newValue);
  1822. }
  1823. }
  1824. });
  1825. /***/ }),
  1826. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1827. /*!************************************************************************************************************************************************************************!*\
  1828. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  1829. \************************************************************************************************************************************************************************/
  1830. /*! exports provided: default */
  1831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1832. "use strict";
  1833. __webpack_require__.r(__webpack_exports__);
  1834. //
  1835. //
  1836. //
  1837. //
  1838. /* harmony default export */ __webpack_exports__["default"] = ({
  1839. name: 'IntersectingCirclesSpinner',
  1840. props: {
  1841. color: {
  1842. type: String,
  1843. "default": '#fff'
  1844. },
  1845. size: {
  1846. type: String,
  1847. "default": '10'
  1848. }
  1849. }
  1850. });
  1851. /***/ }),
  1852. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  1853. /*!**************************************************************************************************************************************************************************!*\
  1854. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  1855. \**************************************************************************************************************************************************************************/
  1856. /*! exports provided: default */
  1857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1858. "use strict";
  1859. __webpack_require__.r(__webpack_exports__);
  1860. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  1861. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. /* harmony default export */ __webpack_exports__["default"] = ({
  1896. components: {
  1897. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  1898. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  1899. },
  1900. props: ['populateWith', 'storeList', 'modalId'],
  1901. data: function data() {
  1902. return {
  1903. // Copies object from prop, so it doesn't mutate the object
  1904. // from the parent component. Parent component will be updated via
  1905. // Websocket if updateWorkOrder is successful.
  1906. data: JSON.parse(JSON.stringify(this.populateWith)),
  1907. id: this.modalId,
  1908. store: {},
  1909. errors: []
  1910. };
  1911. },
  1912. methods: {
  1913. updateWorkOrder: function updateWorkOrder() {
  1914. var _this = this;
  1915. this.data.storeid = this.store.id;
  1916. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1917. $('#workordereditModal').modal('hide');
  1918. })["catch"](function (error) {
  1919. _this.errors = JSON.parse(error.response.request.response).errors;
  1920. });
  1921. }
  1922. },
  1923. mounted: function mounted() {
  1924. this.store = {
  1925. 'id': this.data.storeid,
  1926. 'name': this.storeList[this.data.storeid]
  1927. };
  1928. },
  1929. // This was originally here because the populateWith info would originally
  1930. // not necessarily be loaded when this component was mounted. That is no
  1931. // longer the case as I now don't render the parent component until the
  1932. // ajax request is finised. The watch statements are still here to cover
  1933. // the case where someone else updates the populateWith values while
  1934. // someone is editing, although it probably should be edited so it doesn't
  1935. // immediately overwrite the unsaved edits of the current user.
  1936. watch: {
  1937. populateWith: function populateWith(value) {
  1938. this.data = JSON.parse(JSON.stringify(this.populateWith));
  1939. this.store = {
  1940. 'id': this.data.storeid,
  1941. 'name': this.storeList[this.data.storeid]
  1942. };
  1943. },
  1944. storeList: function storeList(value) {
  1945. this.store = {
  1946. 'id': this.data.storeid,
  1947. 'name': this.storeList[this.data.storeid]
  1948. };
  1949. }
  1950. }
  1951. });
  1952. /***/ }),
  1953. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  1954. /*!************************************************************************************************************************************************************************!*\
  1955. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  1956. \************************************************************************************************************************************************************************/
  1957. /*! exports provided: default */
  1958. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1959. "use strict";
  1960. __webpack_require__.r(__webpack_exports__);
  1961. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1962. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. /* harmony default export */ __webpack_exports__["default"] = ({
  1984. components: {
  1985. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  1986. },
  1987. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1988. props: ['workOrder', 'stores'],
  1989. computed: {
  1990. storeList: function storeList() {
  1991. var list = {};
  1992. Object.values(this.stores).map(function (val) {
  1993. list[val.storeid] = val.storesname;
  1994. });
  1995. return list;
  1996. }
  1997. }
  1998. });
  1999. /***/ }),
  2000. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2001. /*!*********************************************************************************************************************************************************!*\
  2002. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  2003. \*********************************************************************************************************************************************************/
  2004. /*! exports provided: default */
  2005. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2006. "use strict";
  2007. __webpack_require__.r(__webpack_exports__);
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. //
  2078. //
  2079. /* harmony default export */ __webpack_exports__["default"] = ({
  2080. data: function data() {
  2081. return {
  2082. isLoggedIn: null,
  2083. username: null
  2084. };
  2085. },
  2086. mounted: function mounted() {
  2087. this.isLoggedIn = localStorage.getItem('jwt');
  2088. this.username = localStorage.getItem('user');
  2089. }
  2090. });
  2091. /***/ }),
  2092. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2093. /*!***************************************************************************************************************************************************************!*\
  2094. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  2095. \***************************************************************************************************************************************************************/
  2096. /*! exports provided: default */
  2097. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2098. "use strict";
  2099. __webpack_require__.r(__webpack_exports__);
  2100. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. /* harmony default export */ __webpack_exports__["default"] = ({
  2128. components: {
  2129. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2130. },
  2131. data: function data() {
  2132. return {
  2133. workOrders: [],
  2134. isLoading: true
  2135. };
  2136. },
  2137. mounted: function mounted() {
  2138. var _this = this;
  2139. var token = localStorage.getItem('jwt');
  2140. var user = localStorage.getItem('user');
  2141. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2142. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2143. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2144. _this.workOrders = response.data;
  2145. _this.isLoading = false;
  2146. })["catch"](function (error) {
  2147. console.log(error);
  2148. });
  2149. },
  2150. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2151. if (!localStorage.getItem('jwt')) {
  2152. return next('login');
  2153. }
  2154. next();
  2155. }
  2156. });
  2157. /***/ }),
  2158. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2159. /*!***********************************************************************************************************************************************************!*\
  2160. !*** ./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& ***!
  2161. \***********************************************************************************************************************************************************/
  2162. /*! exports provided: default */
  2163. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2164. "use strict";
  2165. __webpack_require__.r(__webpack_exports__);
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. /* harmony default export */ __webpack_exports__["default"] = ({
  2206. data: function data() {
  2207. return {
  2208. username: "",
  2209. password: ""
  2210. };
  2211. },
  2212. methods: {
  2213. handleSubmit: function handleSubmit(e) {
  2214. var _this = this;
  2215. e.preventDefault();
  2216. if (this.password.length > 0) {
  2217. axios.post('api/login', {
  2218. username: this.username,
  2219. password: this.password
  2220. }).then(function (response) {
  2221. localStorage.setItem('user', response.data.success.username);
  2222. localStorage.setItem('jwt', response.data.success.token);
  2223. if (localStorage.getItem('jwt') != null) {
  2224. _this.$router.go('/dashboard');
  2225. }
  2226. })["catch"](function (error) {
  2227. console.error(error);
  2228. });
  2229. }
  2230. }
  2231. },
  2232. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2233. if (localStorage.getItem('jwt')) {
  2234. return next('dashboard');
  2235. }
  2236. next();
  2237. }
  2238. });
  2239. /***/ }),
  2240. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2241. /*!*************************************************************************************************************************************************************!*\
  2242. !*** ./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& ***!
  2243. \*************************************************************************************************************************************************************/
  2244. /*! exports provided: default */
  2245. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2246. "use strict";
  2247. __webpack_require__.r(__webpack_exports__);
  2248. //
  2249. //
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. //
  2266. //
  2267. //
  2268. //
  2269. //
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. /* harmony default export */ __webpack_exports__["default"] = ({});
  2300. /***/ }),
  2301. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2302. /*!***************************************************************************************************************************************************************!*\
  2303. !*** ./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& ***!
  2304. \***************************************************************************************************************************************************************/
  2305. /*! exports provided: default */
  2306. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2307. "use strict";
  2308. __webpack_require__.r(__webpack_exports__);
  2309. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2310. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2311. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. //
  2335. //
  2336. //
  2337. //
  2338. //
  2339. //
  2340. //
  2341. //
  2342. //
  2343. //
  2344. //
  2345. //
  2346. //
  2347. //
  2348. //
  2349. //
  2350. //
  2351. //
  2352. //
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. //
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. //
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. /* harmony default export */ __webpack_exports__["default"] = ({
  2411. components: {
  2412. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2413. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2414. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  2415. },
  2416. props: ['id'],
  2417. data: function data() {
  2418. return {
  2419. workOrder: {},
  2420. asset: {},
  2421. stores: {},
  2422. woLoading: true,
  2423. assetLoading: true,
  2424. storesLoading: true
  2425. };
  2426. },
  2427. mounted: function mounted() {
  2428. var _this = this;
  2429. // Get authentication info from current user from local storage
  2430. var token = localStorage.getItem('jwt');
  2431. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  2432. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2433. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  2434. axios.get('/api/workorders/' + this.id).then(function (response) {
  2435. _this.workOrder = response.data;
  2436. _this.woLoading = false;
  2437. })["catch"](function (error) {
  2438. console.log(error);
  2439. }); // Get Asset from API (will most likely be replaced with list of assets
  2440. // in the future. Current each WO can only have one but that is likely
  2441. // to change)
  2442. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  2443. _this.asset = response.data;
  2444. _this.assetLoading = false;
  2445. })["catch"](function (error) {
  2446. console.log(error);
  2447. }); // Get list of stores from API
  2448. axios.get('/api/stores/').then(function (response) {
  2449. _this.stores = response.data;
  2450. _this.storesLoading = false;
  2451. })["catch"](function (error) {
  2452. console.log(error);
  2453. });
  2454. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2455. _this.workOrder = e.data;
  2456. });
  2457. }
  2458. });
  2459. /***/ }),
  2460. /***/ "./node_modules/base64-js/index.js":
  2461. /*!*****************************************!*\
  2462. !*** ./node_modules/base64-js/index.js ***!
  2463. \*****************************************/
  2464. /*! no static exports found */
  2465. /***/ (function(module, exports, __webpack_require__) {
  2466. "use strict";
  2467. exports.byteLength = byteLength
  2468. exports.toByteArray = toByteArray
  2469. exports.fromByteArray = fromByteArray
  2470. var lookup = []
  2471. var revLookup = []
  2472. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2473. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2474. for (var i = 0, len = code.length; i < len; ++i) {
  2475. lookup[i] = code[i]
  2476. revLookup[code.charCodeAt(i)] = i
  2477. }
  2478. // Support decoding URL-safe base64 strings, as Node.js does.
  2479. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2480. revLookup['-'.charCodeAt(0)] = 62
  2481. revLookup['_'.charCodeAt(0)] = 63
  2482. function getLens (b64) {
  2483. var len = b64.length
  2484. if (len % 4 > 0) {
  2485. throw new Error('Invalid string. Length must be a multiple of 4')
  2486. }
  2487. // Trim off extra bytes after placeholder bytes are found
  2488. // See: https://github.com/beatgammit/base64-js/issues/42
  2489. var validLen = b64.indexOf('=')
  2490. if (validLen === -1) validLen = len
  2491. var placeHoldersLen = validLen === len
  2492. ? 0
  2493. : 4 - (validLen % 4)
  2494. return [validLen, placeHoldersLen]
  2495. }
  2496. // base64 is 4/3 + up to two characters of the original data
  2497. function byteLength (b64) {
  2498. var lens = getLens(b64)
  2499. var validLen = lens[0]
  2500. var placeHoldersLen = lens[1]
  2501. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2502. }
  2503. function _byteLength (b64, validLen, placeHoldersLen) {
  2504. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2505. }
  2506. function toByteArray (b64) {
  2507. var tmp
  2508. var lens = getLens(b64)
  2509. var validLen = lens[0]
  2510. var placeHoldersLen = lens[1]
  2511. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2512. var curByte = 0
  2513. // if there are placeholders, only get up to the last complete 4 chars
  2514. var len = placeHoldersLen > 0
  2515. ? validLen - 4
  2516. : validLen
  2517. var i
  2518. for (i = 0; i < len; i += 4) {
  2519. tmp =
  2520. (revLookup[b64.charCodeAt(i)] << 18) |
  2521. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2522. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2523. revLookup[b64.charCodeAt(i + 3)]
  2524. arr[curByte++] = (tmp >> 16) & 0xFF
  2525. arr[curByte++] = (tmp >> 8) & 0xFF
  2526. arr[curByte++] = tmp & 0xFF
  2527. }
  2528. if (placeHoldersLen === 2) {
  2529. tmp =
  2530. (revLookup[b64.charCodeAt(i)] << 2) |
  2531. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2532. arr[curByte++] = tmp & 0xFF
  2533. }
  2534. if (placeHoldersLen === 1) {
  2535. tmp =
  2536. (revLookup[b64.charCodeAt(i)] << 10) |
  2537. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2538. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2539. arr[curByte++] = (tmp >> 8) & 0xFF
  2540. arr[curByte++] = tmp & 0xFF
  2541. }
  2542. return arr
  2543. }
  2544. function tripletToBase64 (num) {
  2545. return lookup[num >> 18 & 0x3F] +
  2546. lookup[num >> 12 & 0x3F] +
  2547. lookup[num >> 6 & 0x3F] +
  2548. lookup[num & 0x3F]
  2549. }
  2550. function encodeChunk (uint8, start, end) {
  2551. var tmp
  2552. var output = []
  2553. for (var i = start; i < end; i += 3) {
  2554. tmp =
  2555. ((uint8[i] << 16) & 0xFF0000) +
  2556. ((uint8[i + 1] << 8) & 0xFF00) +
  2557. (uint8[i + 2] & 0xFF)
  2558. output.push(tripletToBase64(tmp))
  2559. }
  2560. return output.join('')
  2561. }
  2562. function fromByteArray (uint8) {
  2563. var tmp
  2564. var len = uint8.length
  2565. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2566. var parts = []
  2567. var maxChunkLength = 16383 // must be multiple of 3
  2568. // go through the array every three bytes, we'll deal with trailing stuff later
  2569. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2570. parts.push(encodeChunk(
  2571. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2572. ))
  2573. }
  2574. // pad the end with zeros, but make sure to not forget the extra bytes
  2575. if (extraBytes === 1) {
  2576. tmp = uint8[len - 1]
  2577. parts.push(
  2578. lookup[tmp >> 2] +
  2579. lookup[(tmp << 4) & 0x3F] +
  2580. '=='
  2581. )
  2582. } else if (extraBytes === 2) {
  2583. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2584. parts.push(
  2585. lookup[tmp >> 10] +
  2586. lookup[(tmp >> 4) & 0x3F] +
  2587. lookup[(tmp << 2) & 0x3F] +
  2588. '='
  2589. )
  2590. }
  2591. return parts.join('')
  2592. }
  2593. /***/ }),
  2594. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2595. /*!*****************************************************!*\
  2596. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2597. \*****************************************************/
  2598. /*! no static exports found */
  2599. /***/ (function(module, exports, __webpack_require__) {
  2600. /*!
  2601. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2602. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2603. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2604. */
  2605. (function (global, factory) {
  2606. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2607. undefined;
  2608. }(this, (function (exports, $, Popper) { 'use strict';
  2609. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2610. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2611. function _defineProperties(target, props) {
  2612. for (var i = 0; i < props.length; i++) {
  2613. var descriptor = props[i];
  2614. descriptor.enumerable = descriptor.enumerable || false;
  2615. descriptor.configurable = true;
  2616. if ("value" in descriptor) descriptor.writable = true;
  2617. Object.defineProperty(target, descriptor.key, descriptor);
  2618. }
  2619. }
  2620. function _createClass(Constructor, protoProps, staticProps) {
  2621. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2622. if (staticProps) _defineProperties(Constructor, staticProps);
  2623. return Constructor;
  2624. }
  2625. function _defineProperty(obj, key, value) {
  2626. if (key in obj) {
  2627. Object.defineProperty(obj, key, {
  2628. value: value,
  2629. enumerable: true,
  2630. configurable: true,
  2631. writable: true
  2632. });
  2633. } else {
  2634. obj[key] = value;
  2635. }
  2636. return obj;
  2637. }
  2638. function ownKeys(object, enumerableOnly) {
  2639. var keys = Object.keys(object);
  2640. if (Object.getOwnPropertySymbols) {
  2641. var symbols = Object.getOwnPropertySymbols(object);
  2642. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2643. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2644. });
  2645. keys.push.apply(keys, symbols);
  2646. }
  2647. return keys;
  2648. }
  2649. function _objectSpread2(target) {
  2650. for (var i = 1; i < arguments.length; i++) {
  2651. var source = arguments[i] != null ? arguments[i] : {};
  2652. if (i % 2) {
  2653. ownKeys(Object(source), true).forEach(function (key) {
  2654. _defineProperty(target, key, source[key]);
  2655. });
  2656. } else if (Object.getOwnPropertyDescriptors) {
  2657. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2658. } else {
  2659. ownKeys(Object(source)).forEach(function (key) {
  2660. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2661. });
  2662. }
  2663. }
  2664. return target;
  2665. }
  2666. function _inheritsLoose(subClass, superClass) {
  2667. subClass.prototype = Object.create(superClass.prototype);
  2668. subClass.prototype.constructor = subClass;
  2669. subClass.__proto__ = superClass;
  2670. }
  2671. /**
  2672. * --------------------------------------------------------------------------
  2673. * Bootstrap (v4.4.1): util.js
  2674. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2675. * --------------------------------------------------------------------------
  2676. */
  2677. /**
  2678. * ------------------------------------------------------------------------
  2679. * Private TransitionEnd Helpers
  2680. * ------------------------------------------------------------------------
  2681. */
  2682. var TRANSITION_END = 'transitionend';
  2683. var MAX_UID = 1000000;
  2684. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2685. function toType(obj) {
  2686. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2687. }
  2688. function getSpecialTransitionEndEvent() {
  2689. return {
  2690. bindType: TRANSITION_END,
  2691. delegateType: TRANSITION_END,
  2692. handle: function handle(event) {
  2693. if ($(event.target).is(this)) {
  2694. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2695. }
  2696. return undefined; // eslint-disable-line no-undefined
  2697. }
  2698. };
  2699. }
  2700. function transitionEndEmulator(duration) {
  2701. var _this = this;
  2702. var called = false;
  2703. $(this).one(Util.TRANSITION_END, function () {
  2704. called = true;
  2705. });
  2706. setTimeout(function () {
  2707. if (!called) {
  2708. Util.triggerTransitionEnd(_this);
  2709. }
  2710. }, duration);
  2711. return this;
  2712. }
  2713. function setTransitionEndSupport() {
  2714. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2715. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2716. }
  2717. /**
  2718. * --------------------------------------------------------------------------
  2719. * Public Util Api
  2720. * --------------------------------------------------------------------------
  2721. */
  2722. var Util = {
  2723. TRANSITION_END: 'bsTransitionEnd',
  2724. getUID: function getUID(prefix) {
  2725. do {
  2726. // eslint-disable-next-line no-bitwise
  2727. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2728. } while (document.getElementById(prefix));
  2729. return prefix;
  2730. },
  2731. getSelectorFromElement: function getSelectorFromElement(element) {
  2732. var selector = element.getAttribute('data-target');
  2733. if (!selector || selector === '#') {
  2734. var hrefAttr = element.getAttribute('href');
  2735. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2736. }
  2737. try {
  2738. return document.querySelector(selector) ? selector : null;
  2739. } catch (err) {
  2740. return null;
  2741. }
  2742. },
  2743. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2744. if (!element) {
  2745. return 0;
  2746. } // Get transition-duration of the element
  2747. var transitionDuration = $(element).css('transition-duration');
  2748. var transitionDelay = $(element).css('transition-delay');
  2749. var floatTransitionDuration = parseFloat(transitionDuration);
  2750. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2751. if (!floatTransitionDuration && !floatTransitionDelay) {
  2752. return 0;
  2753. } // If multiple durations are defined, take the first
  2754. transitionDuration = transitionDuration.split(',')[0];
  2755. transitionDelay = transitionDelay.split(',')[0];
  2756. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2757. },
  2758. reflow: function reflow(element) {
  2759. return element.offsetHeight;
  2760. },
  2761. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2762. $(element).trigger(TRANSITION_END);
  2763. },
  2764. // TODO: Remove in v5
  2765. supportsTransitionEnd: function supportsTransitionEnd() {
  2766. return Boolean(TRANSITION_END);
  2767. },
  2768. isElement: function isElement(obj) {
  2769. return (obj[0] || obj).nodeType;
  2770. },
  2771. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2772. for (var property in configTypes) {
  2773. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2774. var expectedTypes = configTypes[property];
  2775. var value = config[property];
  2776. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2777. if (!new RegExp(expectedTypes).test(valueType)) {
  2778. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2779. }
  2780. }
  2781. }
  2782. },
  2783. findShadowRoot: function findShadowRoot(element) {
  2784. if (!document.documentElement.attachShadow) {
  2785. return null;
  2786. } // Can find the shadow root otherwise it'll return the document
  2787. if (typeof element.getRootNode === 'function') {
  2788. var root = element.getRootNode();
  2789. return root instanceof ShadowRoot ? root : null;
  2790. }
  2791. if (element instanceof ShadowRoot) {
  2792. return element;
  2793. } // when we don't find a shadow root
  2794. if (!element.parentNode) {
  2795. return null;
  2796. }
  2797. return Util.findShadowRoot(element.parentNode);
  2798. },
  2799. jQueryDetection: function jQueryDetection() {
  2800. if (typeof $ === 'undefined') {
  2801. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2802. }
  2803. var version = $.fn.jquery.split(' ')[0].split('.');
  2804. var minMajor = 1;
  2805. var ltMajor = 2;
  2806. var minMinor = 9;
  2807. var minPatch = 1;
  2808. var maxMajor = 4;
  2809. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2810. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2811. }
  2812. }
  2813. };
  2814. Util.jQueryDetection();
  2815. setTransitionEndSupport();
  2816. /**
  2817. * ------------------------------------------------------------------------
  2818. * Constants
  2819. * ------------------------------------------------------------------------
  2820. */
  2821. var NAME = 'alert';
  2822. var VERSION = '4.4.1';
  2823. var DATA_KEY = 'bs.alert';
  2824. var EVENT_KEY = "." + DATA_KEY;
  2825. var DATA_API_KEY = '.data-api';
  2826. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2827. var Selector = {
  2828. DISMISS: '[data-dismiss="alert"]'
  2829. };
  2830. var Event = {
  2831. CLOSE: "close" + EVENT_KEY,
  2832. CLOSED: "closed" + EVENT_KEY,
  2833. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2834. };
  2835. var ClassName = {
  2836. ALERT: 'alert',
  2837. FADE: 'fade',
  2838. SHOW: 'show'
  2839. };
  2840. /**
  2841. * ------------------------------------------------------------------------
  2842. * Class Definition
  2843. * ------------------------------------------------------------------------
  2844. */
  2845. var Alert =
  2846. /*#__PURE__*/
  2847. function () {
  2848. function Alert(element) {
  2849. this._element = element;
  2850. } // Getters
  2851. var _proto = Alert.prototype;
  2852. // Public
  2853. _proto.close = function close(element) {
  2854. var rootElement = this._element;
  2855. if (element) {
  2856. rootElement = this._getRootElement(element);
  2857. }
  2858. var customEvent = this._triggerCloseEvent(rootElement);
  2859. if (customEvent.isDefaultPrevented()) {
  2860. return;
  2861. }
  2862. this._removeElement(rootElement);
  2863. };
  2864. _proto.dispose = function dispose() {
  2865. $.removeData(this._element, DATA_KEY);
  2866. this._element = null;
  2867. } // Private
  2868. ;
  2869. _proto._getRootElement = function _getRootElement(element) {
  2870. var selector = Util.getSelectorFromElement(element);
  2871. var parent = false;
  2872. if (selector) {
  2873. parent = document.querySelector(selector);
  2874. }
  2875. if (!parent) {
  2876. parent = $(element).closest("." + ClassName.ALERT)[0];
  2877. }
  2878. return parent;
  2879. };
  2880. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2881. var closeEvent = $.Event(Event.CLOSE);
  2882. $(element).trigger(closeEvent);
  2883. return closeEvent;
  2884. };
  2885. _proto._removeElement = function _removeElement(element) {
  2886. var _this = this;
  2887. $(element).removeClass(ClassName.SHOW);
  2888. if (!$(element).hasClass(ClassName.FADE)) {
  2889. this._destroyElement(element);
  2890. return;
  2891. }
  2892. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2893. $(element).one(Util.TRANSITION_END, function (event) {
  2894. return _this._destroyElement(element, event);
  2895. }).emulateTransitionEnd(transitionDuration);
  2896. };
  2897. _proto._destroyElement = function _destroyElement(element) {
  2898. $(element).detach().trigger(Event.CLOSED).remove();
  2899. } // Static
  2900. ;
  2901. Alert._jQueryInterface = function _jQueryInterface(config) {
  2902. return this.each(function () {
  2903. var $element = $(this);
  2904. var data = $element.data(DATA_KEY);
  2905. if (!data) {
  2906. data = new Alert(this);
  2907. $element.data(DATA_KEY, data);
  2908. }
  2909. if (config === 'close') {
  2910. data[config](this);
  2911. }
  2912. });
  2913. };
  2914. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2915. return function (event) {
  2916. if (event) {
  2917. event.preventDefault();
  2918. }
  2919. alertInstance.close(this);
  2920. };
  2921. };
  2922. _createClass(Alert, null, [{
  2923. key: "VERSION",
  2924. get: function get() {
  2925. return VERSION;
  2926. }
  2927. }]);
  2928. return Alert;
  2929. }();
  2930. /**
  2931. * ------------------------------------------------------------------------
  2932. * Data Api implementation
  2933. * ------------------------------------------------------------------------
  2934. */
  2935. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2936. /**
  2937. * ------------------------------------------------------------------------
  2938. * jQuery
  2939. * ------------------------------------------------------------------------
  2940. */
  2941. $.fn[NAME] = Alert._jQueryInterface;
  2942. $.fn[NAME].Constructor = Alert;
  2943. $.fn[NAME].noConflict = function () {
  2944. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2945. return Alert._jQueryInterface;
  2946. };
  2947. /**
  2948. * ------------------------------------------------------------------------
  2949. * Constants
  2950. * ------------------------------------------------------------------------
  2951. */
  2952. var NAME$1 = 'button';
  2953. var VERSION$1 = '4.4.1';
  2954. var DATA_KEY$1 = 'bs.button';
  2955. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2956. var DATA_API_KEY$1 = '.data-api';
  2957. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2958. var ClassName$1 = {
  2959. ACTIVE: 'active',
  2960. BUTTON: 'btn',
  2961. FOCUS: 'focus'
  2962. };
  2963. var Selector$1 = {
  2964. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2965. DATA_TOGGLES: '[data-toggle="buttons"]',
  2966. DATA_TOGGLE: '[data-toggle="button"]',
  2967. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2968. INPUT: 'input:not([type="hidden"])',
  2969. ACTIVE: '.active',
  2970. BUTTON: '.btn'
  2971. };
  2972. var Event$1 = {
  2973. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2974. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2975. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2976. };
  2977. /**
  2978. * ------------------------------------------------------------------------
  2979. * Class Definition
  2980. * ------------------------------------------------------------------------
  2981. */
  2982. var Button =
  2983. /*#__PURE__*/
  2984. function () {
  2985. function Button(element) {
  2986. this._element = element;
  2987. } // Getters
  2988. var _proto = Button.prototype;
  2989. // Public
  2990. _proto.toggle = function toggle() {
  2991. var triggerChangeEvent = true;
  2992. var addAriaPressed = true;
  2993. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2994. if (rootElement) {
  2995. var input = this._element.querySelector(Selector$1.INPUT);
  2996. if (input) {
  2997. if (input.type === 'radio') {
  2998. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2999. triggerChangeEvent = false;
  3000. } else {
  3001. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3002. if (activeElement) {
  3003. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3004. }
  3005. }
  3006. } else if (input.type === 'checkbox') {
  3007. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3008. triggerChangeEvent = false;
  3009. }
  3010. } else {
  3011. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3012. triggerChangeEvent = false;
  3013. }
  3014. if (triggerChangeEvent) {
  3015. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3016. $(input).trigger('change');
  3017. }
  3018. input.focus();
  3019. addAriaPressed = false;
  3020. }
  3021. }
  3022. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3023. if (addAriaPressed) {
  3024. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3025. }
  3026. if (triggerChangeEvent) {
  3027. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3028. }
  3029. }
  3030. };
  3031. _proto.dispose = function dispose() {
  3032. $.removeData(this._element, DATA_KEY$1);
  3033. this._element = null;
  3034. } // Static
  3035. ;
  3036. Button._jQueryInterface = function _jQueryInterface(config) {
  3037. return this.each(function () {
  3038. var data = $(this).data(DATA_KEY$1);
  3039. if (!data) {
  3040. data = new Button(this);
  3041. $(this).data(DATA_KEY$1, data);
  3042. }
  3043. if (config === 'toggle') {
  3044. data[config]();
  3045. }
  3046. });
  3047. };
  3048. _createClass(Button, null, [{
  3049. key: "VERSION",
  3050. get: function get() {
  3051. return VERSION$1;
  3052. }
  3053. }]);
  3054. return Button;
  3055. }();
  3056. /**
  3057. * ------------------------------------------------------------------------
  3058. * Data Api implementation
  3059. * ------------------------------------------------------------------------
  3060. */
  3061. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3062. var button = event.target;
  3063. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3064. button = $(button).closest(Selector$1.BUTTON)[0];
  3065. }
  3066. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3067. event.preventDefault(); // work around Firefox bug #1540995
  3068. } else {
  3069. var inputBtn = button.querySelector(Selector$1.INPUT);
  3070. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3071. event.preventDefault(); // work around Firefox bug #1540995
  3072. return;
  3073. }
  3074. Button._jQueryInterface.call($(button), 'toggle');
  3075. }
  3076. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3077. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3078. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3079. });
  3080. $(window).on(Event$1.LOAD_DATA_API, function () {
  3081. // ensure correct active class is set to match the controls' actual values/states
  3082. // find all checkboxes/readio buttons inside data-toggle groups
  3083. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3084. for (var i = 0, len = buttons.length; i < len; i++) {
  3085. var button = buttons[i];
  3086. var input = button.querySelector(Selector$1.INPUT);
  3087. if (input.checked || input.hasAttribute('checked')) {
  3088. button.classList.add(ClassName$1.ACTIVE);
  3089. } else {
  3090. button.classList.remove(ClassName$1.ACTIVE);
  3091. }
  3092. } // find all button toggles
  3093. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3094. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3095. var _button = buttons[_i];
  3096. if (_button.getAttribute('aria-pressed') === 'true') {
  3097. _button.classList.add(ClassName$1.ACTIVE);
  3098. } else {
  3099. _button.classList.remove(ClassName$1.ACTIVE);
  3100. }
  3101. }
  3102. });
  3103. /**
  3104. * ------------------------------------------------------------------------
  3105. * jQuery
  3106. * ------------------------------------------------------------------------
  3107. */
  3108. $.fn[NAME$1] = Button._jQueryInterface;
  3109. $.fn[NAME$1].Constructor = Button;
  3110. $.fn[NAME$1].noConflict = function () {
  3111. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3112. return Button._jQueryInterface;
  3113. };
  3114. /**
  3115. * ------------------------------------------------------------------------
  3116. * Constants
  3117. * ------------------------------------------------------------------------
  3118. */
  3119. var NAME$2 = 'carousel';
  3120. var VERSION$2 = '4.4.1';
  3121. var DATA_KEY$2 = 'bs.carousel';
  3122. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3123. var DATA_API_KEY$2 = '.data-api';
  3124. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3125. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3126. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3127. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3128. var SWIPE_THRESHOLD = 40;
  3129. var Default = {
  3130. interval: 5000,
  3131. keyboard: true,
  3132. slide: false,
  3133. pause: 'hover',
  3134. wrap: true,
  3135. touch: true
  3136. };
  3137. var DefaultType = {
  3138. interval: '(number|boolean)',
  3139. keyboard: 'boolean',
  3140. slide: '(boolean|string)',
  3141. pause: '(string|boolean)',
  3142. wrap: 'boolean',
  3143. touch: 'boolean'
  3144. };
  3145. var Direction = {
  3146. NEXT: 'next',
  3147. PREV: 'prev',
  3148. LEFT: 'left',
  3149. RIGHT: 'right'
  3150. };
  3151. var Event$2 = {
  3152. SLIDE: "slide" + EVENT_KEY$2,
  3153. SLID: "slid" + EVENT_KEY$2,
  3154. KEYDOWN: "keydown" + EVENT_KEY$2,
  3155. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3156. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3157. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3158. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3159. TOUCHEND: "touchend" + EVENT_KEY$2,
  3160. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3161. POINTERUP: "pointerup" + EVENT_KEY$2,
  3162. DRAG_START: "dragstart" + EVENT_KEY$2,
  3163. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3164. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3165. };
  3166. var ClassName$2 = {
  3167. CAROUSEL: 'carousel',
  3168. ACTIVE: 'active',
  3169. SLIDE: 'slide',
  3170. RIGHT: 'carousel-item-right',
  3171. LEFT: 'carousel-item-left',
  3172. NEXT: 'carousel-item-next',
  3173. PREV: 'carousel-item-prev',
  3174. ITEM: 'carousel-item',
  3175. POINTER_EVENT: 'pointer-event'
  3176. };
  3177. var Selector$2 = {
  3178. ACTIVE: '.active',
  3179. ACTIVE_ITEM: '.active.carousel-item',
  3180. ITEM: '.carousel-item',
  3181. ITEM_IMG: '.carousel-item img',
  3182. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3183. INDICATORS: '.carousel-indicators',
  3184. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3185. DATA_RIDE: '[data-ride="carousel"]'
  3186. };
  3187. var PointerType = {
  3188. TOUCH: 'touch',
  3189. PEN: 'pen'
  3190. };
  3191. /**
  3192. * ------------------------------------------------------------------------
  3193. * Class Definition
  3194. * ------------------------------------------------------------------------
  3195. */
  3196. var Carousel =
  3197. /*#__PURE__*/
  3198. function () {
  3199. function Carousel(element, config) {
  3200. this._items = null;
  3201. this._interval = null;
  3202. this._activeElement = null;
  3203. this._isPaused = false;
  3204. this._isSliding = false;
  3205. this.touchTimeout = null;
  3206. this.touchStartX = 0;
  3207. this.touchDeltaX = 0;
  3208. this._config = this._getConfig(config);
  3209. this._element = element;
  3210. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3211. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3212. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3213. this._addEventListeners();
  3214. } // Getters
  3215. var _proto = Carousel.prototype;
  3216. // Public
  3217. _proto.next = function next() {
  3218. if (!this._isSliding) {
  3219. this._slide(Direction.NEXT);
  3220. }
  3221. };
  3222. _proto.nextWhenVisible = function nextWhenVisible() {
  3223. // Don't call next when the page isn't visible
  3224. // or the carousel or its parent isn't visible
  3225. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3226. this.next();
  3227. }
  3228. };
  3229. _proto.prev = function prev() {
  3230. if (!this._isSliding) {
  3231. this._slide(Direction.PREV);
  3232. }
  3233. };
  3234. _proto.pause = function pause(event) {
  3235. if (!event) {
  3236. this._isPaused = true;
  3237. }
  3238. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3239. Util.triggerTransitionEnd(this._element);
  3240. this.cycle(true);
  3241. }
  3242. clearInterval(this._interval);
  3243. this._interval = null;
  3244. };
  3245. _proto.cycle = function cycle(event) {
  3246. if (!event) {
  3247. this._isPaused = false;
  3248. }
  3249. if (this._interval) {
  3250. clearInterval(this._interval);
  3251. this._interval = null;
  3252. }
  3253. if (this._config.interval && !this._isPaused) {
  3254. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3255. }
  3256. };
  3257. _proto.to = function to(index) {
  3258. var _this = this;
  3259. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3260. var activeIndex = this._getItemIndex(this._activeElement);
  3261. if (index > this._items.length - 1 || index < 0) {
  3262. return;
  3263. }
  3264. if (this._isSliding) {
  3265. $(this._element).one(Event$2.SLID, function () {
  3266. return _this.to(index);
  3267. });
  3268. return;
  3269. }
  3270. if (activeIndex === index) {
  3271. this.pause();
  3272. this.cycle();
  3273. return;
  3274. }
  3275. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3276. this._slide(direction, this._items[index]);
  3277. };
  3278. _proto.dispose = function dispose() {
  3279. $(this._element).off(EVENT_KEY$2);
  3280. $.removeData(this._element, DATA_KEY$2);
  3281. this._items = null;
  3282. this._config = null;
  3283. this._element = null;
  3284. this._interval = null;
  3285. this._isPaused = null;
  3286. this._isSliding = null;
  3287. this._activeElement = null;
  3288. this._indicatorsElement = null;
  3289. } // Private
  3290. ;
  3291. _proto._getConfig = function _getConfig(config) {
  3292. config = _objectSpread2({}, Default, {}, config);
  3293. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3294. return config;
  3295. };
  3296. _proto._handleSwipe = function _handleSwipe() {
  3297. var absDeltax = Math.abs(this.touchDeltaX);
  3298. if (absDeltax <= SWIPE_THRESHOLD) {
  3299. return;
  3300. }
  3301. var direction = absDeltax / this.touchDeltaX;
  3302. this.touchDeltaX = 0; // swipe left
  3303. if (direction > 0) {
  3304. this.prev();
  3305. } // swipe right
  3306. if (direction < 0) {
  3307. this.next();
  3308. }
  3309. };
  3310. _proto._addEventListeners = function _addEventListeners() {
  3311. var _this2 = this;
  3312. if (this._config.keyboard) {
  3313. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3314. return _this2._keydown(event);
  3315. });
  3316. }
  3317. if (this._config.pause === 'hover') {
  3318. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3319. return _this2.pause(event);
  3320. }).on(Event$2.MOUSELEAVE, function (event) {
  3321. return _this2.cycle(event);
  3322. });
  3323. }
  3324. if (this._config.touch) {
  3325. this._addTouchEventListeners();
  3326. }
  3327. };
  3328. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3329. var _this3 = this;
  3330. if (!this._touchSupported) {
  3331. return;
  3332. }
  3333. var start = function start(event) {
  3334. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3335. _this3.touchStartX = event.originalEvent.clientX;
  3336. } else if (!_this3._pointerEvent) {
  3337. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3338. }
  3339. };
  3340. var move = function move(event) {
  3341. // ensure swiping with one touch and not pinching
  3342. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3343. _this3.touchDeltaX = 0;
  3344. } else {
  3345. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3346. }
  3347. };
  3348. var end = function end(event) {
  3349. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3350. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3351. }
  3352. _this3._handleSwipe();
  3353. if (_this3._config.pause === 'hover') {
  3354. // If it's a touch-enabled device, mouseenter/leave are fired as
  3355. // part of the mouse compatibility events on first tap - the carousel
  3356. // would stop cycling until user tapped out of it;
  3357. // here, we listen for touchend, explicitly pause the carousel
  3358. // (as if it's the second time we tap on it, mouseenter compat event
  3359. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3360. // events to fire) we explicitly restart cycling
  3361. _this3.pause();
  3362. if (_this3.touchTimeout) {
  3363. clearTimeout(_this3.touchTimeout);
  3364. }
  3365. _this3.touchTimeout = setTimeout(function (event) {
  3366. return _this3.cycle(event);
  3367. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3368. }
  3369. };
  3370. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3371. return e.preventDefault();
  3372. });
  3373. if (this._pointerEvent) {
  3374. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3375. return start(event);
  3376. });
  3377. $(this._element).on(Event$2.POINTERUP, function (event) {
  3378. return end(event);
  3379. });
  3380. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3381. } else {
  3382. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3383. return start(event);
  3384. });
  3385. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3386. return move(event);
  3387. });
  3388. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3389. return end(event);
  3390. });
  3391. }
  3392. };
  3393. _proto._keydown = function _keydown(event) {
  3394. if (/input|textarea/i.test(event.target.tagName)) {
  3395. return;
  3396. }
  3397. switch (event.which) {
  3398. case ARROW_LEFT_KEYCODE:
  3399. event.preventDefault();
  3400. this.prev();
  3401. break;
  3402. case ARROW_RIGHT_KEYCODE:
  3403. event.preventDefault();
  3404. this.next();
  3405. break;
  3406. }
  3407. };
  3408. _proto._getItemIndex = function _getItemIndex(element) {
  3409. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3410. return this._items.indexOf(element);
  3411. };
  3412. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3413. var isNextDirection = direction === Direction.NEXT;
  3414. var isPrevDirection = direction === Direction.PREV;
  3415. var activeIndex = this._getItemIndex(activeElement);
  3416. var lastItemIndex = this._items.length - 1;
  3417. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3418. if (isGoingToWrap && !this._config.wrap) {
  3419. return activeElement;
  3420. }
  3421. var delta = direction === Direction.PREV ? -1 : 1;
  3422. var itemIndex = (activeIndex + delta) % this._items.length;
  3423. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3424. };
  3425. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3426. var targetIndex = this._getItemIndex(relatedTarget);
  3427. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3428. var slideEvent = $.Event(Event$2.SLIDE, {
  3429. relatedTarget: relatedTarget,
  3430. direction: eventDirectionName,
  3431. from: fromIndex,
  3432. to: targetIndex
  3433. });
  3434. $(this._element).trigger(slideEvent);
  3435. return slideEvent;
  3436. };
  3437. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3438. if (this._indicatorsElement) {
  3439. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3440. $(indicators).removeClass(ClassName$2.ACTIVE);
  3441. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3442. if (nextIndicator) {
  3443. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3444. }
  3445. }
  3446. };
  3447. _proto._slide = function _slide(direction, element) {
  3448. var _this4 = this;
  3449. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3450. var activeElementIndex = this._getItemIndex(activeElement);
  3451. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3452. var nextElementIndex = this._getItemIndex(nextElement);
  3453. var isCycling = Boolean(this._interval);
  3454. var directionalClassName;
  3455. var orderClassName;
  3456. var eventDirectionName;
  3457. if (direction === Direction.NEXT) {
  3458. directionalClassName = ClassName$2.LEFT;
  3459. orderClassName = ClassName$2.NEXT;
  3460. eventDirectionName = Direction.LEFT;
  3461. } else {
  3462. directionalClassName = ClassName$2.RIGHT;
  3463. orderClassName = ClassName$2.PREV;
  3464. eventDirectionName = Direction.RIGHT;
  3465. }
  3466. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3467. this._isSliding = false;
  3468. return;
  3469. }
  3470. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3471. if (slideEvent.isDefaultPrevented()) {
  3472. return;
  3473. }
  3474. if (!activeElement || !nextElement) {
  3475. // Some weirdness is happening, so we bail
  3476. return;
  3477. }
  3478. this._isSliding = true;
  3479. if (isCycling) {
  3480. this.pause();
  3481. }
  3482. this._setActiveIndicatorElement(nextElement);
  3483. var slidEvent = $.Event(Event$2.SLID, {
  3484. relatedTarget: nextElement,
  3485. direction: eventDirectionName,
  3486. from: activeElementIndex,
  3487. to: nextElementIndex
  3488. });
  3489. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3490. $(nextElement).addClass(orderClassName);
  3491. Util.reflow(nextElement);
  3492. $(activeElement).addClass(directionalClassName);
  3493. $(nextElement).addClass(directionalClassName);
  3494. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3495. if (nextElementInterval) {
  3496. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3497. this._config.interval = nextElementInterval;
  3498. } else {
  3499. this._config.interval = this._config.defaultInterval || this._config.interval;
  3500. }
  3501. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3502. $(activeElement).one(Util.TRANSITION_END, function () {
  3503. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3504. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3505. _this4._isSliding = false;
  3506. setTimeout(function () {
  3507. return $(_this4._element).trigger(slidEvent);
  3508. }, 0);
  3509. }).emulateTransitionEnd(transitionDuration);
  3510. } else {
  3511. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3512. $(nextElement).addClass(ClassName$2.ACTIVE);
  3513. this._isSliding = false;
  3514. $(this._element).trigger(slidEvent);
  3515. }
  3516. if (isCycling) {
  3517. this.cycle();
  3518. }
  3519. } // Static
  3520. ;
  3521. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3522. return this.each(function () {
  3523. var data = $(this).data(DATA_KEY$2);
  3524. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3525. if (typeof config === 'object') {
  3526. _config = _objectSpread2({}, _config, {}, config);
  3527. }
  3528. var action = typeof config === 'string' ? config : _config.slide;
  3529. if (!data) {
  3530. data = new Carousel(this, _config);
  3531. $(this).data(DATA_KEY$2, data);
  3532. }
  3533. if (typeof config === 'number') {
  3534. data.to(config);
  3535. } else if (typeof action === 'string') {
  3536. if (typeof data[action] === 'undefined') {
  3537. throw new TypeError("No method named \"" + action + "\"");
  3538. }
  3539. data[action]();
  3540. } else if (_config.interval && _config.ride) {
  3541. data.pause();
  3542. data.cycle();
  3543. }
  3544. });
  3545. };
  3546. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3547. var selector = Util.getSelectorFromElement(this);
  3548. if (!selector) {
  3549. return;
  3550. }
  3551. var target = $(selector)[0];
  3552. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3553. return;
  3554. }
  3555. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3556. var slideIndex = this.getAttribute('data-slide-to');
  3557. if (slideIndex) {
  3558. config.interval = false;
  3559. }
  3560. Carousel._jQueryInterface.call($(target), config);
  3561. if (slideIndex) {
  3562. $(target).data(DATA_KEY$2).to(slideIndex);
  3563. }
  3564. event.preventDefault();
  3565. };
  3566. _createClass(Carousel, null, [{
  3567. key: "VERSION",
  3568. get: function get() {
  3569. return VERSION$2;
  3570. }
  3571. }, {
  3572. key: "Default",
  3573. get: function get() {
  3574. return Default;
  3575. }
  3576. }]);
  3577. return Carousel;
  3578. }();
  3579. /**
  3580. * ------------------------------------------------------------------------
  3581. * Data Api implementation
  3582. * ------------------------------------------------------------------------
  3583. */
  3584. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3585. $(window).on(Event$2.LOAD_DATA_API, function () {
  3586. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3587. for (var i = 0, len = carousels.length; i < len; i++) {
  3588. var $carousel = $(carousels[i]);
  3589. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3590. }
  3591. });
  3592. /**
  3593. * ------------------------------------------------------------------------
  3594. * jQuery
  3595. * ------------------------------------------------------------------------
  3596. */
  3597. $.fn[NAME$2] = Carousel._jQueryInterface;
  3598. $.fn[NAME$2].Constructor = Carousel;
  3599. $.fn[NAME$2].noConflict = function () {
  3600. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3601. return Carousel._jQueryInterface;
  3602. };
  3603. /**
  3604. * ------------------------------------------------------------------------
  3605. * Constants
  3606. * ------------------------------------------------------------------------
  3607. */
  3608. var NAME$3 = 'collapse';
  3609. var VERSION$3 = '4.4.1';
  3610. var DATA_KEY$3 = 'bs.collapse';
  3611. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3612. var DATA_API_KEY$3 = '.data-api';
  3613. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3614. var Default$1 = {
  3615. toggle: true,
  3616. parent: ''
  3617. };
  3618. var DefaultType$1 = {
  3619. toggle: 'boolean',
  3620. parent: '(string|element)'
  3621. };
  3622. var Event$3 = {
  3623. SHOW: "show" + EVENT_KEY$3,
  3624. SHOWN: "shown" + EVENT_KEY$3,
  3625. HIDE: "hide" + EVENT_KEY$3,
  3626. HIDDEN: "hidden" + EVENT_KEY$3,
  3627. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3628. };
  3629. var ClassName$3 = {
  3630. SHOW: 'show',
  3631. COLLAPSE: 'collapse',
  3632. COLLAPSING: 'collapsing',
  3633. COLLAPSED: 'collapsed'
  3634. };
  3635. var Dimension = {
  3636. WIDTH: 'width',
  3637. HEIGHT: 'height'
  3638. };
  3639. var Selector$3 = {
  3640. ACTIVES: '.show, .collapsing',
  3641. DATA_TOGGLE: '[data-toggle="collapse"]'
  3642. };
  3643. /**
  3644. * ------------------------------------------------------------------------
  3645. * Class Definition
  3646. * ------------------------------------------------------------------------
  3647. */
  3648. var Collapse =
  3649. /*#__PURE__*/
  3650. function () {
  3651. function Collapse(element, config) {
  3652. this._isTransitioning = false;
  3653. this._element = element;
  3654. this._config = this._getConfig(config);
  3655. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3656. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3657. for (var i = 0, len = toggleList.length; i < len; i++) {
  3658. var elem = toggleList[i];
  3659. var selector = Util.getSelectorFromElement(elem);
  3660. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3661. return foundElem === element;
  3662. });
  3663. if (selector !== null && filterElement.length > 0) {
  3664. this._selector = selector;
  3665. this._triggerArray.push(elem);
  3666. }
  3667. }
  3668. this._parent = this._config.parent ? this._getParent() : null;
  3669. if (!this._config.parent) {
  3670. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3671. }
  3672. if (this._config.toggle) {
  3673. this.toggle();
  3674. }
  3675. } // Getters
  3676. var _proto = Collapse.prototype;
  3677. // Public
  3678. _proto.toggle = function toggle() {
  3679. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3680. this.hide();
  3681. } else {
  3682. this.show();
  3683. }
  3684. };
  3685. _proto.show = function show() {
  3686. var _this = this;
  3687. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3688. return;
  3689. }
  3690. var actives;
  3691. var activesData;
  3692. if (this._parent) {
  3693. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3694. if (typeof _this._config.parent === 'string') {
  3695. return elem.getAttribute('data-parent') === _this._config.parent;
  3696. }
  3697. return elem.classList.contains(ClassName$3.COLLAPSE);
  3698. });
  3699. if (actives.length === 0) {
  3700. actives = null;
  3701. }
  3702. }
  3703. if (actives) {
  3704. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3705. if (activesData && activesData._isTransitioning) {
  3706. return;
  3707. }
  3708. }
  3709. var startEvent = $.Event(Event$3.SHOW);
  3710. $(this._element).trigger(startEvent);
  3711. if (startEvent.isDefaultPrevented()) {
  3712. return;
  3713. }
  3714. if (actives) {
  3715. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3716. if (!activesData) {
  3717. $(actives).data(DATA_KEY$3, null);
  3718. }
  3719. }
  3720. var dimension = this._getDimension();
  3721. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3722. this._element.style[dimension] = 0;
  3723. if (this._triggerArray.length) {
  3724. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3725. }
  3726. this.setTransitioning(true);
  3727. var complete = function complete() {
  3728. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3729. _this._element.style[dimension] = '';
  3730. _this.setTransitioning(false);
  3731. $(_this._element).trigger(Event$3.SHOWN);
  3732. };
  3733. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3734. var scrollSize = "scroll" + capitalizedDimension;
  3735. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3736. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3737. this._element.style[dimension] = this._element[scrollSize] + "px";
  3738. };
  3739. _proto.hide = function hide() {
  3740. var _this2 = this;
  3741. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3742. return;
  3743. }
  3744. var startEvent = $.Event(Event$3.HIDE);
  3745. $(this._element).trigger(startEvent);
  3746. if (startEvent.isDefaultPrevented()) {
  3747. return;
  3748. }
  3749. var dimension = this._getDimension();
  3750. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3751. Util.reflow(this._element);
  3752. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3753. var triggerArrayLength = this._triggerArray.length;
  3754. if (triggerArrayLength > 0) {
  3755. for (var i = 0; i < triggerArrayLength; i++) {
  3756. var trigger = this._triggerArray[i];
  3757. var selector = Util.getSelectorFromElement(trigger);
  3758. if (selector !== null) {
  3759. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3760. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3761. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3762. }
  3763. }
  3764. }
  3765. }
  3766. this.setTransitioning(true);
  3767. var complete = function complete() {
  3768. _this2.setTransitioning(false);
  3769. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3770. };
  3771. this._element.style[dimension] = '';
  3772. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3773. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3774. };
  3775. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3776. this._isTransitioning = isTransitioning;
  3777. };
  3778. _proto.dispose = function dispose() {
  3779. $.removeData(this._element, DATA_KEY$3);
  3780. this._config = null;
  3781. this._parent = null;
  3782. this._element = null;
  3783. this._triggerArray = null;
  3784. this._isTransitioning = null;
  3785. } // Private
  3786. ;
  3787. _proto._getConfig = function _getConfig(config) {
  3788. config = _objectSpread2({}, Default$1, {}, config);
  3789. config.toggle = Boolean(config.toggle); // Coerce string values
  3790. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3791. return config;
  3792. };
  3793. _proto._getDimension = function _getDimension() {
  3794. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3795. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3796. };
  3797. _proto._getParent = function _getParent() {
  3798. var _this3 = this;
  3799. var parent;
  3800. if (Util.isElement(this._config.parent)) {
  3801. parent = this._config.parent; // It's a jQuery object
  3802. if (typeof this._config.parent.jquery !== 'undefined') {
  3803. parent = this._config.parent[0];
  3804. }
  3805. } else {
  3806. parent = document.querySelector(this._config.parent);
  3807. }
  3808. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3809. var children = [].slice.call(parent.querySelectorAll(selector));
  3810. $(children).each(function (i, element) {
  3811. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3812. });
  3813. return parent;
  3814. };
  3815. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3816. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3817. if (triggerArray.length) {
  3818. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3819. }
  3820. } // Static
  3821. ;
  3822. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3823. var selector = Util.getSelectorFromElement(element);
  3824. return selector ? document.querySelector(selector) : null;
  3825. };
  3826. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3827. return this.each(function () {
  3828. var $this = $(this);
  3829. var data = $this.data(DATA_KEY$3);
  3830. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3831. if (!data && _config.toggle && /show|hide/.test(config)) {
  3832. _config.toggle = false;
  3833. }
  3834. if (!data) {
  3835. data = new Collapse(this, _config);
  3836. $this.data(DATA_KEY$3, data);
  3837. }
  3838. if (typeof config === 'string') {
  3839. if (typeof data[config] === 'undefined') {
  3840. throw new TypeError("No method named \"" + config + "\"");
  3841. }
  3842. data[config]();
  3843. }
  3844. });
  3845. };
  3846. _createClass(Collapse, null, [{
  3847. key: "VERSION",
  3848. get: function get() {
  3849. return VERSION$3;
  3850. }
  3851. }, {
  3852. key: "Default",
  3853. get: function get() {
  3854. return Default$1;
  3855. }
  3856. }]);
  3857. return Collapse;
  3858. }();
  3859. /**
  3860. * ------------------------------------------------------------------------
  3861. * Data Api implementation
  3862. * ------------------------------------------------------------------------
  3863. */
  3864. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3865. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3866. if (event.currentTarget.tagName === 'A') {
  3867. event.preventDefault();
  3868. }
  3869. var $trigger = $(this);
  3870. var selector = Util.getSelectorFromElement(this);
  3871. var selectors = [].slice.call(document.querySelectorAll(selector));
  3872. $(selectors).each(function () {
  3873. var $target = $(this);
  3874. var data = $target.data(DATA_KEY$3);
  3875. var config = data ? 'toggle' : $trigger.data();
  3876. Collapse._jQueryInterface.call($target, config);
  3877. });
  3878. });
  3879. /**
  3880. * ------------------------------------------------------------------------
  3881. * jQuery
  3882. * ------------------------------------------------------------------------
  3883. */
  3884. $.fn[NAME$3] = Collapse._jQueryInterface;
  3885. $.fn[NAME$3].Constructor = Collapse;
  3886. $.fn[NAME$3].noConflict = function () {
  3887. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3888. return Collapse._jQueryInterface;
  3889. };
  3890. /**
  3891. * ------------------------------------------------------------------------
  3892. * Constants
  3893. * ------------------------------------------------------------------------
  3894. */
  3895. var NAME$4 = 'dropdown';
  3896. var VERSION$4 = '4.4.1';
  3897. var DATA_KEY$4 = 'bs.dropdown';
  3898. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3899. var DATA_API_KEY$4 = '.data-api';
  3900. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3901. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3902. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3903. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3904. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3905. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3906. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3907. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3908. var Event$4 = {
  3909. HIDE: "hide" + EVENT_KEY$4,
  3910. HIDDEN: "hidden" + EVENT_KEY$4,
  3911. SHOW: "show" + EVENT_KEY$4,
  3912. SHOWN: "shown" + EVENT_KEY$4,
  3913. CLICK: "click" + EVENT_KEY$4,
  3914. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3915. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3916. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3917. };
  3918. var ClassName$4 = {
  3919. DISABLED: 'disabled',
  3920. SHOW: 'show',
  3921. DROPUP: 'dropup',
  3922. DROPRIGHT: 'dropright',
  3923. DROPLEFT: 'dropleft',
  3924. MENURIGHT: 'dropdown-menu-right',
  3925. MENULEFT: 'dropdown-menu-left',
  3926. POSITION_STATIC: 'position-static'
  3927. };
  3928. var Selector$4 = {
  3929. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3930. FORM_CHILD: '.dropdown form',
  3931. MENU: '.dropdown-menu',
  3932. NAVBAR_NAV: '.navbar-nav',
  3933. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3934. };
  3935. var AttachmentMap = {
  3936. TOP: 'top-start',
  3937. TOPEND: 'top-end',
  3938. BOTTOM: 'bottom-start',
  3939. BOTTOMEND: 'bottom-end',
  3940. RIGHT: 'right-start',
  3941. RIGHTEND: 'right-end',
  3942. LEFT: 'left-start',
  3943. LEFTEND: 'left-end'
  3944. };
  3945. var Default$2 = {
  3946. offset: 0,
  3947. flip: true,
  3948. boundary: 'scrollParent',
  3949. reference: 'toggle',
  3950. display: 'dynamic',
  3951. popperConfig: null
  3952. };
  3953. var DefaultType$2 = {
  3954. offset: '(number|string|function)',
  3955. flip: 'boolean',
  3956. boundary: '(string|element)',
  3957. reference: '(string|element)',
  3958. display: 'string',
  3959. popperConfig: '(null|object)'
  3960. };
  3961. /**
  3962. * ------------------------------------------------------------------------
  3963. * Class Definition
  3964. * ------------------------------------------------------------------------
  3965. */
  3966. var Dropdown =
  3967. /*#__PURE__*/
  3968. function () {
  3969. function Dropdown(element, config) {
  3970. this._element = element;
  3971. this._popper = null;
  3972. this._config = this._getConfig(config);
  3973. this._menu = this._getMenuElement();
  3974. this._inNavbar = this._detectNavbar();
  3975. this._addEventListeners();
  3976. } // Getters
  3977. var _proto = Dropdown.prototype;
  3978. // Public
  3979. _proto.toggle = function toggle() {
  3980. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3981. return;
  3982. }
  3983. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3984. Dropdown._clearMenus();
  3985. if (isActive) {
  3986. return;
  3987. }
  3988. this.show(true);
  3989. };
  3990. _proto.show = function show(usePopper) {
  3991. if (usePopper === void 0) {
  3992. usePopper = false;
  3993. }
  3994. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3995. return;
  3996. }
  3997. var relatedTarget = {
  3998. relatedTarget: this._element
  3999. };
  4000. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4001. var parent = Dropdown._getParentFromElement(this._element);
  4002. $(parent).trigger(showEvent);
  4003. if (showEvent.isDefaultPrevented()) {
  4004. return;
  4005. } // Disable totally Popper.js for Dropdown in Navbar
  4006. if (!this._inNavbar && usePopper) {
  4007. /**
  4008. * Check for Popper dependency
  4009. * Popper - https://popper.js.org
  4010. */
  4011. if (typeof Popper === 'undefined') {
  4012. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4013. }
  4014. var referenceElement = this._element;
  4015. if (this._config.reference === 'parent') {
  4016. referenceElement = parent;
  4017. } else if (Util.isElement(this._config.reference)) {
  4018. referenceElement = this._config.reference; // Check if it's jQuery element
  4019. if (typeof this._config.reference.jquery !== 'undefined') {
  4020. referenceElement = this._config.reference[0];
  4021. }
  4022. } // If boundary is not `scrollParent`, then set position to `static`
  4023. // to allow the menu to "escape" the scroll parent's boundaries
  4024. // https://github.com/twbs/bootstrap/issues/24251
  4025. if (this._config.boundary !== 'scrollParent') {
  4026. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4027. }
  4028. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4029. } // If this is a touch-enabled device we add extra
  4030. // empty mouseover listeners to the body's immediate children;
  4031. // only needed because of broken event delegation on iOS
  4032. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4033. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4034. $(document.body).children().on('mouseover', null, $.noop);
  4035. }
  4036. this._element.focus();
  4037. this._element.setAttribute('aria-expanded', true);
  4038. $(this._menu).toggleClass(ClassName$4.SHOW);
  4039. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4040. };
  4041. _proto.hide = function hide() {
  4042. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4043. return;
  4044. }
  4045. var relatedTarget = {
  4046. relatedTarget: this._element
  4047. };
  4048. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4049. var parent = Dropdown._getParentFromElement(this._element);
  4050. $(parent).trigger(hideEvent);
  4051. if (hideEvent.isDefaultPrevented()) {
  4052. return;
  4053. }
  4054. if (this._popper) {
  4055. this._popper.destroy();
  4056. }
  4057. $(this._menu).toggleClass(ClassName$4.SHOW);
  4058. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4059. };
  4060. _proto.dispose = function dispose() {
  4061. $.removeData(this._element, DATA_KEY$4);
  4062. $(this._element).off(EVENT_KEY$4);
  4063. this._element = null;
  4064. this._menu = null;
  4065. if (this._popper !== null) {
  4066. this._popper.destroy();
  4067. this._popper = null;
  4068. }
  4069. };
  4070. _proto.update = function update() {
  4071. this._inNavbar = this._detectNavbar();
  4072. if (this._popper !== null) {
  4073. this._popper.scheduleUpdate();
  4074. }
  4075. } // Private
  4076. ;
  4077. _proto._addEventListeners = function _addEventListeners() {
  4078. var _this = this;
  4079. $(this._element).on(Event$4.CLICK, function (event) {
  4080. event.preventDefault();
  4081. event.stopPropagation();
  4082. _this.toggle();
  4083. });
  4084. };
  4085. _proto._getConfig = function _getConfig(config) {
  4086. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4087. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4088. return config;
  4089. };
  4090. _proto._getMenuElement = function _getMenuElement() {
  4091. if (!this._menu) {
  4092. var parent = Dropdown._getParentFromElement(this._element);
  4093. if (parent) {
  4094. this._menu = parent.querySelector(Selector$4.MENU);
  4095. }
  4096. }
  4097. return this._menu;
  4098. };
  4099. _proto._getPlacement = function _getPlacement() {
  4100. var $parentDropdown = $(this._element.parentNode);
  4101. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4102. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4103. placement = AttachmentMap.TOP;
  4104. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4105. placement = AttachmentMap.TOPEND;
  4106. }
  4107. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4108. placement = AttachmentMap.RIGHT;
  4109. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4110. placement = AttachmentMap.LEFT;
  4111. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4112. placement = AttachmentMap.BOTTOMEND;
  4113. }
  4114. return placement;
  4115. };
  4116. _proto._detectNavbar = function _detectNavbar() {
  4117. return $(this._element).closest('.navbar').length > 0;
  4118. };
  4119. _proto._getOffset = function _getOffset() {
  4120. var _this2 = this;
  4121. var offset = {};
  4122. if (typeof this._config.offset === 'function') {
  4123. offset.fn = function (data) {
  4124. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4125. return data;
  4126. };
  4127. } else {
  4128. offset.offset = this._config.offset;
  4129. }
  4130. return offset;
  4131. };
  4132. _proto._getPopperConfig = function _getPopperConfig() {
  4133. var popperConfig = {
  4134. placement: this._getPlacement(),
  4135. modifiers: {
  4136. offset: this._getOffset(),
  4137. flip: {
  4138. enabled: this._config.flip
  4139. },
  4140. preventOverflow: {
  4141. boundariesElement: this._config.boundary
  4142. }
  4143. }
  4144. }; // Disable Popper.js if we have a static display
  4145. if (this._config.display === 'static') {
  4146. popperConfig.modifiers.applyStyle = {
  4147. enabled: false
  4148. };
  4149. }
  4150. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4151. } // Static
  4152. ;
  4153. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4154. return this.each(function () {
  4155. var data = $(this).data(DATA_KEY$4);
  4156. var _config = typeof config === 'object' ? config : null;
  4157. if (!data) {
  4158. data = new Dropdown(this, _config);
  4159. $(this).data(DATA_KEY$4, data);
  4160. }
  4161. if (typeof config === 'string') {
  4162. if (typeof data[config] === 'undefined') {
  4163. throw new TypeError("No method named \"" + config + "\"");
  4164. }
  4165. data[config]();
  4166. }
  4167. });
  4168. };
  4169. Dropdown._clearMenus = function _clearMenus(event) {
  4170. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4171. return;
  4172. }
  4173. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4174. for (var i = 0, len = toggles.length; i < len; i++) {
  4175. var parent = Dropdown._getParentFromElement(toggles[i]);
  4176. var context = $(toggles[i]).data(DATA_KEY$4);
  4177. var relatedTarget = {
  4178. relatedTarget: toggles[i]
  4179. };
  4180. if (event && event.type === 'click') {
  4181. relatedTarget.clickEvent = event;
  4182. }
  4183. if (!context) {
  4184. continue;
  4185. }
  4186. var dropdownMenu = context._menu;
  4187. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4188. continue;
  4189. }
  4190. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4191. continue;
  4192. }
  4193. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4194. $(parent).trigger(hideEvent);
  4195. if (hideEvent.isDefaultPrevented()) {
  4196. continue;
  4197. } // If this is a touch-enabled device we remove the extra
  4198. // empty mouseover listeners we added for iOS support
  4199. if ('ontouchstart' in document.documentElement) {
  4200. $(document.body).children().off('mouseover', null, $.noop);
  4201. }
  4202. toggles[i].setAttribute('aria-expanded', 'false');
  4203. if (context._popper) {
  4204. context._popper.destroy();
  4205. }
  4206. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4207. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4208. }
  4209. };
  4210. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4211. var parent;
  4212. var selector = Util.getSelectorFromElement(element);
  4213. if (selector) {
  4214. parent = document.querySelector(selector);
  4215. }
  4216. return parent || element.parentNode;
  4217. } // eslint-disable-next-line complexity
  4218. ;
  4219. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4220. // If not input/textarea:
  4221. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4222. // If input/textarea:
  4223. // - If space key => not a dropdown command
  4224. // - If key is other than escape
  4225. // - If key is not up or down => not a dropdown command
  4226. // - If trigger inside the menu => not a dropdown command
  4227. 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)) {
  4228. return;
  4229. }
  4230. event.preventDefault();
  4231. event.stopPropagation();
  4232. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4233. return;
  4234. }
  4235. var parent = Dropdown._getParentFromElement(this);
  4236. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4237. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4238. return;
  4239. }
  4240. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4241. if (event.which === ESCAPE_KEYCODE) {
  4242. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4243. $(toggle).trigger('focus');
  4244. }
  4245. $(this).trigger('click');
  4246. return;
  4247. }
  4248. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4249. return $(item).is(':visible');
  4250. });
  4251. if (items.length === 0) {
  4252. return;
  4253. }
  4254. var index = items.indexOf(event.target);
  4255. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4256. // Up
  4257. index--;
  4258. }
  4259. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4260. // Down
  4261. index++;
  4262. }
  4263. if (index < 0) {
  4264. index = 0;
  4265. }
  4266. items[index].focus();
  4267. };
  4268. _createClass(Dropdown, null, [{
  4269. key: "VERSION",
  4270. get: function get() {
  4271. return VERSION$4;
  4272. }
  4273. }, {
  4274. key: "Default",
  4275. get: function get() {
  4276. return Default$2;
  4277. }
  4278. }, {
  4279. key: "DefaultType",
  4280. get: function get() {
  4281. return DefaultType$2;
  4282. }
  4283. }]);
  4284. return Dropdown;
  4285. }();
  4286. /**
  4287. * ------------------------------------------------------------------------
  4288. * Data Api implementation
  4289. * ------------------------------------------------------------------------
  4290. */
  4291. $(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) {
  4292. event.preventDefault();
  4293. event.stopPropagation();
  4294. Dropdown._jQueryInterface.call($(this), 'toggle');
  4295. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4296. e.stopPropagation();
  4297. });
  4298. /**
  4299. * ------------------------------------------------------------------------
  4300. * jQuery
  4301. * ------------------------------------------------------------------------
  4302. */
  4303. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4304. $.fn[NAME$4].Constructor = Dropdown;
  4305. $.fn[NAME$4].noConflict = function () {
  4306. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4307. return Dropdown._jQueryInterface;
  4308. };
  4309. /**
  4310. * ------------------------------------------------------------------------
  4311. * Constants
  4312. * ------------------------------------------------------------------------
  4313. */
  4314. var NAME$5 = 'modal';
  4315. var VERSION$5 = '4.4.1';
  4316. var DATA_KEY$5 = 'bs.modal';
  4317. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4318. var DATA_API_KEY$5 = '.data-api';
  4319. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4320. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4321. var Default$3 = {
  4322. backdrop: true,
  4323. keyboard: true,
  4324. focus: true,
  4325. show: true
  4326. };
  4327. var DefaultType$3 = {
  4328. backdrop: '(boolean|string)',
  4329. keyboard: 'boolean',
  4330. focus: 'boolean',
  4331. show: 'boolean'
  4332. };
  4333. var Event$5 = {
  4334. HIDE: "hide" + EVENT_KEY$5,
  4335. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4336. HIDDEN: "hidden" + EVENT_KEY$5,
  4337. SHOW: "show" + EVENT_KEY$5,
  4338. SHOWN: "shown" + EVENT_KEY$5,
  4339. FOCUSIN: "focusin" + EVENT_KEY$5,
  4340. RESIZE: "resize" + EVENT_KEY$5,
  4341. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4342. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4343. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4344. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4345. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4346. };
  4347. var ClassName$5 = {
  4348. SCROLLABLE: 'modal-dialog-scrollable',
  4349. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4350. BACKDROP: 'modal-backdrop',
  4351. OPEN: 'modal-open',
  4352. FADE: 'fade',
  4353. SHOW: 'show',
  4354. STATIC: 'modal-static'
  4355. };
  4356. var Selector$5 = {
  4357. DIALOG: '.modal-dialog',
  4358. MODAL_BODY: '.modal-body',
  4359. DATA_TOGGLE: '[data-toggle="modal"]',
  4360. DATA_DISMISS: '[data-dismiss="modal"]',
  4361. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4362. STICKY_CONTENT: '.sticky-top'
  4363. };
  4364. /**
  4365. * ------------------------------------------------------------------------
  4366. * Class Definition
  4367. * ------------------------------------------------------------------------
  4368. */
  4369. var Modal =
  4370. /*#__PURE__*/
  4371. function () {
  4372. function Modal(element, config) {
  4373. this._config = this._getConfig(config);
  4374. this._element = element;
  4375. this._dialog = element.querySelector(Selector$5.DIALOG);
  4376. this._backdrop = null;
  4377. this._isShown = false;
  4378. this._isBodyOverflowing = false;
  4379. this._ignoreBackdropClick = false;
  4380. this._isTransitioning = false;
  4381. this._scrollbarWidth = 0;
  4382. } // Getters
  4383. var _proto = Modal.prototype;
  4384. // Public
  4385. _proto.toggle = function toggle(relatedTarget) {
  4386. return this._isShown ? this.hide() : this.show(relatedTarget);
  4387. };
  4388. _proto.show = function show(relatedTarget) {
  4389. var _this = this;
  4390. if (this._isShown || this._isTransitioning) {
  4391. return;
  4392. }
  4393. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4394. this._isTransitioning = true;
  4395. }
  4396. var showEvent = $.Event(Event$5.SHOW, {
  4397. relatedTarget: relatedTarget
  4398. });
  4399. $(this._element).trigger(showEvent);
  4400. if (this._isShown || showEvent.isDefaultPrevented()) {
  4401. return;
  4402. }
  4403. this._isShown = true;
  4404. this._checkScrollbar();
  4405. this._setScrollbar();
  4406. this._adjustDialog();
  4407. this._setEscapeEvent();
  4408. this._setResizeEvent();
  4409. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4410. return _this.hide(event);
  4411. });
  4412. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4413. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4414. if ($(event.target).is(_this._element)) {
  4415. _this._ignoreBackdropClick = true;
  4416. }
  4417. });
  4418. });
  4419. this._showBackdrop(function () {
  4420. return _this._showElement(relatedTarget);
  4421. });
  4422. };
  4423. _proto.hide = function hide(event) {
  4424. var _this2 = this;
  4425. if (event) {
  4426. event.preventDefault();
  4427. }
  4428. if (!this._isShown || this._isTransitioning) {
  4429. return;
  4430. }
  4431. var hideEvent = $.Event(Event$5.HIDE);
  4432. $(this._element).trigger(hideEvent);
  4433. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4434. return;
  4435. }
  4436. this._isShown = false;
  4437. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4438. if (transition) {
  4439. this._isTransitioning = true;
  4440. }
  4441. this._setEscapeEvent();
  4442. this._setResizeEvent();
  4443. $(document).off(Event$5.FOCUSIN);
  4444. $(this._element).removeClass(ClassName$5.SHOW);
  4445. $(this._element).off(Event$5.CLICK_DISMISS);
  4446. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4447. if (transition) {
  4448. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4449. $(this._element).one(Util.TRANSITION_END, function (event) {
  4450. return _this2._hideModal(event);
  4451. }).emulateTransitionEnd(transitionDuration);
  4452. } else {
  4453. this._hideModal();
  4454. }
  4455. };
  4456. _proto.dispose = function dispose() {
  4457. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4458. return $(htmlElement).off(EVENT_KEY$5);
  4459. });
  4460. /**
  4461. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4462. * Do not move `document` in `htmlElements` array
  4463. * It will remove `Event.CLICK_DATA_API` event that should remain
  4464. */
  4465. $(document).off(Event$5.FOCUSIN);
  4466. $.removeData(this._element, DATA_KEY$5);
  4467. this._config = null;
  4468. this._element = null;
  4469. this._dialog = null;
  4470. this._backdrop = null;
  4471. this._isShown = null;
  4472. this._isBodyOverflowing = null;
  4473. this._ignoreBackdropClick = null;
  4474. this._isTransitioning = null;
  4475. this._scrollbarWidth = null;
  4476. };
  4477. _proto.handleUpdate = function handleUpdate() {
  4478. this._adjustDialog();
  4479. } // Private
  4480. ;
  4481. _proto._getConfig = function _getConfig(config) {
  4482. config = _objectSpread2({}, Default$3, {}, config);
  4483. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4484. return config;
  4485. };
  4486. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4487. var _this3 = this;
  4488. if (this._config.backdrop === 'static') {
  4489. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4490. $(this._element).trigger(hideEventPrevented);
  4491. if (hideEventPrevented.defaultPrevented) {
  4492. return;
  4493. }
  4494. this._element.classList.add(ClassName$5.STATIC);
  4495. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4496. $(this._element).one(Util.TRANSITION_END, function () {
  4497. _this3._element.classList.remove(ClassName$5.STATIC);
  4498. }).emulateTransitionEnd(modalTransitionDuration);
  4499. this._element.focus();
  4500. } else {
  4501. this.hide();
  4502. }
  4503. };
  4504. _proto._showElement = function _showElement(relatedTarget) {
  4505. var _this4 = this;
  4506. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4507. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4508. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4509. // Don't move modal's DOM position
  4510. document.body.appendChild(this._element);
  4511. }
  4512. this._element.style.display = 'block';
  4513. this._element.removeAttribute('aria-hidden');
  4514. this._element.setAttribute('aria-modal', true);
  4515. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4516. modalBody.scrollTop = 0;
  4517. } else {
  4518. this._element.scrollTop = 0;
  4519. }
  4520. if (transition) {
  4521. Util.reflow(this._element);
  4522. }
  4523. $(this._element).addClass(ClassName$5.SHOW);
  4524. if (this._config.focus) {
  4525. this._enforceFocus();
  4526. }
  4527. var shownEvent = $.Event(Event$5.SHOWN, {
  4528. relatedTarget: relatedTarget
  4529. });
  4530. var transitionComplete = function transitionComplete() {
  4531. if (_this4._config.focus) {
  4532. _this4._element.focus();
  4533. }
  4534. _this4._isTransitioning = false;
  4535. $(_this4._element).trigger(shownEvent);
  4536. };
  4537. if (transition) {
  4538. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4539. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4540. } else {
  4541. transitionComplete();
  4542. }
  4543. };
  4544. _proto._enforceFocus = function _enforceFocus() {
  4545. var _this5 = this;
  4546. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4547. .on(Event$5.FOCUSIN, function (event) {
  4548. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4549. _this5._element.focus();
  4550. }
  4551. });
  4552. };
  4553. _proto._setEscapeEvent = function _setEscapeEvent() {
  4554. var _this6 = this;
  4555. if (this._isShown && this._config.keyboard) {
  4556. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4557. if (event.which === ESCAPE_KEYCODE$1) {
  4558. _this6._triggerBackdropTransition();
  4559. }
  4560. });
  4561. } else if (!this._isShown) {
  4562. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4563. }
  4564. };
  4565. _proto._setResizeEvent = function _setResizeEvent() {
  4566. var _this7 = this;
  4567. if (this._isShown) {
  4568. $(window).on(Event$5.RESIZE, function (event) {
  4569. return _this7.handleUpdate(event);
  4570. });
  4571. } else {
  4572. $(window).off(Event$5.RESIZE);
  4573. }
  4574. };
  4575. _proto._hideModal = function _hideModal() {
  4576. var _this8 = this;
  4577. this._element.style.display = 'none';
  4578. this._element.setAttribute('aria-hidden', true);
  4579. this._element.removeAttribute('aria-modal');
  4580. this._isTransitioning = false;
  4581. this._showBackdrop(function () {
  4582. $(document.body).removeClass(ClassName$5.OPEN);
  4583. _this8._resetAdjustments();
  4584. _this8._resetScrollbar();
  4585. $(_this8._element).trigger(Event$5.HIDDEN);
  4586. });
  4587. };
  4588. _proto._removeBackdrop = function _removeBackdrop() {
  4589. if (this._backdrop) {
  4590. $(this._backdrop).remove();
  4591. this._backdrop = null;
  4592. }
  4593. };
  4594. _proto._showBackdrop = function _showBackdrop(callback) {
  4595. var _this9 = this;
  4596. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4597. if (this._isShown && this._config.backdrop) {
  4598. this._backdrop = document.createElement('div');
  4599. this._backdrop.className = ClassName$5.BACKDROP;
  4600. if (animate) {
  4601. this._backdrop.classList.add(animate);
  4602. }
  4603. $(this._backdrop).appendTo(document.body);
  4604. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4605. if (_this9._ignoreBackdropClick) {
  4606. _this9._ignoreBackdropClick = false;
  4607. return;
  4608. }
  4609. if (event.target !== event.currentTarget) {
  4610. return;
  4611. }
  4612. _this9._triggerBackdropTransition();
  4613. });
  4614. if (animate) {
  4615. Util.reflow(this._backdrop);
  4616. }
  4617. $(this._backdrop).addClass(ClassName$5.SHOW);
  4618. if (!callback) {
  4619. return;
  4620. }
  4621. if (!animate) {
  4622. callback();
  4623. return;
  4624. }
  4625. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4626. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4627. } else if (!this._isShown && this._backdrop) {
  4628. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4629. var callbackRemove = function callbackRemove() {
  4630. _this9._removeBackdrop();
  4631. if (callback) {
  4632. callback();
  4633. }
  4634. };
  4635. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4636. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4637. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4638. } else {
  4639. callbackRemove();
  4640. }
  4641. } else if (callback) {
  4642. callback();
  4643. }
  4644. } // ----------------------------------------------------------------------
  4645. // the following methods are used to handle overflowing modals
  4646. // todo (fat): these should probably be refactored out of modal.js
  4647. // ----------------------------------------------------------------------
  4648. ;
  4649. _proto._adjustDialog = function _adjustDialog() {
  4650. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4651. if (!this._isBodyOverflowing && isModalOverflowing) {
  4652. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4653. }
  4654. if (this._isBodyOverflowing && !isModalOverflowing) {
  4655. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4656. }
  4657. };
  4658. _proto._resetAdjustments = function _resetAdjustments() {
  4659. this._element.style.paddingLeft = '';
  4660. this._element.style.paddingRight = '';
  4661. };
  4662. _proto._checkScrollbar = function _checkScrollbar() {
  4663. var rect = document.body.getBoundingClientRect();
  4664. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4665. this._scrollbarWidth = this._getScrollbarWidth();
  4666. };
  4667. _proto._setScrollbar = function _setScrollbar() {
  4668. var _this10 = this;
  4669. if (this._isBodyOverflowing) {
  4670. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4671. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4672. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4673. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4674. $(fixedContent).each(function (index, element) {
  4675. var actualPadding = element.style.paddingRight;
  4676. var calculatedPadding = $(element).css('padding-right');
  4677. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4678. }); // Adjust sticky content margin
  4679. $(stickyContent).each(function (index, element) {
  4680. var actualMargin = element.style.marginRight;
  4681. var calculatedMargin = $(element).css('margin-right');
  4682. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4683. }); // Adjust body padding
  4684. var actualPadding = document.body.style.paddingRight;
  4685. var calculatedPadding = $(document.body).css('padding-right');
  4686. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4687. }
  4688. $(document.body).addClass(ClassName$5.OPEN);
  4689. };
  4690. _proto._resetScrollbar = function _resetScrollbar() {
  4691. // Restore fixed content padding
  4692. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4693. $(fixedContent).each(function (index, element) {
  4694. var padding = $(element).data('padding-right');
  4695. $(element).removeData('padding-right');
  4696. element.style.paddingRight = padding ? padding : '';
  4697. }); // Restore sticky content
  4698. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4699. $(elements).each(function (index, element) {
  4700. var margin = $(element).data('margin-right');
  4701. if (typeof margin !== 'undefined') {
  4702. $(element).css('margin-right', margin).removeData('margin-right');
  4703. }
  4704. }); // Restore body padding
  4705. var padding = $(document.body).data('padding-right');
  4706. $(document.body).removeData('padding-right');
  4707. document.body.style.paddingRight = padding ? padding : '';
  4708. };
  4709. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4710. // thx d.walsh
  4711. var scrollDiv = document.createElement('div');
  4712. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4713. document.body.appendChild(scrollDiv);
  4714. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4715. document.body.removeChild(scrollDiv);
  4716. return scrollbarWidth;
  4717. } // Static
  4718. ;
  4719. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4720. return this.each(function () {
  4721. var data = $(this).data(DATA_KEY$5);
  4722. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4723. if (!data) {
  4724. data = new Modal(this, _config);
  4725. $(this).data(DATA_KEY$5, data);
  4726. }
  4727. if (typeof config === 'string') {
  4728. if (typeof data[config] === 'undefined') {
  4729. throw new TypeError("No method named \"" + config + "\"");
  4730. }
  4731. data[config](relatedTarget);
  4732. } else if (_config.show) {
  4733. data.show(relatedTarget);
  4734. }
  4735. });
  4736. };
  4737. _createClass(Modal, null, [{
  4738. key: "VERSION",
  4739. get: function get() {
  4740. return VERSION$5;
  4741. }
  4742. }, {
  4743. key: "Default",
  4744. get: function get() {
  4745. return Default$3;
  4746. }
  4747. }]);
  4748. return Modal;
  4749. }();
  4750. /**
  4751. * ------------------------------------------------------------------------
  4752. * Data Api implementation
  4753. * ------------------------------------------------------------------------
  4754. */
  4755. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4756. var _this11 = this;
  4757. var target;
  4758. var selector = Util.getSelectorFromElement(this);
  4759. if (selector) {
  4760. target = document.querySelector(selector);
  4761. }
  4762. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4763. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4764. event.preventDefault();
  4765. }
  4766. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4767. if (showEvent.isDefaultPrevented()) {
  4768. // Only register focus restorer if modal will actually get shown
  4769. return;
  4770. }
  4771. $target.one(Event$5.HIDDEN, function () {
  4772. if ($(_this11).is(':visible')) {
  4773. _this11.focus();
  4774. }
  4775. });
  4776. });
  4777. Modal._jQueryInterface.call($(target), config, this);
  4778. });
  4779. /**
  4780. * ------------------------------------------------------------------------
  4781. * jQuery
  4782. * ------------------------------------------------------------------------
  4783. */
  4784. $.fn[NAME$5] = Modal._jQueryInterface;
  4785. $.fn[NAME$5].Constructor = Modal;
  4786. $.fn[NAME$5].noConflict = function () {
  4787. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4788. return Modal._jQueryInterface;
  4789. };
  4790. /**
  4791. * --------------------------------------------------------------------------
  4792. * Bootstrap (v4.4.1): tools/sanitizer.js
  4793. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4794. * --------------------------------------------------------------------------
  4795. */
  4796. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4797. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4798. var DefaultWhitelist = {
  4799. // Global attributes allowed on any supplied element below.
  4800. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4801. a: ['target', 'href', 'title', 'rel'],
  4802. area: [],
  4803. b: [],
  4804. br: [],
  4805. col: [],
  4806. code: [],
  4807. div: [],
  4808. em: [],
  4809. hr: [],
  4810. h1: [],
  4811. h2: [],
  4812. h3: [],
  4813. h4: [],
  4814. h5: [],
  4815. h6: [],
  4816. i: [],
  4817. img: ['src', 'alt', 'title', 'width', 'height'],
  4818. li: [],
  4819. ol: [],
  4820. p: [],
  4821. pre: [],
  4822. s: [],
  4823. small: [],
  4824. span: [],
  4825. sub: [],
  4826. sup: [],
  4827. strong: [],
  4828. u: [],
  4829. ul: []
  4830. };
  4831. /**
  4832. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4833. *
  4834. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4835. */
  4836. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4837. /**
  4838. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4839. *
  4840. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4841. */
  4842. 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;
  4843. function allowedAttribute(attr, allowedAttributeList) {
  4844. var attrName = attr.nodeName.toLowerCase();
  4845. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4846. if (uriAttrs.indexOf(attrName) !== -1) {
  4847. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4848. }
  4849. return true;
  4850. }
  4851. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4852. return attrRegex instanceof RegExp;
  4853. }); // Check if a regular expression validates the attribute.
  4854. for (var i = 0, l = regExp.length; i < l; i++) {
  4855. if (attrName.match(regExp[i])) {
  4856. return true;
  4857. }
  4858. }
  4859. return false;
  4860. }
  4861. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4862. if (unsafeHtml.length === 0) {
  4863. return unsafeHtml;
  4864. }
  4865. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4866. return sanitizeFn(unsafeHtml);
  4867. }
  4868. var domParser = new window.DOMParser();
  4869. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4870. var whitelistKeys = Object.keys(whiteList);
  4871. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4872. var _loop = function _loop(i, len) {
  4873. var el = elements[i];
  4874. var elName = el.nodeName.toLowerCase();
  4875. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4876. el.parentNode.removeChild(el);
  4877. return "continue";
  4878. }
  4879. var attributeList = [].slice.call(el.attributes);
  4880. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4881. attributeList.forEach(function (attr) {
  4882. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4883. el.removeAttribute(attr.nodeName);
  4884. }
  4885. });
  4886. };
  4887. for (var i = 0, len = elements.length; i < len; i++) {
  4888. var _ret = _loop(i);
  4889. if (_ret === "continue") continue;
  4890. }
  4891. return createdDocument.body.innerHTML;
  4892. }
  4893. /**
  4894. * ------------------------------------------------------------------------
  4895. * Constants
  4896. * ------------------------------------------------------------------------
  4897. */
  4898. var NAME$6 = 'tooltip';
  4899. var VERSION$6 = '4.4.1';
  4900. var DATA_KEY$6 = 'bs.tooltip';
  4901. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4902. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4903. var CLASS_PREFIX = 'bs-tooltip';
  4904. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4905. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4906. var DefaultType$4 = {
  4907. animation: 'boolean',
  4908. template: 'string',
  4909. title: '(string|element|function)',
  4910. trigger: 'string',
  4911. delay: '(number|object)',
  4912. html: 'boolean',
  4913. selector: '(string|boolean)',
  4914. placement: '(string|function)',
  4915. offset: '(number|string|function)',
  4916. container: '(string|element|boolean)',
  4917. fallbackPlacement: '(string|array)',
  4918. boundary: '(string|element)',
  4919. sanitize: 'boolean',
  4920. sanitizeFn: '(null|function)',
  4921. whiteList: 'object',
  4922. popperConfig: '(null|object)'
  4923. };
  4924. var AttachmentMap$1 = {
  4925. AUTO: 'auto',
  4926. TOP: 'top',
  4927. RIGHT: 'right',
  4928. BOTTOM: 'bottom',
  4929. LEFT: 'left'
  4930. };
  4931. var Default$4 = {
  4932. animation: true,
  4933. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4934. trigger: 'hover focus',
  4935. title: '',
  4936. delay: 0,
  4937. html: false,
  4938. selector: false,
  4939. placement: 'top',
  4940. offset: 0,
  4941. container: false,
  4942. fallbackPlacement: 'flip',
  4943. boundary: 'scrollParent',
  4944. sanitize: true,
  4945. sanitizeFn: null,
  4946. whiteList: DefaultWhitelist,
  4947. popperConfig: null
  4948. };
  4949. var HoverState = {
  4950. SHOW: 'show',
  4951. OUT: 'out'
  4952. };
  4953. var Event$6 = {
  4954. HIDE: "hide" + EVENT_KEY$6,
  4955. HIDDEN: "hidden" + EVENT_KEY$6,
  4956. SHOW: "show" + EVENT_KEY$6,
  4957. SHOWN: "shown" + EVENT_KEY$6,
  4958. INSERTED: "inserted" + EVENT_KEY$6,
  4959. CLICK: "click" + EVENT_KEY$6,
  4960. FOCUSIN: "focusin" + EVENT_KEY$6,
  4961. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4962. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4963. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4964. };
  4965. var ClassName$6 = {
  4966. FADE: 'fade',
  4967. SHOW: 'show'
  4968. };
  4969. var Selector$6 = {
  4970. TOOLTIP: '.tooltip',
  4971. TOOLTIP_INNER: '.tooltip-inner',
  4972. ARROW: '.arrow'
  4973. };
  4974. var Trigger = {
  4975. HOVER: 'hover',
  4976. FOCUS: 'focus',
  4977. CLICK: 'click',
  4978. MANUAL: 'manual'
  4979. };
  4980. /**
  4981. * ------------------------------------------------------------------------
  4982. * Class Definition
  4983. * ------------------------------------------------------------------------
  4984. */
  4985. var Tooltip =
  4986. /*#__PURE__*/
  4987. function () {
  4988. function Tooltip(element, config) {
  4989. if (typeof Popper === 'undefined') {
  4990. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4991. } // private
  4992. this._isEnabled = true;
  4993. this._timeout = 0;
  4994. this._hoverState = '';
  4995. this._activeTrigger = {};
  4996. this._popper = null; // Protected
  4997. this.element = element;
  4998. this.config = this._getConfig(config);
  4999. this.tip = null;
  5000. this._setListeners();
  5001. } // Getters
  5002. var _proto = Tooltip.prototype;
  5003. // Public
  5004. _proto.enable = function enable() {
  5005. this._isEnabled = true;
  5006. };
  5007. _proto.disable = function disable() {
  5008. this._isEnabled = false;
  5009. };
  5010. _proto.toggleEnabled = function toggleEnabled() {
  5011. this._isEnabled = !this._isEnabled;
  5012. };
  5013. _proto.toggle = function toggle(event) {
  5014. if (!this._isEnabled) {
  5015. return;
  5016. }
  5017. if (event) {
  5018. var dataKey = this.constructor.DATA_KEY;
  5019. var context = $(event.currentTarget).data(dataKey);
  5020. if (!context) {
  5021. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5022. $(event.currentTarget).data(dataKey, context);
  5023. }
  5024. context._activeTrigger.click = !context._activeTrigger.click;
  5025. if (context._isWithActiveTrigger()) {
  5026. context._enter(null, context);
  5027. } else {
  5028. context._leave(null, context);
  5029. }
  5030. } else {
  5031. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5032. this._leave(null, this);
  5033. return;
  5034. }
  5035. this._enter(null, this);
  5036. }
  5037. };
  5038. _proto.dispose = function dispose() {
  5039. clearTimeout(this._timeout);
  5040. $.removeData(this.element, this.constructor.DATA_KEY);
  5041. $(this.element).off(this.constructor.EVENT_KEY);
  5042. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5043. if (this.tip) {
  5044. $(this.tip).remove();
  5045. }
  5046. this._isEnabled = null;
  5047. this._timeout = null;
  5048. this._hoverState = null;
  5049. this._activeTrigger = null;
  5050. if (this._popper) {
  5051. this._popper.destroy();
  5052. }
  5053. this._popper = null;
  5054. this.element = null;
  5055. this.config = null;
  5056. this.tip = null;
  5057. };
  5058. _proto.show = function show() {
  5059. var _this = this;
  5060. if ($(this.element).css('display') === 'none') {
  5061. throw new Error('Please use show on visible elements');
  5062. }
  5063. var showEvent = $.Event(this.constructor.Event.SHOW);
  5064. if (this.isWithContent() && this._isEnabled) {
  5065. $(this.element).trigger(showEvent);
  5066. var shadowRoot = Util.findShadowRoot(this.element);
  5067. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5068. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5069. return;
  5070. }
  5071. var tip = this.getTipElement();
  5072. var tipId = Util.getUID(this.constructor.NAME);
  5073. tip.setAttribute('id', tipId);
  5074. this.element.setAttribute('aria-describedby', tipId);
  5075. this.setContent();
  5076. if (this.config.animation) {
  5077. $(tip).addClass(ClassName$6.FADE);
  5078. }
  5079. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5080. var attachment = this._getAttachment(placement);
  5081. this.addAttachmentClass(attachment);
  5082. var container = this._getContainer();
  5083. $(tip).data(this.constructor.DATA_KEY, this);
  5084. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5085. $(tip).appendTo(container);
  5086. }
  5087. $(this.element).trigger(this.constructor.Event.INSERTED);
  5088. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5089. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5090. // empty mouseover listeners to the body's immediate children;
  5091. // only needed because of broken event delegation on iOS
  5092. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5093. if ('ontouchstart' in document.documentElement) {
  5094. $(document.body).children().on('mouseover', null, $.noop);
  5095. }
  5096. var complete = function complete() {
  5097. if (_this.config.animation) {
  5098. _this._fixTransition();
  5099. }
  5100. var prevHoverState = _this._hoverState;
  5101. _this._hoverState = null;
  5102. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5103. if (prevHoverState === HoverState.OUT) {
  5104. _this._leave(null, _this);
  5105. }
  5106. };
  5107. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5108. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5109. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5110. } else {
  5111. complete();
  5112. }
  5113. }
  5114. };
  5115. _proto.hide = function hide(callback) {
  5116. var _this2 = this;
  5117. var tip = this.getTipElement();
  5118. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5119. var complete = function complete() {
  5120. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5121. tip.parentNode.removeChild(tip);
  5122. }
  5123. _this2._cleanTipClass();
  5124. _this2.element.removeAttribute('aria-describedby');
  5125. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5126. if (_this2._popper !== null) {
  5127. _this2._popper.destroy();
  5128. }
  5129. if (callback) {
  5130. callback();
  5131. }
  5132. };
  5133. $(this.element).trigger(hideEvent);
  5134. if (hideEvent.isDefaultPrevented()) {
  5135. return;
  5136. }
  5137. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5138. // empty mouseover listeners we added for iOS support
  5139. if ('ontouchstart' in document.documentElement) {
  5140. $(document.body).children().off('mouseover', null, $.noop);
  5141. }
  5142. this._activeTrigger[Trigger.CLICK] = false;
  5143. this._activeTrigger[Trigger.FOCUS] = false;
  5144. this._activeTrigger[Trigger.HOVER] = false;
  5145. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5146. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5147. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5148. } else {
  5149. complete();
  5150. }
  5151. this._hoverState = '';
  5152. };
  5153. _proto.update = function update() {
  5154. if (this._popper !== null) {
  5155. this._popper.scheduleUpdate();
  5156. }
  5157. } // Protected
  5158. ;
  5159. _proto.isWithContent = function isWithContent() {
  5160. return Boolean(this.getTitle());
  5161. };
  5162. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5163. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5164. };
  5165. _proto.getTipElement = function getTipElement() {
  5166. this.tip = this.tip || $(this.config.template)[0];
  5167. return this.tip;
  5168. };
  5169. _proto.setContent = function setContent() {
  5170. var tip = this.getTipElement();
  5171. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5172. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5173. };
  5174. _proto.setElementContent = function setElementContent($element, content) {
  5175. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5176. // Content is a DOM node or a jQuery
  5177. if (this.config.html) {
  5178. if (!$(content).parent().is($element)) {
  5179. $element.empty().append(content);
  5180. }
  5181. } else {
  5182. $element.text($(content).text());
  5183. }
  5184. return;
  5185. }
  5186. if (this.config.html) {
  5187. if (this.config.sanitize) {
  5188. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5189. }
  5190. $element.html(content);
  5191. } else {
  5192. $element.text(content);
  5193. }
  5194. };
  5195. _proto.getTitle = function getTitle() {
  5196. var title = this.element.getAttribute('data-original-title');
  5197. if (!title) {
  5198. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5199. }
  5200. return title;
  5201. } // Private
  5202. ;
  5203. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5204. var _this3 = this;
  5205. var defaultBsConfig = {
  5206. placement: attachment,
  5207. modifiers: {
  5208. offset: this._getOffset(),
  5209. flip: {
  5210. behavior: this.config.fallbackPlacement
  5211. },
  5212. arrow: {
  5213. element: Selector$6.ARROW
  5214. },
  5215. preventOverflow: {
  5216. boundariesElement: this.config.boundary
  5217. }
  5218. },
  5219. onCreate: function onCreate(data) {
  5220. if (data.originalPlacement !== data.placement) {
  5221. _this3._handlePopperPlacementChange(data);
  5222. }
  5223. },
  5224. onUpdate: function onUpdate(data) {
  5225. return _this3._handlePopperPlacementChange(data);
  5226. }
  5227. };
  5228. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5229. };
  5230. _proto._getOffset = function _getOffset() {
  5231. var _this4 = this;
  5232. var offset = {};
  5233. if (typeof this.config.offset === 'function') {
  5234. offset.fn = function (data) {
  5235. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5236. return data;
  5237. };
  5238. } else {
  5239. offset.offset = this.config.offset;
  5240. }
  5241. return offset;
  5242. };
  5243. _proto._getContainer = function _getContainer() {
  5244. if (this.config.container === false) {
  5245. return document.body;
  5246. }
  5247. if (Util.isElement(this.config.container)) {
  5248. return $(this.config.container);
  5249. }
  5250. return $(document).find(this.config.container);
  5251. };
  5252. _proto._getAttachment = function _getAttachment(placement) {
  5253. return AttachmentMap$1[placement.toUpperCase()];
  5254. };
  5255. _proto._setListeners = function _setListeners() {
  5256. var _this5 = this;
  5257. var triggers = this.config.trigger.split(' ');
  5258. triggers.forEach(function (trigger) {
  5259. if (trigger === 'click') {
  5260. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5261. return _this5.toggle(event);
  5262. });
  5263. } else if (trigger !== Trigger.MANUAL) {
  5264. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5265. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5266. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5267. return _this5._enter(event);
  5268. }).on(eventOut, _this5.config.selector, function (event) {
  5269. return _this5._leave(event);
  5270. });
  5271. }
  5272. });
  5273. this._hideModalHandler = function () {
  5274. if (_this5.element) {
  5275. _this5.hide();
  5276. }
  5277. };
  5278. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5279. if (this.config.selector) {
  5280. this.config = _objectSpread2({}, this.config, {
  5281. trigger: 'manual',
  5282. selector: ''
  5283. });
  5284. } else {
  5285. this._fixTitle();
  5286. }
  5287. };
  5288. _proto._fixTitle = function _fixTitle() {
  5289. var titleType = typeof this.element.getAttribute('data-original-title');
  5290. if (this.element.getAttribute('title') || titleType !== 'string') {
  5291. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5292. this.element.setAttribute('title', '');
  5293. }
  5294. };
  5295. _proto._enter = function _enter(event, context) {
  5296. var dataKey = this.constructor.DATA_KEY;
  5297. context = context || $(event.currentTarget).data(dataKey);
  5298. if (!context) {
  5299. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5300. $(event.currentTarget).data(dataKey, context);
  5301. }
  5302. if (event) {
  5303. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5304. }
  5305. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5306. context._hoverState = HoverState.SHOW;
  5307. return;
  5308. }
  5309. clearTimeout(context._timeout);
  5310. context._hoverState = HoverState.SHOW;
  5311. if (!context.config.delay || !context.config.delay.show) {
  5312. context.show();
  5313. return;
  5314. }
  5315. context._timeout = setTimeout(function () {
  5316. if (context._hoverState === HoverState.SHOW) {
  5317. context.show();
  5318. }
  5319. }, context.config.delay.show);
  5320. };
  5321. _proto._leave = function _leave(event, context) {
  5322. var dataKey = this.constructor.DATA_KEY;
  5323. context = context || $(event.currentTarget).data(dataKey);
  5324. if (!context) {
  5325. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5326. $(event.currentTarget).data(dataKey, context);
  5327. }
  5328. if (event) {
  5329. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5330. }
  5331. if (context._isWithActiveTrigger()) {
  5332. return;
  5333. }
  5334. clearTimeout(context._timeout);
  5335. context._hoverState = HoverState.OUT;
  5336. if (!context.config.delay || !context.config.delay.hide) {
  5337. context.hide();
  5338. return;
  5339. }
  5340. context._timeout = setTimeout(function () {
  5341. if (context._hoverState === HoverState.OUT) {
  5342. context.hide();
  5343. }
  5344. }, context.config.delay.hide);
  5345. };
  5346. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5347. for (var trigger in this._activeTrigger) {
  5348. if (this._activeTrigger[trigger]) {
  5349. return true;
  5350. }
  5351. }
  5352. return false;
  5353. };
  5354. _proto._getConfig = function _getConfig(config) {
  5355. var dataAttributes = $(this.element).data();
  5356. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5357. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5358. delete dataAttributes[dataAttr];
  5359. }
  5360. });
  5361. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5362. if (typeof config.delay === 'number') {
  5363. config.delay = {
  5364. show: config.delay,
  5365. hide: config.delay
  5366. };
  5367. }
  5368. if (typeof config.title === 'number') {
  5369. config.title = config.title.toString();
  5370. }
  5371. if (typeof config.content === 'number') {
  5372. config.content = config.content.toString();
  5373. }
  5374. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5375. if (config.sanitize) {
  5376. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5377. }
  5378. return config;
  5379. };
  5380. _proto._getDelegateConfig = function _getDelegateConfig() {
  5381. var config = {};
  5382. if (this.config) {
  5383. for (var key in this.config) {
  5384. if (this.constructor.Default[key] !== this.config[key]) {
  5385. config[key] = this.config[key];
  5386. }
  5387. }
  5388. }
  5389. return config;
  5390. };
  5391. _proto._cleanTipClass = function _cleanTipClass() {
  5392. var $tip = $(this.getTipElement());
  5393. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5394. if (tabClass !== null && tabClass.length) {
  5395. $tip.removeClass(tabClass.join(''));
  5396. }
  5397. };
  5398. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5399. var popperInstance = popperData.instance;
  5400. this.tip = popperInstance.popper;
  5401. this._cleanTipClass();
  5402. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5403. };
  5404. _proto._fixTransition = function _fixTransition() {
  5405. var tip = this.getTipElement();
  5406. var initConfigAnimation = this.config.animation;
  5407. if (tip.getAttribute('x-placement') !== null) {
  5408. return;
  5409. }
  5410. $(tip).removeClass(ClassName$6.FADE);
  5411. this.config.animation = false;
  5412. this.hide();
  5413. this.show();
  5414. this.config.animation = initConfigAnimation;
  5415. } // Static
  5416. ;
  5417. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5418. return this.each(function () {
  5419. var data = $(this).data(DATA_KEY$6);
  5420. var _config = typeof config === 'object' && config;
  5421. if (!data && /dispose|hide/.test(config)) {
  5422. return;
  5423. }
  5424. if (!data) {
  5425. data = new Tooltip(this, _config);
  5426. $(this).data(DATA_KEY$6, data);
  5427. }
  5428. if (typeof config === 'string') {
  5429. if (typeof data[config] === 'undefined') {
  5430. throw new TypeError("No method named \"" + config + "\"");
  5431. }
  5432. data[config]();
  5433. }
  5434. });
  5435. };
  5436. _createClass(Tooltip, null, [{
  5437. key: "VERSION",
  5438. get: function get() {
  5439. return VERSION$6;
  5440. }
  5441. }, {
  5442. key: "Default",
  5443. get: function get() {
  5444. return Default$4;
  5445. }
  5446. }, {
  5447. key: "NAME",
  5448. get: function get() {
  5449. return NAME$6;
  5450. }
  5451. }, {
  5452. key: "DATA_KEY",
  5453. get: function get() {
  5454. return DATA_KEY$6;
  5455. }
  5456. }, {
  5457. key: "Event",
  5458. get: function get() {
  5459. return Event$6;
  5460. }
  5461. }, {
  5462. key: "EVENT_KEY",
  5463. get: function get() {
  5464. return EVENT_KEY$6;
  5465. }
  5466. }, {
  5467. key: "DefaultType",
  5468. get: function get() {
  5469. return DefaultType$4;
  5470. }
  5471. }]);
  5472. return Tooltip;
  5473. }();
  5474. /**
  5475. * ------------------------------------------------------------------------
  5476. * jQuery
  5477. * ------------------------------------------------------------------------
  5478. */
  5479. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5480. $.fn[NAME$6].Constructor = Tooltip;
  5481. $.fn[NAME$6].noConflict = function () {
  5482. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5483. return Tooltip._jQueryInterface;
  5484. };
  5485. /**
  5486. * ------------------------------------------------------------------------
  5487. * Constants
  5488. * ------------------------------------------------------------------------
  5489. */
  5490. var NAME$7 = 'popover';
  5491. var VERSION$7 = '4.4.1';
  5492. var DATA_KEY$7 = 'bs.popover';
  5493. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5494. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5495. var CLASS_PREFIX$1 = 'bs-popover';
  5496. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5497. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5498. placement: 'right',
  5499. trigger: 'click',
  5500. content: '',
  5501. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5502. });
  5503. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5504. content: '(string|element|function)'
  5505. });
  5506. var ClassName$7 = {
  5507. FADE: 'fade',
  5508. SHOW: 'show'
  5509. };
  5510. var Selector$7 = {
  5511. TITLE: '.popover-header',
  5512. CONTENT: '.popover-body'
  5513. };
  5514. var Event$7 = {
  5515. HIDE: "hide" + EVENT_KEY$7,
  5516. HIDDEN: "hidden" + EVENT_KEY$7,
  5517. SHOW: "show" + EVENT_KEY$7,
  5518. SHOWN: "shown" + EVENT_KEY$7,
  5519. INSERTED: "inserted" + EVENT_KEY$7,
  5520. CLICK: "click" + EVENT_KEY$7,
  5521. FOCUSIN: "focusin" + EVENT_KEY$7,
  5522. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5523. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5524. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5525. };
  5526. /**
  5527. * ------------------------------------------------------------------------
  5528. * Class Definition
  5529. * ------------------------------------------------------------------------
  5530. */
  5531. var Popover =
  5532. /*#__PURE__*/
  5533. function (_Tooltip) {
  5534. _inheritsLoose(Popover, _Tooltip);
  5535. function Popover() {
  5536. return _Tooltip.apply(this, arguments) || this;
  5537. }
  5538. var _proto = Popover.prototype;
  5539. // Overrides
  5540. _proto.isWithContent = function isWithContent() {
  5541. return this.getTitle() || this._getContent();
  5542. };
  5543. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5544. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5545. };
  5546. _proto.getTipElement = function getTipElement() {
  5547. this.tip = this.tip || $(this.config.template)[0];
  5548. return this.tip;
  5549. };
  5550. _proto.setContent = function setContent() {
  5551. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5552. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5553. var content = this._getContent();
  5554. if (typeof content === 'function') {
  5555. content = content.call(this.element);
  5556. }
  5557. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5558. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5559. } // Private
  5560. ;
  5561. _proto._getContent = function _getContent() {
  5562. return this.element.getAttribute('data-content') || this.config.content;
  5563. };
  5564. _proto._cleanTipClass = function _cleanTipClass() {
  5565. var $tip = $(this.getTipElement());
  5566. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5567. if (tabClass !== null && tabClass.length > 0) {
  5568. $tip.removeClass(tabClass.join(''));
  5569. }
  5570. } // Static
  5571. ;
  5572. Popover._jQueryInterface = function _jQueryInterface(config) {
  5573. return this.each(function () {
  5574. var data = $(this).data(DATA_KEY$7);
  5575. var _config = typeof config === 'object' ? config : null;
  5576. if (!data && /dispose|hide/.test(config)) {
  5577. return;
  5578. }
  5579. if (!data) {
  5580. data = new Popover(this, _config);
  5581. $(this).data(DATA_KEY$7, data);
  5582. }
  5583. if (typeof config === 'string') {
  5584. if (typeof data[config] === 'undefined') {
  5585. throw new TypeError("No method named \"" + config + "\"");
  5586. }
  5587. data[config]();
  5588. }
  5589. });
  5590. };
  5591. _createClass(Popover, null, [{
  5592. key: "VERSION",
  5593. // Getters
  5594. get: function get() {
  5595. return VERSION$7;
  5596. }
  5597. }, {
  5598. key: "Default",
  5599. get: function get() {
  5600. return Default$5;
  5601. }
  5602. }, {
  5603. key: "NAME",
  5604. get: function get() {
  5605. return NAME$7;
  5606. }
  5607. }, {
  5608. key: "DATA_KEY",
  5609. get: function get() {
  5610. return DATA_KEY$7;
  5611. }
  5612. }, {
  5613. key: "Event",
  5614. get: function get() {
  5615. return Event$7;
  5616. }
  5617. }, {
  5618. key: "EVENT_KEY",
  5619. get: function get() {
  5620. return EVENT_KEY$7;
  5621. }
  5622. }, {
  5623. key: "DefaultType",
  5624. get: function get() {
  5625. return DefaultType$5;
  5626. }
  5627. }]);
  5628. return Popover;
  5629. }(Tooltip);
  5630. /**
  5631. * ------------------------------------------------------------------------
  5632. * jQuery
  5633. * ------------------------------------------------------------------------
  5634. */
  5635. $.fn[NAME$7] = Popover._jQueryInterface;
  5636. $.fn[NAME$7].Constructor = Popover;
  5637. $.fn[NAME$7].noConflict = function () {
  5638. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5639. return Popover._jQueryInterface;
  5640. };
  5641. /**
  5642. * ------------------------------------------------------------------------
  5643. * Constants
  5644. * ------------------------------------------------------------------------
  5645. */
  5646. var NAME$8 = 'scrollspy';
  5647. var VERSION$8 = '4.4.1';
  5648. var DATA_KEY$8 = 'bs.scrollspy';
  5649. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5650. var DATA_API_KEY$6 = '.data-api';
  5651. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5652. var Default$6 = {
  5653. offset: 10,
  5654. method: 'auto',
  5655. target: ''
  5656. };
  5657. var DefaultType$6 = {
  5658. offset: 'number',
  5659. method: 'string',
  5660. target: '(string|element)'
  5661. };
  5662. var Event$8 = {
  5663. ACTIVATE: "activate" + EVENT_KEY$8,
  5664. SCROLL: "scroll" + EVENT_KEY$8,
  5665. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5666. };
  5667. var ClassName$8 = {
  5668. DROPDOWN_ITEM: 'dropdown-item',
  5669. DROPDOWN_MENU: 'dropdown-menu',
  5670. ACTIVE: 'active'
  5671. };
  5672. var Selector$8 = {
  5673. DATA_SPY: '[data-spy="scroll"]',
  5674. ACTIVE: '.active',
  5675. NAV_LIST_GROUP: '.nav, .list-group',
  5676. NAV_LINKS: '.nav-link',
  5677. NAV_ITEMS: '.nav-item',
  5678. LIST_ITEMS: '.list-group-item',
  5679. DROPDOWN: '.dropdown',
  5680. DROPDOWN_ITEMS: '.dropdown-item',
  5681. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5682. };
  5683. var OffsetMethod = {
  5684. OFFSET: 'offset',
  5685. POSITION: 'position'
  5686. };
  5687. /**
  5688. * ------------------------------------------------------------------------
  5689. * Class Definition
  5690. * ------------------------------------------------------------------------
  5691. */
  5692. var ScrollSpy =
  5693. /*#__PURE__*/
  5694. function () {
  5695. function ScrollSpy(element, config) {
  5696. var _this = this;
  5697. this._element = element;
  5698. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5699. this._config = this._getConfig(config);
  5700. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5701. this._offsets = [];
  5702. this._targets = [];
  5703. this._activeTarget = null;
  5704. this._scrollHeight = 0;
  5705. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5706. return _this._process(event);
  5707. });
  5708. this.refresh();
  5709. this._process();
  5710. } // Getters
  5711. var _proto = ScrollSpy.prototype;
  5712. // Public
  5713. _proto.refresh = function refresh() {
  5714. var _this2 = this;
  5715. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5716. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5717. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5718. this._offsets = [];
  5719. this._targets = [];
  5720. this._scrollHeight = this._getScrollHeight();
  5721. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5722. targets.map(function (element) {
  5723. var target;
  5724. var targetSelector = Util.getSelectorFromElement(element);
  5725. if (targetSelector) {
  5726. target = document.querySelector(targetSelector);
  5727. }
  5728. if (target) {
  5729. var targetBCR = target.getBoundingClientRect();
  5730. if (targetBCR.width || targetBCR.height) {
  5731. // TODO (fat): remove sketch reliance on jQuery position/offset
  5732. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5733. }
  5734. }
  5735. return null;
  5736. }).filter(function (item) {
  5737. return item;
  5738. }).sort(function (a, b) {
  5739. return a[0] - b[0];
  5740. }).forEach(function (item) {
  5741. _this2._offsets.push(item[0]);
  5742. _this2._targets.push(item[1]);
  5743. });
  5744. };
  5745. _proto.dispose = function dispose() {
  5746. $.removeData(this._element, DATA_KEY$8);
  5747. $(this._scrollElement).off(EVENT_KEY$8);
  5748. this._element = null;
  5749. this._scrollElement = null;
  5750. this._config = null;
  5751. this._selector = null;
  5752. this._offsets = null;
  5753. this._targets = null;
  5754. this._activeTarget = null;
  5755. this._scrollHeight = null;
  5756. } // Private
  5757. ;
  5758. _proto._getConfig = function _getConfig(config) {
  5759. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5760. if (typeof config.target !== 'string') {
  5761. var id = $(config.target).attr('id');
  5762. if (!id) {
  5763. id = Util.getUID(NAME$8);
  5764. $(config.target).attr('id', id);
  5765. }
  5766. config.target = "#" + id;
  5767. }
  5768. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5769. return config;
  5770. };
  5771. _proto._getScrollTop = function _getScrollTop() {
  5772. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5773. };
  5774. _proto._getScrollHeight = function _getScrollHeight() {
  5775. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5776. };
  5777. _proto._getOffsetHeight = function _getOffsetHeight() {
  5778. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5779. };
  5780. _proto._process = function _process() {
  5781. var scrollTop = this._getScrollTop() + this._config.offset;
  5782. var scrollHeight = this._getScrollHeight();
  5783. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5784. if (this._scrollHeight !== scrollHeight) {
  5785. this.refresh();
  5786. }
  5787. if (scrollTop >= maxScroll) {
  5788. var target = this._targets[this._targets.length - 1];
  5789. if (this._activeTarget !== target) {
  5790. this._activate(target);
  5791. }
  5792. return;
  5793. }
  5794. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5795. this._activeTarget = null;
  5796. this._clear();
  5797. return;
  5798. }
  5799. var offsetLength = this._offsets.length;
  5800. for (var i = offsetLength; i--;) {
  5801. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5802. if (isActiveTarget) {
  5803. this._activate(this._targets[i]);
  5804. }
  5805. }
  5806. };
  5807. _proto._activate = function _activate(target) {
  5808. this._activeTarget = target;
  5809. this._clear();
  5810. var queries = this._selector.split(',').map(function (selector) {
  5811. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5812. });
  5813. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5814. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5815. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5816. $link.addClass(ClassName$8.ACTIVE);
  5817. } else {
  5818. // Set triggered link as active
  5819. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5820. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5821. $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
  5822. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5823. }
  5824. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5825. relatedTarget: target
  5826. });
  5827. };
  5828. _proto._clear = function _clear() {
  5829. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5830. return node.classList.contains(ClassName$8.ACTIVE);
  5831. }).forEach(function (node) {
  5832. return node.classList.remove(ClassName$8.ACTIVE);
  5833. });
  5834. } // Static
  5835. ;
  5836. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5837. return this.each(function () {
  5838. var data = $(this).data(DATA_KEY$8);
  5839. var _config = typeof config === 'object' && config;
  5840. if (!data) {
  5841. data = new ScrollSpy(this, _config);
  5842. $(this).data(DATA_KEY$8, data);
  5843. }
  5844. if (typeof config === 'string') {
  5845. if (typeof data[config] === 'undefined') {
  5846. throw new TypeError("No method named \"" + config + "\"");
  5847. }
  5848. data[config]();
  5849. }
  5850. });
  5851. };
  5852. _createClass(ScrollSpy, null, [{
  5853. key: "VERSION",
  5854. get: function get() {
  5855. return VERSION$8;
  5856. }
  5857. }, {
  5858. key: "Default",
  5859. get: function get() {
  5860. return Default$6;
  5861. }
  5862. }]);
  5863. return ScrollSpy;
  5864. }();
  5865. /**
  5866. * ------------------------------------------------------------------------
  5867. * Data Api implementation
  5868. * ------------------------------------------------------------------------
  5869. */
  5870. $(window).on(Event$8.LOAD_DATA_API, function () {
  5871. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5872. var scrollSpysLength = scrollSpys.length;
  5873. for (var i = scrollSpysLength; i--;) {
  5874. var $spy = $(scrollSpys[i]);
  5875. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5876. }
  5877. });
  5878. /**
  5879. * ------------------------------------------------------------------------
  5880. * jQuery
  5881. * ------------------------------------------------------------------------
  5882. */
  5883. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5884. $.fn[NAME$8].Constructor = ScrollSpy;
  5885. $.fn[NAME$8].noConflict = function () {
  5886. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5887. return ScrollSpy._jQueryInterface;
  5888. };
  5889. /**
  5890. * ------------------------------------------------------------------------
  5891. * Constants
  5892. * ------------------------------------------------------------------------
  5893. */
  5894. var NAME$9 = 'tab';
  5895. var VERSION$9 = '4.4.1';
  5896. var DATA_KEY$9 = 'bs.tab';
  5897. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5898. var DATA_API_KEY$7 = '.data-api';
  5899. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5900. var Event$9 = {
  5901. HIDE: "hide" + EVENT_KEY$9,
  5902. HIDDEN: "hidden" + EVENT_KEY$9,
  5903. SHOW: "show" + EVENT_KEY$9,
  5904. SHOWN: "shown" + EVENT_KEY$9,
  5905. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5906. };
  5907. var ClassName$9 = {
  5908. DROPDOWN_MENU: 'dropdown-menu',
  5909. ACTIVE: 'active',
  5910. DISABLED: 'disabled',
  5911. FADE: 'fade',
  5912. SHOW: 'show'
  5913. };
  5914. var Selector$9 = {
  5915. DROPDOWN: '.dropdown',
  5916. NAV_LIST_GROUP: '.nav, .list-group',
  5917. ACTIVE: '.active',
  5918. ACTIVE_UL: '> li > .active',
  5919. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5920. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5921. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5922. };
  5923. /**
  5924. * ------------------------------------------------------------------------
  5925. * Class Definition
  5926. * ------------------------------------------------------------------------
  5927. */
  5928. var Tab =
  5929. /*#__PURE__*/
  5930. function () {
  5931. function Tab(element) {
  5932. this._element = element;
  5933. } // Getters
  5934. var _proto = Tab.prototype;
  5935. // Public
  5936. _proto.show = function show() {
  5937. var _this = this;
  5938. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5939. return;
  5940. }
  5941. var target;
  5942. var previous;
  5943. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5944. var selector = Util.getSelectorFromElement(this._element);
  5945. if (listElement) {
  5946. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5947. previous = $.makeArray($(listElement).find(itemSelector));
  5948. previous = previous[previous.length - 1];
  5949. }
  5950. var hideEvent = $.Event(Event$9.HIDE, {
  5951. relatedTarget: this._element
  5952. });
  5953. var showEvent = $.Event(Event$9.SHOW, {
  5954. relatedTarget: previous
  5955. });
  5956. if (previous) {
  5957. $(previous).trigger(hideEvent);
  5958. }
  5959. $(this._element).trigger(showEvent);
  5960. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5961. return;
  5962. }
  5963. if (selector) {
  5964. target = document.querySelector(selector);
  5965. }
  5966. this._activate(this._element, listElement);
  5967. var complete = function complete() {
  5968. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5969. relatedTarget: _this._element
  5970. });
  5971. var shownEvent = $.Event(Event$9.SHOWN, {
  5972. relatedTarget: previous
  5973. });
  5974. $(previous).trigger(hiddenEvent);
  5975. $(_this._element).trigger(shownEvent);
  5976. };
  5977. if (target) {
  5978. this._activate(target, target.parentNode, complete);
  5979. } else {
  5980. complete();
  5981. }
  5982. };
  5983. _proto.dispose = function dispose() {
  5984. $.removeData(this._element, DATA_KEY$9);
  5985. this._element = null;
  5986. } // Private
  5987. ;
  5988. _proto._activate = function _activate(element, container, callback) {
  5989. var _this2 = this;
  5990. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5991. var active = activeElements[0];
  5992. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5993. var complete = function complete() {
  5994. return _this2._transitionComplete(element, active, callback);
  5995. };
  5996. if (active && isTransitioning) {
  5997. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5998. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5999. } else {
  6000. complete();
  6001. }
  6002. };
  6003. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6004. if (active) {
  6005. $(active).removeClass(ClassName$9.ACTIVE);
  6006. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6007. if (dropdownChild) {
  6008. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6009. }
  6010. if (active.getAttribute('role') === 'tab') {
  6011. active.setAttribute('aria-selected', false);
  6012. }
  6013. }
  6014. $(element).addClass(ClassName$9.ACTIVE);
  6015. if (element.getAttribute('role') === 'tab') {
  6016. element.setAttribute('aria-selected', true);
  6017. }
  6018. Util.reflow(element);
  6019. if (element.classList.contains(ClassName$9.FADE)) {
  6020. element.classList.add(ClassName$9.SHOW);
  6021. }
  6022. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6023. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6024. if (dropdownElement) {
  6025. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6026. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6027. }
  6028. element.setAttribute('aria-expanded', true);
  6029. }
  6030. if (callback) {
  6031. callback();
  6032. }
  6033. } // Static
  6034. ;
  6035. Tab._jQueryInterface = function _jQueryInterface(config) {
  6036. return this.each(function () {
  6037. var $this = $(this);
  6038. var data = $this.data(DATA_KEY$9);
  6039. if (!data) {
  6040. data = new Tab(this);
  6041. $this.data(DATA_KEY$9, data);
  6042. }
  6043. if (typeof config === 'string') {
  6044. if (typeof data[config] === 'undefined') {
  6045. throw new TypeError("No method named \"" + config + "\"");
  6046. }
  6047. data[config]();
  6048. }
  6049. });
  6050. };
  6051. _createClass(Tab, null, [{
  6052. key: "VERSION",
  6053. get: function get() {
  6054. return VERSION$9;
  6055. }
  6056. }]);
  6057. return Tab;
  6058. }();
  6059. /**
  6060. * ------------------------------------------------------------------------
  6061. * Data Api implementation
  6062. * ------------------------------------------------------------------------
  6063. */
  6064. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6065. event.preventDefault();
  6066. Tab._jQueryInterface.call($(this), 'show');
  6067. });
  6068. /**
  6069. * ------------------------------------------------------------------------
  6070. * jQuery
  6071. * ------------------------------------------------------------------------
  6072. */
  6073. $.fn[NAME$9] = Tab._jQueryInterface;
  6074. $.fn[NAME$9].Constructor = Tab;
  6075. $.fn[NAME$9].noConflict = function () {
  6076. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6077. return Tab._jQueryInterface;
  6078. };
  6079. /**
  6080. * ------------------------------------------------------------------------
  6081. * Constants
  6082. * ------------------------------------------------------------------------
  6083. */
  6084. var NAME$a = 'toast';
  6085. var VERSION$a = '4.4.1';
  6086. var DATA_KEY$a = 'bs.toast';
  6087. var EVENT_KEY$a = "." + DATA_KEY$a;
  6088. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6089. var Event$a = {
  6090. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6091. HIDE: "hide" + EVENT_KEY$a,
  6092. HIDDEN: "hidden" + EVENT_KEY$a,
  6093. SHOW: "show" + EVENT_KEY$a,
  6094. SHOWN: "shown" + EVENT_KEY$a
  6095. };
  6096. var ClassName$a = {
  6097. FADE: 'fade',
  6098. HIDE: 'hide',
  6099. SHOW: 'show',
  6100. SHOWING: 'showing'
  6101. };
  6102. var DefaultType$7 = {
  6103. animation: 'boolean',
  6104. autohide: 'boolean',
  6105. delay: 'number'
  6106. };
  6107. var Default$7 = {
  6108. animation: true,
  6109. autohide: true,
  6110. delay: 500
  6111. };
  6112. var Selector$a = {
  6113. DATA_DISMISS: '[data-dismiss="toast"]'
  6114. };
  6115. /**
  6116. * ------------------------------------------------------------------------
  6117. * Class Definition
  6118. * ------------------------------------------------------------------------
  6119. */
  6120. var Toast =
  6121. /*#__PURE__*/
  6122. function () {
  6123. function Toast(element, config) {
  6124. this._element = element;
  6125. this._config = this._getConfig(config);
  6126. this._timeout = null;
  6127. this._setListeners();
  6128. } // Getters
  6129. var _proto = Toast.prototype;
  6130. // Public
  6131. _proto.show = function show() {
  6132. var _this = this;
  6133. var showEvent = $.Event(Event$a.SHOW);
  6134. $(this._element).trigger(showEvent);
  6135. if (showEvent.isDefaultPrevented()) {
  6136. return;
  6137. }
  6138. if (this._config.animation) {
  6139. this._element.classList.add(ClassName$a.FADE);
  6140. }
  6141. var complete = function complete() {
  6142. _this._element.classList.remove(ClassName$a.SHOWING);
  6143. _this._element.classList.add(ClassName$a.SHOW);
  6144. $(_this._element).trigger(Event$a.SHOWN);
  6145. if (_this._config.autohide) {
  6146. _this._timeout = setTimeout(function () {
  6147. _this.hide();
  6148. }, _this._config.delay);
  6149. }
  6150. };
  6151. this._element.classList.remove(ClassName$a.HIDE);
  6152. Util.reflow(this._element);
  6153. this._element.classList.add(ClassName$a.SHOWING);
  6154. if (this._config.animation) {
  6155. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6156. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6157. } else {
  6158. complete();
  6159. }
  6160. };
  6161. _proto.hide = function hide() {
  6162. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6163. return;
  6164. }
  6165. var hideEvent = $.Event(Event$a.HIDE);
  6166. $(this._element).trigger(hideEvent);
  6167. if (hideEvent.isDefaultPrevented()) {
  6168. return;
  6169. }
  6170. this._close();
  6171. };
  6172. _proto.dispose = function dispose() {
  6173. clearTimeout(this._timeout);
  6174. this._timeout = null;
  6175. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6176. this._element.classList.remove(ClassName$a.SHOW);
  6177. }
  6178. $(this._element).off(Event$a.CLICK_DISMISS);
  6179. $.removeData(this._element, DATA_KEY$a);
  6180. this._element = null;
  6181. this._config = null;
  6182. } // Private
  6183. ;
  6184. _proto._getConfig = function _getConfig(config) {
  6185. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6186. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6187. return config;
  6188. };
  6189. _proto._setListeners = function _setListeners() {
  6190. var _this2 = this;
  6191. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6192. return _this2.hide();
  6193. });
  6194. };
  6195. _proto._close = function _close() {
  6196. var _this3 = this;
  6197. var complete = function complete() {
  6198. _this3._element.classList.add(ClassName$a.HIDE);
  6199. $(_this3._element).trigger(Event$a.HIDDEN);
  6200. };
  6201. this._element.classList.remove(ClassName$a.SHOW);
  6202. if (this._config.animation) {
  6203. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6204. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6205. } else {
  6206. complete();
  6207. }
  6208. } // Static
  6209. ;
  6210. Toast._jQueryInterface = function _jQueryInterface(config) {
  6211. return this.each(function () {
  6212. var $element = $(this);
  6213. var data = $element.data(DATA_KEY$a);
  6214. var _config = typeof config === 'object' && config;
  6215. if (!data) {
  6216. data = new Toast(this, _config);
  6217. $element.data(DATA_KEY$a, data);
  6218. }
  6219. if (typeof config === 'string') {
  6220. if (typeof data[config] === 'undefined') {
  6221. throw new TypeError("No method named \"" + config + "\"");
  6222. }
  6223. data[config](this);
  6224. }
  6225. });
  6226. };
  6227. _createClass(Toast, null, [{
  6228. key: "VERSION",
  6229. get: function get() {
  6230. return VERSION$a;
  6231. }
  6232. }, {
  6233. key: "DefaultType",
  6234. get: function get() {
  6235. return DefaultType$7;
  6236. }
  6237. }, {
  6238. key: "Default",
  6239. get: function get() {
  6240. return Default$7;
  6241. }
  6242. }]);
  6243. return Toast;
  6244. }();
  6245. /**
  6246. * ------------------------------------------------------------------------
  6247. * jQuery
  6248. * ------------------------------------------------------------------------
  6249. */
  6250. $.fn[NAME$a] = Toast._jQueryInterface;
  6251. $.fn[NAME$a].Constructor = Toast;
  6252. $.fn[NAME$a].noConflict = function () {
  6253. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6254. return Toast._jQueryInterface;
  6255. };
  6256. exports.Alert = Alert;
  6257. exports.Button = Button;
  6258. exports.Carousel = Carousel;
  6259. exports.Collapse = Collapse;
  6260. exports.Dropdown = Dropdown;
  6261. exports.Modal = Modal;
  6262. exports.Popover = Popover;
  6263. exports.Scrollspy = ScrollSpy;
  6264. exports.Tab = Tab;
  6265. exports.Toast = Toast;
  6266. exports.Tooltip = Tooltip;
  6267. exports.Util = Util;
  6268. Object.defineProperty(exports, '__esModule', { value: true });
  6269. })));
  6270. //# sourceMappingURL=bootstrap.js.map
  6271. /***/ }),
  6272. /***/ "./node_modules/buffer/index.js":
  6273. /*!**************************************!*\
  6274. !*** ./node_modules/buffer/index.js ***!
  6275. \**************************************/
  6276. /*! no static exports found */
  6277. /***/ (function(module, exports, __webpack_require__) {
  6278. "use strict";
  6279. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6280. * The buffer module from node.js, for the browser.
  6281. *
  6282. * @author Feross Aboukhadijeh <http://feross.org>
  6283. * @license MIT
  6284. */
  6285. /* eslint-disable no-proto */
  6286. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6287. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6288. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6289. exports.Buffer = Buffer
  6290. exports.SlowBuffer = SlowBuffer
  6291. exports.INSPECT_MAX_BYTES = 50
  6292. /**
  6293. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6294. * === true Use Uint8Array implementation (fastest)
  6295. * === false Use Object implementation (most compatible, even IE6)
  6296. *
  6297. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6298. * Opera 11.6+, iOS 4.2+.
  6299. *
  6300. * Due to various browser bugs, sometimes the Object implementation will be used even
  6301. * when the browser supports typed arrays.
  6302. *
  6303. * Note:
  6304. *
  6305. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6306. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6307. *
  6308. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6309. *
  6310. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6311. * incorrect length in some situations.
  6312. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6313. * get the Object implementation, which is slower but behaves correctly.
  6314. */
  6315. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6316. ? global.TYPED_ARRAY_SUPPORT
  6317. : typedArraySupport()
  6318. /*
  6319. * Export kMaxLength after typed array support is determined.
  6320. */
  6321. exports.kMaxLength = kMaxLength()
  6322. function typedArraySupport () {
  6323. try {
  6324. var arr = new Uint8Array(1)
  6325. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6326. return arr.foo() === 42 && // typed array instances can be augmented
  6327. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6328. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6329. } catch (e) {
  6330. return false
  6331. }
  6332. }
  6333. function kMaxLength () {
  6334. return Buffer.TYPED_ARRAY_SUPPORT
  6335. ? 0x7fffffff
  6336. : 0x3fffffff
  6337. }
  6338. function createBuffer (that, length) {
  6339. if (kMaxLength() < length) {
  6340. throw new RangeError('Invalid typed array length')
  6341. }
  6342. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6343. // Return an augmented `Uint8Array` instance, for best performance
  6344. that = new Uint8Array(length)
  6345. that.__proto__ = Buffer.prototype
  6346. } else {
  6347. // Fallback: Return an object instance of the Buffer class
  6348. if (that === null) {
  6349. that = new Buffer(length)
  6350. }
  6351. that.length = length
  6352. }
  6353. return that
  6354. }
  6355. /**
  6356. * The Buffer constructor returns instances of `Uint8Array` that have their
  6357. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6358. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6359. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6360. * returns a single octet.
  6361. *
  6362. * The `Uint8Array` prototype remains unmodified.
  6363. */
  6364. function Buffer (arg, encodingOrOffset, length) {
  6365. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6366. return new Buffer(arg, encodingOrOffset, length)
  6367. }
  6368. // Common case.
  6369. if (typeof arg === 'number') {
  6370. if (typeof encodingOrOffset === 'string') {
  6371. throw new Error(
  6372. 'If encoding is specified then the first argument must be a string'
  6373. )
  6374. }
  6375. return allocUnsafe(this, arg)
  6376. }
  6377. return from(this, arg, encodingOrOffset, length)
  6378. }
  6379. Buffer.poolSize = 8192 // not used by this implementation
  6380. // TODO: Legacy, not needed anymore. Remove in next major version.
  6381. Buffer._augment = function (arr) {
  6382. arr.__proto__ = Buffer.prototype
  6383. return arr
  6384. }
  6385. function from (that, value, encodingOrOffset, length) {
  6386. if (typeof value === 'number') {
  6387. throw new TypeError('"value" argument must not be a number')
  6388. }
  6389. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6390. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6391. }
  6392. if (typeof value === 'string') {
  6393. return fromString(that, value, encodingOrOffset)
  6394. }
  6395. return fromObject(that, value)
  6396. }
  6397. /**
  6398. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6399. * if value is a number.
  6400. * Buffer.from(str[, encoding])
  6401. * Buffer.from(array)
  6402. * Buffer.from(buffer)
  6403. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6404. **/
  6405. Buffer.from = function (value, encodingOrOffset, length) {
  6406. return from(null, value, encodingOrOffset, length)
  6407. }
  6408. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6409. Buffer.prototype.__proto__ = Uint8Array.prototype
  6410. Buffer.__proto__ = Uint8Array
  6411. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6412. Buffer[Symbol.species] === Buffer) {
  6413. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6414. Object.defineProperty(Buffer, Symbol.species, {
  6415. value: null,
  6416. configurable: true
  6417. })
  6418. }
  6419. }
  6420. function assertSize (size) {
  6421. if (typeof size !== 'number') {
  6422. throw new TypeError('"size" argument must be a number')
  6423. } else if (size < 0) {
  6424. throw new RangeError('"size" argument must not be negative')
  6425. }
  6426. }
  6427. function alloc (that, size, fill, encoding) {
  6428. assertSize(size)
  6429. if (size <= 0) {
  6430. return createBuffer(that, size)
  6431. }
  6432. if (fill !== undefined) {
  6433. // Only pay attention to encoding if it's a string. This
  6434. // prevents accidentally sending in a number that would
  6435. // be interpretted as a start offset.
  6436. return typeof encoding === 'string'
  6437. ? createBuffer(that, size).fill(fill, encoding)
  6438. : createBuffer(that, size).fill(fill)
  6439. }
  6440. return createBuffer(that, size)
  6441. }
  6442. /**
  6443. * Creates a new filled Buffer instance.
  6444. * alloc(size[, fill[, encoding]])
  6445. **/
  6446. Buffer.alloc = function (size, fill, encoding) {
  6447. return alloc(null, size, fill, encoding)
  6448. }
  6449. function allocUnsafe (that, size) {
  6450. assertSize(size)
  6451. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6452. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6453. for (var i = 0; i < size; ++i) {
  6454. that[i] = 0
  6455. }
  6456. }
  6457. return that
  6458. }
  6459. /**
  6460. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6461. * */
  6462. Buffer.allocUnsafe = function (size) {
  6463. return allocUnsafe(null, size)
  6464. }
  6465. /**
  6466. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6467. */
  6468. Buffer.allocUnsafeSlow = function (size) {
  6469. return allocUnsafe(null, size)
  6470. }
  6471. function fromString (that, string, encoding) {
  6472. if (typeof encoding !== 'string' || encoding === '') {
  6473. encoding = 'utf8'
  6474. }
  6475. if (!Buffer.isEncoding(encoding)) {
  6476. throw new TypeError('"encoding" must be a valid string encoding')
  6477. }
  6478. var length = byteLength(string, encoding) | 0
  6479. that = createBuffer(that, length)
  6480. var actual = that.write(string, encoding)
  6481. if (actual !== length) {
  6482. // Writing a hex string, for example, that contains invalid characters will
  6483. // cause everything after the first invalid character to be ignored. (e.g.
  6484. // 'abxxcd' will be treated as 'ab')
  6485. that = that.slice(0, actual)
  6486. }
  6487. return that
  6488. }
  6489. function fromArrayLike (that, array) {
  6490. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6491. that = createBuffer(that, length)
  6492. for (var i = 0; i < length; i += 1) {
  6493. that[i] = array[i] & 255
  6494. }
  6495. return that
  6496. }
  6497. function fromArrayBuffer (that, array, byteOffset, length) {
  6498. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6499. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6500. throw new RangeError('\'offset\' is out of bounds')
  6501. }
  6502. if (array.byteLength < byteOffset + (length || 0)) {
  6503. throw new RangeError('\'length\' is out of bounds')
  6504. }
  6505. if (byteOffset === undefined && length === undefined) {
  6506. array = new Uint8Array(array)
  6507. } else if (length === undefined) {
  6508. array = new Uint8Array(array, byteOffset)
  6509. } else {
  6510. array = new Uint8Array(array, byteOffset, length)
  6511. }
  6512. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6513. // Return an augmented `Uint8Array` instance, for best performance
  6514. that = array
  6515. that.__proto__ = Buffer.prototype
  6516. } else {
  6517. // Fallback: Return an object instance of the Buffer class
  6518. that = fromArrayLike(that, array)
  6519. }
  6520. return that
  6521. }
  6522. function fromObject (that, obj) {
  6523. if (Buffer.isBuffer(obj)) {
  6524. var len = checked(obj.length) | 0
  6525. that = createBuffer(that, len)
  6526. if (that.length === 0) {
  6527. return that
  6528. }
  6529. obj.copy(that, 0, 0, len)
  6530. return that
  6531. }
  6532. if (obj) {
  6533. if ((typeof ArrayBuffer !== 'undefined' &&
  6534. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6535. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6536. return createBuffer(that, 0)
  6537. }
  6538. return fromArrayLike(that, obj)
  6539. }
  6540. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6541. return fromArrayLike(that, obj.data)
  6542. }
  6543. }
  6544. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6545. }
  6546. function checked (length) {
  6547. // Note: cannot use `length < kMaxLength()` here because that fails when
  6548. // length is NaN (which is otherwise coerced to zero.)
  6549. if (length >= kMaxLength()) {
  6550. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6551. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6552. }
  6553. return length | 0
  6554. }
  6555. function SlowBuffer (length) {
  6556. if (+length != length) { // eslint-disable-line eqeqeq
  6557. length = 0
  6558. }
  6559. return Buffer.alloc(+length)
  6560. }
  6561. Buffer.isBuffer = function isBuffer (b) {
  6562. return !!(b != null && b._isBuffer)
  6563. }
  6564. Buffer.compare = function compare (a, b) {
  6565. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6566. throw new TypeError('Arguments must be Buffers')
  6567. }
  6568. if (a === b) return 0
  6569. var x = a.length
  6570. var y = b.length
  6571. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6572. if (a[i] !== b[i]) {
  6573. x = a[i]
  6574. y = b[i]
  6575. break
  6576. }
  6577. }
  6578. if (x < y) return -1
  6579. if (y < x) return 1
  6580. return 0
  6581. }
  6582. Buffer.isEncoding = function isEncoding (encoding) {
  6583. switch (String(encoding).toLowerCase()) {
  6584. case 'hex':
  6585. case 'utf8':
  6586. case 'utf-8':
  6587. case 'ascii':
  6588. case 'latin1':
  6589. case 'binary':
  6590. case 'base64':
  6591. case 'ucs2':
  6592. case 'ucs-2':
  6593. case 'utf16le':
  6594. case 'utf-16le':
  6595. return true
  6596. default:
  6597. return false
  6598. }
  6599. }
  6600. Buffer.concat = function concat (list, length) {
  6601. if (!isArray(list)) {
  6602. throw new TypeError('"list" argument must be an Array of Buffers')
  6603. }
  6604. if (list.length === 0) {
  6605. return Buffer.alloc(0)
  6606. }
  6607. var i
  6608. if (length === undefined) {
  6609. length = 0
  6610. for (i = 0; i < list.length; ++i) {
  6611. length += list[i].length
  6612. }
  6613. }
  6614. var buffer = Buffer.allocUnsafe(length)
  6615. var pos = 0
  6616. for (i = 0; i < list.length; ++i) {
  6617. var buf = list[i]
  6618. if (!Buffer.isBuffer(buf)) {
  6619. throw new TypeError('"list" argument must be an Array of Buffers')
  6620. }
  6621. buf.copy(buffer, pos)
  6622. pos += buf.length
  6623. }
  6624. return buffer
  6625. }
  6626. function byteLength (string, encoding) {
  6627. if (Buffer.isBuffer(string)) {
  6628. return string.length
  6629. }
  6630. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6631. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6632. return string.byteLength
  6633. }
  6634. if (typeof string !== 'string') {
  6635. string = '' + string
  6636. }
  6637. var len = string.length
  6638. if (len === 0) return 0
  6639. // Use a for loop to avoid recursion
  6640. var loweredCase = false
  6641. for (;;) {
  6642. switch (encoding) {
  6643. case 'ascii':
  6644. case 'latin1':
  6645. case 'binary':
  6646. return len
  6647. case 'utf8':
  6648. case 'utf-8':
  6649. case undefined:
  6650. return utf8ToBytes(string).length
  6651. case 'ucs2':
  6652. case 'ucs-2':
  6653. case 'utf16le':
  6654. case 'utf-16le':
  6655. return len * 2
  6656. case 'hex':
  6657. return len >>> 1
  6658. case 'base64':
  6659. return base64ToBytes(string).length
  6660. default:
  6661. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6662. encoding = ('' + encoding).toLowerCase()
  6663. loweredCase = true
  6664. }
  6665. }
  6666. }
  6667. Buffer.byteLength = byteLength
  6668. function slowToString (encoding, start, end) {
  6669. var loweredCase = false
  6670. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6671. // property of a typed array.
  6672. // This behaves neither like String nor Uint8Array in that we set start/end
  6673. // to their upper/lower bounds if the value passed is out of range.
  6674. // undefined is handled specially as per ECMA-262 6th Edition,
  6675. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6676. if (start === undefined || start < 0) {
  6677. start = 0
  6678. }
  6679. // Return early if start > this.length. Done here to prevent potential uint32
  6680. // coercion fail below.
  6681. if (start > this.length) {
  6682. return ''
  6683. }
  6684. if (end === undefined || end > this.length) {
  6685. end = this.length
  6686. }
  6687. if (end <= 0) {
  6688. return ''
  6689. }
  6690. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6691. end >>>= 0
  6692. start >>>= 0
  6693. if (end <= start) {
  6694. return ''
  6695. }
  6696. if (!encoding) encoding = 'utf8'
  6697. while (true) {
  6698. switch (encoding) {
  6699. case 'hex':
  6700. return hexSlice(this, start, end)
  6701. case 'utf8':
  6702. case 'utf-8':
  6703. return utf8Slice(this, start, end)
  6704. case 'ascii':
  6705. return asciiSlice(this, start, end)
  6706. case 'latin1':
  6707. case 'binary':
  6708. return latin1Slice(this, start, end)
  6709. case 'base64':
  6710. return base64Slice(this, start, end)
  6711. case 'ucs2':
  6712. case 'ucs-2':
  6713. case 'utf16le':
  6714. case 'utf-16le':
  6715. return utf16leSlice(this, start, end)
  6716. default:
  6717. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6718. encoding = (encoding + '').toLowerCase()
  6719. loweredCase = true
  6720. }
  6721. }
  6722. }
  6723. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6724. // Buffer instances.
  6725. Buffer.prototype._isBuffer = true
  6726. function swap (b, n, m) {
  6727. var i = b[n]
  6728. b[n] = b[m]
  6729. b[m] = i
  6730. }
  6731. Buffer.prototype.swap16 = function swap16 () {
  6732. var len = this.length
  6733. if (len % 2 !== 0) {
  6734. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6735. }
  6736. for (var i = 0; i < len; i += 2) {
  6737. swap(this, i, i + 1)
  6738. }
  6739. return this
  6740. }
  6741. Buffer.prototype.swap32 = function swap32 () {
  6742. var len = this.length
  6743. if (len % 4 !== 0) {
  6744. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6745. }
  6746. for (var i = 0; i < len; i += 4) {
  6747. swap(this, i, i + 3)
  6748. swap(this, i + 1, i + 2)
  6749. }
  6750. return this
  6751. }
  6752. Buffer.prototype.swap64 = function swap64 () {
  6753. var len = this.length
  6754. if (len % 8 !== 0) {
  6755. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6756. }
  6757. for (var i = 0; i < len; i += 8) {
  6758. swap(this, i, i + 7)
  6759. swap(this, i + 1, i + 6)
  6760. swap(this, i + 2, i + 5)
  6761. swap(this, i + 3, i + 4)
  6762. }
  6763. return this
  6764. }
  6765. Buffer.prototype.toString = function toString () {
  6766. var length = this.length | 0
  6767. if (length === 0) return ''
  6768. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6769. return slowToString.apply(this, arguments)
  6770. }
  6771. Buffer.prototype.equals = function equals (b) {
  6772. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6773. if (this === b) return true
  6774. return Buffer.compare(this, b) === 0
  6775. }
  6776. Buffer.prototype.inspect = function inspect () {
  6777. var str = ''
  6778. var max = exports.INSPECT_MAX_BYTES
  6779. if (this.length > 0) {
  6780. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6781. if (this.length > max) str += ' ... '
  6782. }
  6783. return '<Buffer ' + str + '>'
  6784. }
  6785. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6786. if (!Buffer.isBuffer(target)) {
  6787. throw new TypeError('Argument must be a Buffer')
  6788. }
  6789. if (start === undefined) {
  6790. start = 0
  6791. }
  6792. if (end === undefined) {
  6793. end = target ? target.length : 0
  6794. }
  6795. if (thisStart === undefined) {
  6796. thisStart = 0
  6797. }
  6798. if (thisEnd === undefined) {
  6799. thisEnd = this.length
  6800. }
  6801. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6802. throw new RangeError('out of range index')
  6803. }
  6804. if (thisStart >= thisEnd && start >= end) {
  6805. return 0
  6806. }
  6807. if (thisStart >= thisEnd) {
  6808. return -1
  6809. }
  6810. if (start >= end) {
  6811. return 1
  6812. }
  6813. start >>>= 0
  6814. end >>>= 0
  6815. thisStart >>>= 0
  6816. thisEnd >>>= 0
  6817. if (this === target) return 0
  6818. var x = thisEnd - thisStart
  6819. var y = end - start
  6820. var len = Math.min(x, y)
  6821. var thisCopy = this.slice(thisStart, thisEnd)
  6822. var targetCopy = target.slice(start, end)
  6823. for (var i = 0; i < len; ++i) {
  6824. if (thisCopy[i] !== targetCopy[i]) {
  6825. x = thisCopy[i]
  6826. y = targetCopy[i]
  6827. break
  6828. }
  6829. }
  6830. if (x < y) return -1
  6831. if (y < x) return 1
  6832. return 0
  6833. }
  6834. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6835. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6836. //
  6837. // Arguments:
  6838. // - buffer - a Buffer to search
  6839. // - val - a string, Buffer, or number
  6840. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6841. // - encoding - an optional encoding, relevant is val is a string
  6842. // - dir - true for indexOf, false for lastIndexOf
  6843. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6844. // Empty buffer means no match
  6845. if (buffer.length === 0) return -1
  6846. // Normalize byteOffset
  6847. if (typeof byteOffset === 'string') {
  6848. encoding = byteOffset
  6849. byteOffset = 0
  6850. } else if (byteOffset > 0x7fffffff) {
  6851. byteOffset = 0x7fffffff
  6852. } else if (byteOffset < -0x80000000) {
  6853. byteOffset = -0x80000000
  6854. }
  6855. byteOffset = +byteOffset // Coerce to Number.
  6856. if (isNaN(byteOffset)) {
  6857. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6858. byteOffset = dir ? 0 : (buffer.length - 1)
  6859. }
  6860. // Normalize byteOffset: negative offsets start from the end of the buffer
  6861. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6862. if (byteOffset >= buffer.length) {
  6863. if (dir) return -1
  6864. else byteOffset = buffer.length - 1
  6865. } else if (byteOffset < 0) {
  6866. if (dir) byteOffset = 0
  6867. else return -1
  6868. }
  6869. // Normalize val
  6870. if (typeof val === 'string') {
  6871. val = Buffer.from(val, encoding)
  6872. }
  6873. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6874. if (Buffer.isBuffer(val)) {
  6875. // Special case: looking for empty string/buffer always fails
  6876. if (val.length === 0) {
  6877. return -1
  6878. }
  6879. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6880. } else if (typeof val === 'number') {
  6881. val = val & 0xFF // Search for a byte value [0-255]
  6882. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6883. typeof Uint8Array.prototype.indexOf === 'function') {
  6884. if (dir) {
  6885. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6886. } else {
  6887. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6888. }
  6889. }
  6890. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6891. }
  6892. throw new TypeError('val must be string, number or Buffer')
  6893. }
  6894. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6895. var indexSize = 1
  6896. var arrLength = arr.length
  6897. var valLength = val.length
  6898. if (encoding !== undefined) {
  6899. encoding = String(encoding).toLowerCase()
  6900. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6901. encoding === 'utf16le' || encoding === 'utf-16le') {
  6902. if (arr.length < 2 || val.length < 2) {
  6903. return -1
  6904. }
  6905. indexSize = 2
  6906. arrLength /= 2
  6907. valLength /= 2
  6908. byteOffset /= 2
  6909. }
  6910. }
  6911. function read (buf, i) {
  6912. if (indexSize === 1) {
  6913. return buf[i]
  6914. } else {
  6915. return buf.readUInt16BE(i * indexSize)
  6916. }
  6917. }
  6918. var i
  6919. if (dir) {
  6920. var foundIndex = -1
  6921. for (i = byteOffset; i < arrLength; i++) {
  6922. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6923. if (foundIndex === -1) foundIndex = i
  6924. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6925. } else {
  6926. if (foundIndex !== -1) i -= i - foundIndex
  6927. foundIndex = -1
  6928. }
  6929. }
  6930. } else {
  6931. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6932. for (i = byteOffset; i >= 0; i--) {
  6933. var found = true
  6934. for (var j = 0; j < valLength; j++) {
  6935. if (read(arr, i + j) !== read(val, j)) {
  6936. found = false
  6937. break
  6938. }
  6939. }
  6940. if (found) return i
  6941. }
  6942. }
  6943. return -1
  6944. }
  6945. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6946. return this.indexOf(val, byteOffset, encoding) !== -1
  6947. }
  6948. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6949. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6950. }
  6951. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6952. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6953. }
  6954. function hexWrite (buf, string, offset, length) {
  6955. offset = Number(offset) || 0
  6956. var remaining = buf.length - offset
  6957. if (!length) {
  6958. length = remaining
  6959. } else {
  6960. length = Number(length)
  6961. if (length > remaining) {
  6962. length = remaining
  6963. }
  6964. }
  6965. // must be an even number of digits
  6966. var strLen = string.length
  6967. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6968. if (length > strLen / 2) {
  6969. length = strLen / 2
  6970. }
  6971. for (var i = 0; i < length; ++i) {
  6972. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6973. if (isNaN(parsed)) return i
  6974. buf[offset + i] = parsed
  6975. }
  6976. return i
  6977. }
  6978. function utf8Write (buf, string, offset, length) {
  6979. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6980. }
  6981. function asciiWrite (buf, string, offset, length) {
  6982. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6983. }
  6984. function latin1Write (buf, string, offset, length) {
  6985. return asciiWrite(buf, string, offset, length)
  6986. }
  6987. function base64Write (buf, string, offset, length) {
  6988. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6989. }
  6990. function ucs2Write (buf, string, offset, length) {
  6991. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6992. }
  6993. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6994. // Buffer#write(string)
  6995. if (offset === undefined) {
  6996. encoding = 'utf8'
  6997. length = this.length
  6998. offset = 0
  6999. // Buffer#write(string, encoding)
  7000. } else if (length === undefined && typeof offset === 'string') {
  7001. encoding = offset
  7002. length = this.length
  7003. offset = 0
  7004. // Buffer#write(string, offset[, length][, encoding])
  7005. } else if (isFinite(offset)) {
  7006. offset = offset | 0
  7007. if (isFinite(length)) {
  7008. length = length | 0
  7009. if (encoding === undefined) encoding = 'utf8'
  7010. } else {
  7011. encoding = length
  7012. length = undefined
  7013. }
  7014. // legacy write(string, encoding, offset, length) - remove in v0.13
  7015. } else {
  7016. throw new Error(
  7017. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7018. )
  7019. }
  7020. var remaining = this.length - offset
  7021. if (length === undefined || length > remaining) length = remaining
  7022. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7023. throw new RangeError('Attempt to write outside buffer bounds')
  7024. }
  7025. if (!encoding) encoding = 'utf8'
  7026. var loweredCase = false
  7027. for (;;) {
  7028. switch (encoding) {
  7029. case 'hex':
  7030. return hexWrite(this, string, offset, length)
  7031. case 'utf8':
  7032. case 'utf-8':
  7033. return utf8Write(this, string, offset, length)
  7034. case 'ascii':
  7035. return asciiWrite(this, string, offset, length)
  7036. case 'latin1':
  7037. case 'binary':
  7038. return latin1Write(this, string, offset, length)
  7039. case 'base64':
  7040. // Warning: maxLength not taken into account in base64Write
  7041. return base64Write(this, string, offset, length)
  7042. case 'ucs2':
  7043. case 'ucs-2':
  7044. case 'utf16le':
  7045. case 'utf-16le':
  7046. return ucs2Write(this, string, offset, length)
  7047. default:
  7048. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7049. encoding = ('' + encoding).toLowerCase()
  7050. loweredCase = true
  7051. }
  7052. }
  7053. }
  7054. Buffer.prototype.toJSON = function toJSON () {
  7055. return {
  7056. type: 'Buffer',
  7057. data: Array.prototype.slice.call(this._arr || this, 0)
  7058. }
  7059. }
  7060. function base64Slice (buf, start, end) {
  7061. if (start === 0 && end === buf.length) {
  7062. return base64.fromByteArray(buf)
  7063. } else {
  7064. return base64.fromByteArray(buf.slice(start, end))
  7065. }
  7066. }
  7067. function utf8Slice (buf, start, end) {
  7068. end = Math.min(buf.length, end)
  7069. var res = []
  7070. var i = start
  7071. while (i < end) {
  7072. var firstByte = buf[i]
  7073. var codePoint = null
  7074. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7075. : (firstByte > 0xDF) ? 3
  7076. : (firstByte > 0xBF) ? 2
  7077. : 1
  7078. if (i + bytesPerSequence <= end) {
  7079. var secondByte, thirdByte, fourthByte, tempCodePoint
  7080. switch (bytesPerSequence) {
  7081. case 1:
  7082. if (firstByte < 0x80) {
  7083. codePoint = firstByte
  7084. }
  7085. break
  7086. case 2:
  7087. secondByte = buf[i + 1]
  7088. if ((secondByte & 0xC0) === 0x80) {
  7089. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7090. if (tempCodePoint > 0x7F) {
  7091. codePoint = tempCodePoint
  7092. }
  7093. }
  7094. break
  7095. case 3:
  7096. secondByte = buf[i + 1]
  7097. thirdByte = buf[i + 2]
  7098. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7099. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7100. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7101. codePoint = tempCodePoint
  7102. }
  7103. }
  7104. break
  7105. case 4:
  7106. secondByte = buf[i + 1]
  7107. thirdByte = buf[i + 2]
  7108. fourthByte = buf[i + 3]
  7109. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7110. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7111. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7112. codePoint = tempCodePoint
  7113. }
  7114. }
  7115. }
  7116. }
  7117. if (codePoint === null) {
  7118. // we did not generate a valid codePoint so insert a
  7119. // replacement char (U+FFFD) and advance only 1 byte
  7120. codePoint = 0xFFFD
  7121. bytesPerSequence = 1
  7122. } else if (codePoint > 0xFFFF) {
  7123. // encode to utf16 (surrogate pair dance)
  7124. codePoint -= 0x10000
  7125. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7126. codePoint = 0xDC00 | codePoint & 0x3FF
  7127. }
  7128. res.push(codePoint)
  7129. i += bytesPerSequence
  7130. }
  7131. return decodeCodePointsArray(res)
  7132. }
  7133. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7134. // the lowest limit is Chrome, with 0x10000 args.
  7135. // We go 1 magnitude less, for safety
  7136. var MAX_ARGUMENTS_LENGTH = 0x1000
  7137. function decodeCodePointsArray (codePoints) {
  7138. var len = codePoints.length
  7139. if (len <= MAX_ARGUMENTS_LENGTH) {
  7140. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7141. }
  7142. // Decode in chunks to avoid "call stack size exceeded".
  7143. var res = ''
  7144. var i = 0
  7145. while (i < len) {
  7146. res += String.fromCharCode.apply(
  7147. String,
  7148. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7149. )
  7150. }
  7151. return res
  7152. }
  7153. function asciiSlice (buf, start, end) {
  7154. var ret = ''
  7155. end = Math.min(buf.length, end)
  7156. for (var i = start; i < end; ++i) {
  7157. ret += String.fromCharCode(buf[i] & 0x7F)
  7158. }
  7159. return ret
  7160. }
  7161. function latin1Slice (buf, start, end) {
  7162. var ret = ''
  7163. end = Math.min(buf.length, end)
  7164. for (var i = start; i < end; ++i) {
  7165. ret += String.fromCharCode(buf[i])
  7166. }
  7167. return ret
  7168. }
  7169. function hexSlice (buf, start, end) {
  7170. var len = buf.length
  7171. if (!start || start < 0) start = 0
  7172. if (!end || end < 0 || end > len) end = len
  7173. var out = ''
  7174. for (var i = start; i < end; ++i) {
  7175. out += toHex(buf[i])
  7176. }
  7177. return out
  7178. }
  7179. function utf16leSlice (buf, start, end) {
  7180. var bytes = buf.slice(start, end)
  7181. var res = ''
  7182. for (var i = 0; i < bytes.length; i += 2) {
  7183. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7184. }
  7185. return res
  7186. }
  7187. Buffer.prototype.slice = function slice (start, end) {
  7188. var len = this.length
  7189. start = ~~start
  7190. end = end === undefined ? len : ~~end
  7191. if (start < 0) {
  7192. start += len
  7193. if (start < 0) start = 0
  7194. } else if (start > len) {
  7195. start = len
  7196. }
  7197. if (end < 0) {
  7198. end += len
  7199. if (end < 0) end = 0
  7200. } else if (end > len) {
  7201. end = len
  7202. }
  7203. if (end < start) end = start
  7204. var newBuf
  7205. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7206. newBuf = this.subarray(start, end)
  7207. newBuf.__proto__ = Buffer.prototype
  7208. } else {
  7209. var sliceLen = end - start
  7210. newBuf = new Buffer(sliceLen, undefined)
  7211. for (var i = 0; i < sliceLen; ++i) {
  7212. newBuf[i] = this[i + start]
  7213. }
  7214. }
  7215. return newBuf
  7216. }
  7217. /*
  7218. * Need to make sure that buffer isn't trying to write out of bounds.
  7219. */
  7220. function checkOffset (offset, ext, length) {
  7221. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7222. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7223. }
  7224. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7225. offset = offset | 0
  7226. byteLength = byteLength | 0
  7227. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7228. var val = this[offset]
  7229. var mul = 1
  7230. var i = 0
  7231. while (++i < byteLength && (mul *= 0x100)) {
  7232. val += this[offset + i] * mul
  7233. }
  7234. return val
  7235. }
  7236. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7237. offset = offset | 0
  7238. byteLength = byteLength | 0
  7239. if (!noAssert) {
  7240. checkOffset(offset, byteLength, this.length)
  7241. }
  7242. var val = this[offset + --byteLength]
  7243. var mul = 1
  7244. while (byteLength > 0 && (mul *= 0x100)) {
  7245. val += this[offset + --byteLength] * mul
  7246. }
  7247. return val
  7248. }
  7249. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7250. if (!noAssert) checkOffset(offset, 1, this.length)
  7251. return this[offset]
  7252. }
  7253. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7254. if (!noAssert) checkOffset(offset, 2, this.length)
  7255. return this[offset] | (this[offset + 1] << 8)
  7256. }
  7257. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7258. if (!noAssert) checkOffset(offset, 2, this.length)
  7259. return (this[offset] << 8) | this[offset + 1]
  7260. }
  7261. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7262. if (!noAssert) checkOffset(offset, 4, this.length)
  7263. return ((this[offset]) |
  7264. (this[offset + 1] << 8) |
  7265. (this[offset + 2] << 16)) +
  7266. (this[offset + 3] * 0x1000000)
  7267. }
  7268. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7269. if (!noAssert) checkOffset(offset, 4, this.length)
  7270. return (this[offset] * 0x1000000) +
  7271. ((this[offset + 1] << 16) |
  7272. (this[offset + 2] << 8) |
  7273. this[offset + 3])
  7274. }
  7275. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7276. offset = offset | 0
  7277. byteLength = byteLength | 0
  7278. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7279. var val = this[offset]
  7280. var mul = 1
  7281. var i = 0
  7282. while (++i < byteLength && (mul *= 0x100)) {
  7283. val += this[offset + i] * mul
  7284. }
  7285. mul *= 0x80
  7286. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7287. return val
  7288. }
  7289. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7290. offset = offset | 0
  7291. byteLength = byteLength | 0
  7292. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7293. var i = byteLength
  7294. var mul = 1
  7295. var val = this[offset + --i]
  7296. while (i > 0 && (mul *= 0x100)) {
  7297. val += this[offset + --i] * mul
  7298. }
  7299. mul *= 0x80
  7300. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7301. return val
  7302. }
  7303. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7304. if (!noAssert) checkOffset(offset, 1, this.length)
  7305. if (!(this[offset] & 0x80)) return (this[offset])
  7306. return ((0xff - this[offset] + 1) * -1)
  7307. }
  7308. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7309. if (!noAssert) checkOffset(offset, 2, this.length)
  7310. var val = this[offset] | (this[offset + 1] << 8)
  7311. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7312. }
  7313. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7314. if (!noAssert) checkOffset(offset, 2, this.length)
  7315. var val = this[offset + 1] | (this[offset] << 8)
  7316. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7317. }
  7318. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7319. if (!noAssert) checkOffset(offset, 4, this.length)
  7320. return (this[offset]) |
  7321. (this[offset + 1] << 8) |
  7322. (this[offset + 2] << 16) |
  7323. (this[offset + 3] << 24)
  7324. }
  7325. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7326. if (!noAssert) checkOffset(offset, 4, this.length)
  7327. return (this[offset] << 24) |
  7328. (this[offset + 1] << 16) |
  7329. (this[offset + 2] << 8) |
  7330. (this[offset + 3])
  7331. }
  7332. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7333. if (!noAssert) checkOffset(offset, 4, this.length)
  7334. return ieee754.read(this, offset, true, 23, 4)
  7335. }
  7336. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7337. if (!noAssert) checkOffset(offset, 4, this.length)
  7338. return ieee754.read(this, offset, false, 23, 4)
  7339. }
  7340. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7341. if (!noAssert) checkOffset(offset, 8, this.length)
  7342. return ieee754.read(this, offset, true, 52, 8)
  7343. }
  7344. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7345. if (!noAssert) checkOffset(offset, 8, this.length)
  7346. return ieee754.read(this, offset, false, 52, 8)
  7347. }
  7348. function checkInt (buf, value, offset, ext, max, min) {
  7349. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7350. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7351. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7352. }
  7353. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7354. value = +value
  7355. offset = offset | 0
  7356. byteLength = byteLength | 0
  7357. if (!noAssert) {
  7358. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7359. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7360. }
  7361. var mul = 1
  7362. var i = 0
  7363. this[offset] = value & 0xFF
  7364. while (++i < byteLength && (mul *= 0x100)) {
  7365. this[offset + i] = (value / mul) & 0xFF
  7366. }
  7367. return offset + byteLength
  7368. }
  7369. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7370. value = +value
  7371. offset = offset | 0
  7372. byteLength = byteLength | 0
  7373. if (!noAssert) {
  7374. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7375. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7376. }
  7377. var i = byteLength - 1
  7378. var mul = 1
  7379. this[offset + i] = value & 0xFF
  7380. while (--i >= 0 && (mul *= 0x100)) {
  7381. this[offset + i] = (value / mul) & 0xFF
  7382. }
  7383. return offset + byteLength
  7384. }
  7385. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7386. value = +value
  7387. offset = offset | 0
  7388. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7389. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7390. this[offset] = (value & 0xff)
  7391. return offset + 1
  7392. }
  7393. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7394. if (value < 0) value = 0xffff + value + 1
  7395. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7396. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7397. (littleEndian ? i : 1 - i) * 8
  7398. }
  7399. }
  7400. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7401. value = +value
  7402. offset = offset | 0
  7403. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7404. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7405. this[offset] = (value & 0xff)
  7406. this[offset + 1] = (value >>> 8)
  7407. } else {
  7408. objectWriteUInt16(this, value, offset, true)
  7409. }
  7410. return offset + 2
  7411. }
  7412. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7413. value = +value
  7414. offset = offset | 0
  7415. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7416. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7417. this[offset] = (value >>> 8)
  7418. this[offset + 1] = (value & 0xff)
  7419. } else {
  7420. objectWriteUInt16(this, value, offset, false)
  7421. }
  7422. return offset + 2
  7423. }
  7424. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7425. if (value < 0) value = 0xffffffff + value + 1
  7426. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7427. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7428. }
  7429. }
  7430. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7431. value = +value
  7432. offset = offset | 0
  7433. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7434. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7435. this[offset + 3] = (value >>> 24)
  7436. this[offset + 2] = (value >>> 16)
  7437. this[offset + 1] = (value >>> 8)
  7438. this[offset] = (value & 0xff)
  7439. } else {
  7440. objectWriteUInt32(this, value, offset, true)
  7441. }
  7442. return offset + 4
  7443. }
  7444. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7445. value = +value
  7446. offset = offset | 0
  7447. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7448. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7449. this[offset] = (value >>> 24)
  7450. this[offset + 1] = (value >>> 16)
  7451. this[offset + 2] = (value >>> 8)
  7452. this[offset + 3] = (value & 0xff)
  7453. } else {
  7454. objectWriteUInt32(this, value, offset, false)
  7455. }
  7456. return offset + 4
  7457. }
  7458. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7459. value = +value
  7460. offset = offset | 0
  7461. if (!noAssert) {
  7462. var limit = Math.pow(2, 8 * byteLength - 1)
  7463. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7464. }
  7465. var i = 0
  7466. var mul = 1
  7467. var sub = 0
  7468. this[offset] = value & 0xFF
  7469. while (++i < byteLength && (mul *= 0x100)) {
  7470. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7471. sub = 1
  7472. }
  7473. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7474. }
  7475. return offset + byteLength
  7476. }
  7477. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7478. value = +value
  7479. offset = offset | 0
  7480. if (!noAssert) {
  7481. var limit = Math.pow(2, 8 * byteLength - 1)
  7482. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7483. }
  7484. var i = byteLength - 1
  7485. var mul = 1
  7486. var sub = 0
  7487. this[offset + i] = value & 0xFF
  7488. while (--i >= 0 && (mul *= 0x100)) {
  7489. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7490. sub = 1
  7491. }
  7492. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7493. }
  7494. return offset + byteLength
  7495. }
  7496. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7497. value = +value
  7498. offset = offset | 0
  7499. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7500. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7501. if (value < 0) value = 0xff + value + 1
  7502. this[offset] = (value & 0xff)
  7503. return offset + 1
  7504. }
  7505. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7506. value = +value
  7507. offset = offset | 0
  7508. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7509. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7510. this[offset] = (value & 0xff)
  7511. this[offset + 1] = (value >>> 8)
  7512. } else {
  7513. objectWriteUInt16(this, value, offset, true)
  7514. }
  7515. return offset + 2
  7516. }
  7517. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7518. value = +value
  7519. offset = offset | 0
  7520. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7521. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7522. this[offset] = (value >>> 8)
  7523. this[offset + 1] = (value & 0xff)
  7524. } else {
  7525. objectWriteUInt16(this, value, offset, false)
  7526. }
  7527. return offset + 2
  7528. }
  7529. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7530. value = +value
  7531. offset = offset | 0
  7532. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7533. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7534. this[offset] = (value & 0xff)
  7535. this[offset + 1] = (value >>> 8)
  7536. this[offset + 2] = (value >>> 16)
  7537. this[offset + 3] = (value >>> 24)
  7538. } else {
  7539. objectWriteUInt32(this, value, offset, true)
  7540. }
  7541. return offset + 4
  7542. }
  7543. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7544. value = +value
  7545. offset = offset | 0
  7546. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7547. if (value < 0) value = 0xffffffff + value + 1
  7548. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7549. this[offset] = (value >>> 24)
  7550. this[offset + 1] = (value >>> 16)
  7551. this[offset + 2] = (value >>> 8)
  7552. this[offset + 3] = (value & 0xff)
  7553. } else {
  7554. objectWriteUInt32(this, value, offset, false)
  7555. }
  7556. return offset + 4
  7557. }
  7558. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7559. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7560. if (offset < 0) throw new RangeError('Index out of range')
  7561. }
  7562. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7563. if (!noAssert) {
  7564. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7565. }
  7566. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7567. return offset + 4
  7568. }
  7569. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7570. return writeFloat(this, value, offset, true, noAssert)
  7571. }
  7572. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7573. return writeFloat(this, value, offset, false, noAssert)
  7574. }
  7575. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7576. if (!noAssert) {
  7577. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7578. }
  7579. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7580. return offset + 8
  7581. }
  7582. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7583. return writeDouble(this, value, offset, true, noAssert)
  7584. }
  7585. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7586. return writeDouble(this, value, offset, false, noAssert)
  7587. }
  7588. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7589. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7590. if (!start) start = 0
  7591. if (!end && end !== 0) end = this.length
  7592. if (targetStart >= target.length) targetStart = target.length
  7593. if (!targetStart) targetStart = 0
  7594. if (end > 0 && end < start) end = start
  7595. // Copy 0 bytes; we're done
  7596. if (end === start) return 0
  7597. if (target.length === 0 || this.length === 0) return 0
  7598. // Fatal error conditions
  7599. if (targetStart < 0) {
  7600. throw new RangeError('targetStart out of bounds')
  7601. }
  7602. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7603. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7604. // Are we oob?
  7605. if (end > this.length) end = this.length
  7606. if (target.length - targetStart < end - start) {
  7607. end = target.length - targetStart + start
  7608. }
  7609. var len = end - start
  7610. var i
  7611. if (this === target && start < targetStart && targetStart < end) {
  7612. // descending copy from end
  7613. for (i = len - 1; i >= 0; --i) {
  7614. target[i + targetStart] = this[i + start]
  7615. }
  7616. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7617. // ascending copy from start
  7618. for (i = 0; i < len; ++i) {
  7619. target[i + targetStart] = this[i + start]
  7620. }
  7621. } else {
  7622. Uint8Array.prototype.set.call(
  7623. target,
  7624. this.subarray(start, start + len),
  7625. targetStart
  7626. )
  7627. }
  7628. return len
  7629. }
  7630. // Usage:
  7631. // buffer.fill(number[, offset[, end]])
  7632. // buffer.fill(buffer[, offset[, end]])
  7633. // buffer.fill(string[, offset[, end]][, encoding])
  7634. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7635. // Handle string cases:
  7636. if (typeof val === 'string') {
  7637. if (typeof start === 'string') {
  7638. encoding = start
  7639. start = 0
  7640. end = this.length
  7641. } else if (typeof end === 'string') {
  7642. encoding = end
  7643. end = this.length
  7644. }
  7645. if (val.length === 1) {
  7646. var code = val.charCodeAt(0)
  7647. if (code < 256) {
  7648. val = code
  7649. }
  7650. }
  7651. if (encoding !== undefined && typeof encoding !== 'string') {
  7652. throw new TypeError('encoding must be a string')
  7653. }
  7654. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7655. throw new TypeError('Unknown encoding: ' + encoding)
  7656. }
  7657. } else if (typeof val === 'number') {
  7658. val = val & 255
  7659. }
  7660. // Invalid ranges are not set to a default, so can range check early.
  7661. if (start < 0 || this.length < start || this.length < end) {
  7662. throw new RangeError('Out of range index')
  7663. }
  7664. if (end <= start) {
  7665. return this
  7666. }
  7667. start = start >>> 0
  7668. end = end === undefined ? this.length : end >>> 0
  7669. if (!val) val = 0
  7670. var i
  7671. if (typeof val === 'number') {
  7672. for (i = start; i < end; ++i) {
  7673. this[i] = val
  7674. }
  7675. } else {
  7676. var bytes = Buffer.isBuffer(val)
  7677. ? val
  7678. : utf8ToBytes(new Buffer(val, encoding).toString())
  7679. var len = bytes.length
  7680. for (i = 0; i < end - start; ++i) {
  7681. this[i + start] = bytes[i % len]
  7682. }
  7683. }
  7684. return this
  7685. }
  7686. // HELPER FUNCTIONS
  7687. // ================
  7688. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7689. function base64clean (str) {
  7690. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7691. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7692. // Node converts strings with length < 2 to ''
  7693. if (str.length < 2) return ''
  7694. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7695. while (str.length % 4 !== 0) {
  7696. str = str + '='
  7697. }
  7698. return str
  7699. }
  7700. function stringtrim (str) {
  7701. if (str.trim) return str.trim()
  7702. return str.replace(/^\s+|\s+$/g, '')
  7703. }
  7704. function toHex (n) {
  7705. if (n < 16) return '0' + n.toString(16)
  7706. return n.toString(16)
  7707. }
  7708. function utf8ToBytes (string, units) {
  7709. units = units || Infinity
  7710. var codePoint
  7711. var length = string.length
  7712. var leadSurrogate = null
  7713. var bytes = []
  7714. for (var i = 0; i < length; ++i) {
  7715. codePoint = string.charCodeAt(i)
  7716. // is surrogate component
  7717. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7718. // last char was a lead
  7719. if (!leadSurrogate) {
  7720. // no lead yet
  7721. if (codePoint > 0xDBFF) {
  7722. // unexpected trail
  7723. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7724. continue
  7725. } else if (i + 1 === length) {
  7726. // unpaired lead
  7727. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7728. continue
  7729. }
  7730. // valid lead
  7731. leadSurrogate = codePoint
  7732. continue
  7733. }
  7734. // 2 leads in a row
  7735. if (codePoint < 0xDC00) {
  7736. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7737. leadSurrogate = codePoint
  7738. continue
  7739. }
  7740. // valid surrogate pair
  7741. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7742. } else if (leadSurrogate) {
  7743. // valid bmp char, but last char was a lead
  7744. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7745. }
  7746. leadSurrogate = null
  7747. // encode utf8
  7748. if (codePoint < 0x80) {
  7749. if ((units -= 1) < 0) break
  7750. bytes.push(codePoint)
  7751. } else if (codePoint < 0x800) {
  7752. if ((units -= 2) < 0) break
  7753. bytes.push(
  7754. codePoint >> 0x6 | 0xC0,
  7755. codePoint & 0x3F | 0x80
  7756. )
  7757. } else if (codePoint < 0x10000) {
  7758. if ((units -= 3) < 0) break
  7759. bytes.push(
  7760. codePoint >> 0xC | 0xE0,
  7761. codePoint >> 0x6 & 0x3F | 0x80,
  7762. codePoint & 0x3F | 0x80
  7763. )
  7764. } else if (codePoint < 0x110000) {
  7765. if ((units -= 4) < 0) break
  7766. bytes.push(
  7767. codePoint >> 0x12 | 0xF0,
  7768. codePoint >> 0xC & 0x3F | 0x80,
  7769. codePoint >> 0x6 & 0x3F | 0x80,
  7770. codePoint & 0x3F | 0x80
  7771. )
  7772. } else {
  7773. throw new Error('Invalid code point')
  7774. }
  7775. }
  7776. return bytes
  7777. }
  7778. function asciiToBytes (str) {
  7779. var byteArray = []
  7780. for (var i = 0; i < str.length; ++i) {
  7781. // Node's code seems to be doing this and not & 0x7F..
  7782. byteArray.push(str.charCodeAt(i) & 0xFF)
  7783. }
  7784. return byteArray
  7785. }
  7786. function utf16leToBytes (str, units) {
  7787. var c, hi, lo
  7788. var byteArray = []
  7789. for (var i = 0; i < str.length; ++i) {
  7790. if ((units -= 2) < 0) break
  7791. c = str.charCodeAt(i)
  7792. hi = c >> 8
  7793. lo = c % 256
  7794. byteArray.push(lo)
  7795. byteArray.push(hi)
  7796. }
  7797. return byteArray
  7798. }
  7799. function base64ToBytes (str) {
  7800. return base64.toByteArray(base64clean(str))
  7801. }
  7802. function blitBuffer (src, dst, offset, length) {
  7803. for (var i = 0; i < length; ++i) {
  7804. if ((i + offset >= dst.length) || (i >= src.length)) break
  7805. dst[i + offset] = src[i]
  7806. }
  7807. return i
  7808. }
  7809. function isnan (val) {
  7810. return val !== val // eslint-disable-line no-self-compare
  7811. }
  7812. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7813. /***/ }),
  7814. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7815. /*!**************************************************!*\
  7816. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7817. \**************************************************/
  7818. /*! no static exports found */
  7819. /***/ (function(module, exports, __webpack_require__) {
  7820. /*!
  7821. * clipboard.js v2.0.4
  7822. * https://zenorocha.github.io/clipboard.js
  7823. *
  7824. * Licensed MIT © Zeno Rocha
  7825. */
  7826. (function webpackUniversalModuleDefinition(root, factory) {
  7827. if(true)
  7828. module.exports = factory();
  7829. else {}
  7830. })(this, function() {
  7831. return /******/ (function(modules) { // webpackBootstrap
  7832. /******/ // The module cache
  7833. /******/ var installedModules = {};
  7834. /******/
  7835. /******/ // The require function
  7836. /******/ function __webpack_require__(moduleId) {
  7837. /******/
  7838. /******/ // Check if module is in cache
  7839. /******/ if(installedModules[moduleId]) {
  7840. /******/ return installedModules[moduleId].exports;
  7841. /******/ }
  7842. /******/ // Create a new module (and put it into the cache)
  7843. /******/ var module = installedModules[moduleId] = {
  7844. /******/ i: moduleId,
  7845. /******/ l: false,
  7846. /******/ exports: {}
  7847. /******/ };
  7848. /******/
  7849. /******/ // Execute the module function
  7850. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7851. /******/
  7852. /******/ // Flag the module as loaded
  7853. /******/ module.l = true;
  7854. /******/
  7855. /******/ // Return the exports of the module
  7856. /******/ return module.exports;
  7857. /******/ }
  7858. /******/
  7859. /******/
  7860. /******/ // expose the modules object (__webpack_modules__)
  7861. /******/ __webpack_require__.m = modules;
  7862. /******/
  7863. /******/ // expose the module cache
  7864. /******/ __webpack_require__.c = installedModules;
  7865. /******/
  7866. /******/ // define getter function for harmony exports
  7867. /******/ __webpack_require__.d = function(exports, name, getter) {
  7868. /******/ if(!__webpack_require__.o(exports, name)) {
  7869. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7870. /******/ }
  7871. /******/ };
  7872. /******/
  7873. /******/ // define __esModule on exports
  7874. /******/ __webpack_require__.r = function(exports) {
  7875. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7876. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7877. /******/ }
  7878. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7879. /******/ };
  7880. /******/
  7881. /******/ // create a fake namespace object
  7882. /******/ // mode & 1: value is a module id, require it
  7883. /******/ // mode & 2: merge all properties of value into the ns
  7884. /******/ // mode & 4: return value when already ns object
  7885. /******/ // mode & 8|1: behave like require
  7886. /******/ __webpack_require__.t = function(value, mode) {
  7887. /******/ if(mode & 1) value = __webpack_require__(value);
  7888. /******/ if(mode & 8) return value;
  7889. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7890. /******/ var ns = Object.create(null);
  7891. /******/ __webpack_require__.r(ns);
  7892. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7893. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7894. /******/ return ns;
  7895. /******/ };
  7896. /******/
  7897. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7898. /******/ __webpack_require__.n = function(module) {
  7899. /******/ var getter = module && module.__esModule ?
  7900. /******/ function getDefault() { return module['default']; } :
  7901. /******/ function getModuleExports() { return module; };
  7902. /******/ __webpack_require__.d(getter, 'a', getter);
  7903. /******/ return getter;
  7904. /******/ };
  7905. /******/
  7906. /******/ // Object.prototype.hasOwnProperty.call
  7907. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7908. /******/
  7909. /******/ // __webpack_public_path__
  7910. /******/ __webpack_require__.p = "";
  7911. /******/
  7912. /******/
  7913. /******/ // Load entry module and return exports
  7914. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7915. /******/ })
  7916. /************************************************************************/
  7917. /******/ ([
  7918. /* 0 */
  7919. /***/ (function(module, exports, __webpack_require__) {
  7920. "use strict";
  7921. 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; };
  7922. 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; }; }();
  7923. var _clipboardAction = __webpack_require__(1);
  7924. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7925. var _tinyEmitter = __webpack_require__(3);
  7926. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7927. var _goodListener = __webpack_require__(4);
  7928. var _goodListener2 = _interopRequireDefault(_goodListener);
  7929. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7930. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7931. 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; }
  7932. 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; }
  7933. /**
  7934. * Base class which takes one or more elements, adds event listeners to them,
  7935. * and instantiates a new `ClipboardAction` on each click.
  7936. */
  7937. var Clipboard = function (_Emitter) {
  7938. _inherits(Clipboard, _Emitter);
  7939. /**
  7940. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7941. * @param {Object} options
  7942. */
  7943. function Clipboard(trigger, options) {
  7944. _classCallCheck(this, Clipboard);
  7945. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7946. _this.resolveOptions(options);
  7947. _this.listenClick(trigger);
  7948. return _this;
  7949. }
  7950. /**
  7951. * Defines if attributes would be resolved using internal setter functions
  7952. * or custom functions that were passed in the constructor.
  7953. * @param {Object} options
  7954. */
  7955. _createClass(Clipboard, [{
  7956. key: 'resolveOptions',
  7957. value: function resolveOptions() {
  7958. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7959. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7960. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7961. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7962. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7963. }
  7964. /**
  7965. * Adds a click event listener to the passed trigger.
  7966. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7967. */
  7968. }, {
  7969. key: 'listenClick',
  7970. value: function listenClick(trigger) {
  7971. var _this2 = this;
  7972. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7973. return _this2.onClick(e);
  7974. });
  7975. }
  7976. /**
  7977. * Defines a new `ClipboardAction` on each click event.
  7978. * @param {Event} e
  7979. */
  7980. }, {
  7981. key: 'onClick',
  7982. value: function onClick(e) {
  7983. var trigger = e.delegateTarget || e.currentTarget;
  7984. if (this.clipboardAction) {
  7985. this.clipboardAction = null;
  7986. }
  7987. this.clipboardAction = new _clipboardAction2.default({
  7988. action: this.action(trigger),
  7989. target: this.target(trigger),
  7990. text: this.text(trigger),
  7991. container: this.container,
  7992. trigger: trigger,
  7993. emitter: this
  7994. });
  7995. }
  7996. /**
  7997. * Default `action` lookup function.
  7998. * @param {Element} trigger
  7999. */
  8000. }, {
  8001. key: 'defaultAction',
  8002. value: function defaultAction(trigger) {
  8003. return getAttributeValue('action', trigger);
  8004. }
  8005. /**
  8006. * Default `target` lookup function.
  8007. * @param {Element} trigger
  8008. */
  8009. }, {
  8010. key: 'defaultTarget',
  8011. value: function defaultTarget(trigger) {
  8012. var selector = getAttributeValue('target', trigger);
  8013. if (selector) {
  8014. return document.querySelector(selector);
  8015. }
  8016. }
  8017. /**
  8018. * Returns the support of the given action, or all actions if no action is
  8019. * given.
  8020. * @param {String} [action]
  8021. */
  8022. }, {
  8023. key: 'defaultText',
  8024. /**
  8025. * Default `text` lookup function.
  8026. * @param {Element} trigger
  8027. */
  8028. value: function defaultText(trigger) {
  8029. return getAttributeValue('text', trigger);
  8030. }
  8031. /**
  8032. * Destroy lifecycle.
  8033. */
  8034. }, {
  8035. key: 'destroy',
  8036. value: function destroy() {
  8037. this.listener.destroy();
  8038. if (this.clipboardAction) {
  8039. this.clipboardAction.destroy();
  8040. this.clipboardAction = null;
  8041. }
  8042. }
  8043. }], [{
  8044. key: 'isSupported',
  8045. value: function isSupported() {
  8046. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8047. var actions = typeof action === 'string' ? [action] : action;
  8048. var support = !!document.queryCommandSupported;
  8049. actions.forEach(function (action) {
  8050. support = support && !!document.queryCommandSupported(action);
  8051. });
  8052. return support;
  8053. }
  8054. }]);
  8055. return Clipboard;
  8056. }(_tinyEmitter2.default);
  8057. /**
  8058. * Helper function to retrieve attribute value.
  8059. * @param {String} suffix
  8060. * @param {Element} element
  8061. */
  8062. function getAttributeValue(suffix, element) {
  8063. var attribute = 'data-clipboard-' + suffix;
  8064. if (!element.hasAttribute(attribute)) {
  8065. return;
  8066. }
  8067. return element.getAttribute(attribute);
  8068. }
  8069. module.exports = Clipboard;
  8070. /***/ }),
  8071. /* 1 */
  8072. /***/ (function(module, exports, __webpack_require__) {
  8073. "use strict";
  8074. 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; };
  8075. 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; }; }();
  8076. var _select = __webpack_require__(2);
  8077. var _select2 = _interopRequireDefault(_select);
  8078. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8079. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8080. /**
  8081. * Inner class which performs selection from either `text` or `target`
  8082. * properties and then executes copy or cut operations.
  8083. */
  8084. var ClipboardAction = function () {
  8085. /**
  8086. * @param {Object} options
  8087. */
  8088. function ClipboardAction(options) {
  8089. _classCallCheck(this, ClipboardAction);
  8090. this.resolveOptions(options);
  8091. this.initSelection();
  8092. }
  8093. /**
  8094. * Defines base properties passed from constructor.
  8095. * @param {Object} options
  8096. */
  8097. _createClass(ClipboardAction, [{
  8098. key: 'resolveOptions',
  8099. value: function resolveOptions() {
  8100. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8101. this.action = options.action;
  8102. this.container = options.container;
  8103. this.emitter = options.emitter;
  8104. this.target = options.target;
  8105. this.text = options.text;
  8106. this.trigger = options.trigger;
  8107. this.selectedText = '';
  8108. }
  8109. /**
  8110. * Decides which selection strategy is going to be applied based
  8111. * on the existence of `text` and `target` properties.
  8112. */
  8113. }, {
  8114. key: 'initSelection',
  8115. value: function initSelection() {
  8116. if (this.text) {
  8117. this.selectFake();
  8118. } else if (this.target) {
  8119. this.selectTarget();
  8120. }
  8121. }
  8122. /**
  8123. * Creates a fake textarea element, sets its value from `text` property,
  8124. * and makes a selection on it.
  8125. */
  8126. }, {
  8127. key: 'selectFake',
  8128. value: function selectFake() {
  8129. var _this = this;
  8130. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8131. this.removeFake();
  8132. this.fakeHandlerCallback = function () {
  8133. return _this.removeFake();
  8134. };
  8135. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8136. this.fakeElem = document.createElement('textarea');
  8137. // Prevent zooming on iOS
  8138. this.fakeElem.style.fontSize = '12pt';
  8139. // Reset box model
  8140. this.fakeElem.style.border = '0';
  8141. this.fakeElem.style.padding = '0';
  8142. this.fakeElem.style.margin = '0';
  8143. // Move element out of screen horizontally
  8144. this.fakeElem.style.position = 'absolute';
  8145. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8146. // Move element to the same position vertically
  8147. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8148. this.fakeElem.style.top = yPosition + 'px';
  8149. this.fakeElem.setAttribute('readonly', '');
  8150. this.fakeElem.value = this.text;
  8151. this.container.appendChild(this.fakeElem);
  8152. this.selectedText = (0, _select2.default)(this.fakeElem);
  8153. this.copyText();
  8154. }
  8155. /**
  8156. * Only removes the fake element after another click event, that way
  8157. * a user can hit `Ctrl+C` to copy because selection still exists.
  8158. */
  8159. }, {
  8160. key: 'removeFake',
  8161. value: function removeFake() {
  8162. if (this.fakeHandler) {
  8163. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8164. this.fakeHandler = null;
  8165. this.fakeHandlerCallback = null;
  8166. }
  8167. if (this.fakeElem) {
  8168. this.container.removeChild(this.fakeElem);
  8169. this.fakeElem = null;
  8170. }
  8171. }
  8172. /**
  8173. * Selects the content from element passed on `target` property.
  8174. */
  8175. }, {
  8176. key: 'selectTarget',
  8177. value: function selectTarget() {
  8178. this.selectedText = (0, _select2.default)(this.target);
  8179. this.copyText();
  8180. }
  8181. /**
  8182. * Executes the copy operation based on the current selection.
  8183. */
  8184. }, {
  8185. key: 'copyText',
  8186. value: function copyText() {
  8187. var succeeded = void 0;
  8188. try {
  8189. succeeded = document.execCommand(this.action);
  8190. } catch (err) {
  8191. succeeded = false;
  8192. }
  8193. this.handleResult(succeeded);
  8194. }
  8195. /**
  8196. * Fires an event based on the copy operation result.
  8197. * @param {Boolean} succeeded
  8198. */
  8199. }, {
  8200. key: 'handleResult',
  8201. value: function handleResult(succeeded) {
  8202. this.emitter.emit(succeeded ? 'success' : 'error', {
  8203. action: this.action,
  8204. text: this.selectedText,
  8205. trigger: this.trigger,
  8206. clearSelection: this.clearSelection.bind(this)
  8207. });
  8208. }
  8209. /**
  8210. * Moves focus away from `target` and back to the trigger, removes current selection.
  8211. */
  8212. }, {
  8213. key: 'clearSelection',
  8214. value: function clearSelection() {
  8215. if (this.trigger) {
  8216. this.trigger.focus();
  8217. }
  8218. window.getSelection().removeAllRanges();
  8219. }
  8220. /**
  8221. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8222. * @param {String} action
  8223. */
  8224. }, {
  8225. key: 'destroy',
  8226. /**
  8227. * Destroy lifecycle.
  8228. */
  8229. value: function destroy() {
  8230. this.removeFake();
  8231. }
  8232. }, {
  8233. key: 'action',
  8234. set: function set() {
  8235. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8236. this._action = action;
  8237. if (this._action !== 'copy' && this._action !== 'cut') {
  8238. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8239. }
  8240. }
  8241. /**
  8242. * Gets the `action` property.
  8243. * @return {String}
  8244. */
  8245. ,
  8246. get: function get() {
  8247. return this._action;
  8248. }
  8249. /**
  8250. * Sets the `target` property using an element
  8251. * that will be have its content copied.
  8252. * @param {Element} target
  8253. */
  8254. }, {
  8255. key: 'target',
  8256. set: function set(target) {
  8257. if (target !== undefined) {
  8258. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8259. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8260. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8261. }
  8262. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8263. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8264. }
  8265. this._target = target;
  8266. } else {
  8267. throw new Error('Invalid "target" value, use a valid Element');
  8268. }
  8269. }
  8270. }
  8271. /**
  8272. * Gets the `target` property.
  8273. * @return {String|HTMLElement}
  8274. */
  8275. ,
  8276. get: function get() {
  8277. return this._target;
  8278. }
  8279. }]);
  8280. return ClipboardAction;
  8281. }();
  8282. module.exports = ClipboardAction;
  8283. /***/ }),
  8284. /* 2 */
  8285. /***/ (function(module, exports) {
  8286. function select(element) {
  8287. var selectedText;
  8288. if (element.nodeName === 'SELECT') {
  8289. element.focus();
  8290. selectedText = element.value;
  8291. }
  8292. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8293. var isReadOnly = element.hasAttribute('readonly');
  8294. if (!isReadOnly) {
  8295. element.setAttribute('readonly', '');
  8296. }
  8297. element.select();
  8298. element.setSelectionRange(0, element.value.length);
  8299. if (!isReadOnly) {
  8300. element.removeAttribute('readonly');
  8301. }
  8302. selectedText = element.value;
  8303. }
  8304. else {
  8305. if (element.hasAttribute('contenteditable')) {
  8306. element.focus();
  8307. }
  8308. var selection = window.getSelection();
  8309. var range = document.createRange();
  8310. range.selectNodeContents(element);
  8311. selection.removeAllRanges();
  8312. selection.addRange(range);
  8313. selectedText = selection.toString();
  8314. }
  8315. return selectedText;
  8316. }
  8317. module.exports = select;
  8318. /***/ }),
  8319. /* 3 */
  8320. /***/ (function(module, exports) {
  8321. function E () {
  8322. // Keep this empty so it's easier to inherit from
  8323. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8324. }
  8325. E.prototype = {
  8326. on: function (name, callback, ctx) {
  8327. var e = this.e || (this.e = {});
  8328. (e[name] || (e[name] = [])).push({
  8329. fn: callback,
  8330. ctx: ctx
  8331. });
  8332. return this;
  8333. },
  8334. once: function (name, callback, ctx) {
  8335. var self = this;
  8336. function listener () {
  8337. self.off(name, listener);
  8338. callback.apply(ctx, arguments);
  8339. };
  8340. listener._ = callback
  8341. return this.on(name, listener, ctx);
  8342. },
  8343. emit: function (name) {
  8344. var data = [].slice.call(arguments, 1);
  8345. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8346. var i = 0;
  8347. var len = evtArr.length;
  8348. for (i; i < len; i++) {
  8349. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8350. }
  8351. return this;
  8352. },
  8353. off: function (name, callback) {
  8354. var e = this.e || (this.e = {});
  8355. var evts = e[name];
  8356. var liveEvents = [];
  8357. if (evts && callback) {
  8358. for (var i = 0, len = evts.length; i < len; i++) {
  8359. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8360. liveEvents.push(evts[i]);
  8361. }
  8362. }
  8363. // Remove event from queue to prevent memory leak
  8364. // Suggested by https://github.com/lazd
  8365. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8366. (liveEvents.length)
  8367. ? e[name] = liveEvents
  8368. : delete e[name];
  8369. return this;
  8370. }
  8371. };
  8372. module.exports = E;
  8373. /***/ }),
  8374. /* 4 */
  8375. /***/ (function(module, exports, __webpack_require__) {
  8376. var is = __webpack_require__(5);
  8377. var delegate = __webpack_require__(6);
  8378. /**
  8379. * Validates all params and calls the right
  8380. * listener function based on its target type.
  8381. *
  8382. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8383. * @param {String} type
  8384. * @param {Function} callback
  8385. * @return {Object}
  8386. */
  8387. function listen(target, type, callback) {
  8388. if (!target && !type && !callback) {
  8389. throw new Error('Missing required arguments');
  8390. }
  8391. if (!is.string(type)) {
  8392. throw new TypeError('Second argument must be a String');
  8393. }
  8394. if (!is.fn(callback)) {
  8395. throw new TypeError('Third argument must be a Function');
  8396. }
  8397. if (is.node(target)) {
  8398. return listenNode(target, type, callback);
  8399. }
  8400. else if (is.nodeList(target)) {
  8401. return listenNodeList(target, type, callback);
  8402. }
  8403. else if (is.string(target)) {
  8404. return listenSelector(target, type, callback);
  8405. }
  8406. else {
  8407. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8408. }
  8409. }
  8410. /**
  8411. * Adds an event listener to a HTML element
  8412. * and returns a remove listener function.
  8413. *
  8414. * @param {HTMLElement} node
  8415. * @param {String} type
  8416. * @param {Function} callback
  8417. * @return {Object}
  8418. */
  8419. function listenNode(node, type, callback) {
  8420. node.addEventListener(type, callback);
  8421. return {
  8422. destroy: function() {
  8423. node.removeEventListener(type, callback);
  8424. }
  8425. }
  8426. }
  8427. /**
  8428. * Add an event listener to a list of HTML elements
  8429. * and returns a remove listener function.
  8430. *
  8431. * @param {NodeList|HTMLCollection} nodeList
  8432. * @param {String} type
  8433. * @param {Function} callback
  8434. * @return {Object}
  8435. */
  8436. function listenNodeList(nodeList, type, callback) {
  8437. Array.prototype.forEach.call(nodeList, function(node) {
  8438. node.addEventListener(type, callback);
  8439. });
  8440. return {
  8441. destroy: function() {
  8442. Array.prototype.forEach.call(nodeList, function(node) {
  8443. node.removeEventListener(type, callback);
  8444. });
  8445. }
  8446. }
  8447. }
  8448. /**
  8449. * Add an event listener to a selector
  8450. * and returns a remove listener function.
  8451. *
  8452. * @param {String} selector
  8453. * @param {String} type
  8454. * @param {Function} callback
  8455. * @return {Object}
  8456. */
  8457. function listenSelector(selector, type, callback) {
  8458. return delegate(document.body, selector, type, callback);
  8459. }
  8460. module.exports = listen;
  8461. /***/ }),
  8462. /* 5 */
  8463. /***/ (function(module, exports) {
  8464. /**
  8465. * Check if argument is a HTML element.
  8466. *
  8467. * @param {Object} value
  8468. * @return {Boolean}
  8469. */
  8470. exports.node = function(value) {
  8471. return value !== undefined
  8472. && value instanceof HTMLElement
  8473. && value.nodeType === 1;
  8474. };
  8475. /**
  8476. * Check if argument is a list of HTML elements.
  8477. *
  8478. * @param {Object} value
  8479. * @return {Boolean}
  8480. */
  8481. exports.nodeList = function(value) {
  8482. var type = Object.prototype.toString.call(value);
  8483. return value !== undefined
  8484. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8485. && ('length' in value)
  8486. && (value.length === 0 || exports.node(value[0]));
  8487. };
  8488. /**
  8489. * Check if argument is a string.
  8490. *
  8491. * @param {Object} value
  8492. * @return {Boolean}
  8493. */
  8494. exports.string = function(value) {
  8495. return typeof value === 'string'
  8496. || value instanceof String;
  8497. };
  8498. /**
  8499. * Check if argument is a function.
  8500. *
  8501. * @param {Object} value
  8502. * @return {Boolean}
  8503. */
  8504. exports.fn = function(value) {
  8505. var type = Object.prototype.toString.call(value);
  8506. return type === '[object Function]';
  8507. };
  8508. /***/ }),
  8509. /* 6 */
  8510. /***/ (function(module, exports, __webpack_require__) {
  8511. var closest = __webpack_require__(7);
  8512. /**
  8513. * Delegates event to a selector.
  8514. *
  8515. * @param {Element} element
  8516. * @param {String} selector
  8517. * @param {String} type
  8518. * @param {Function} callback
  8519. * @param {Boolean} useCapture
  8520. * @return {Object}
  8521. */
  8522. function _delegate(element, selector, type, callback, useCapture) {
  8523. var listenerFn = listener.apply(this, arguments);
  8524. element.addEventListener(type, listenerFn, useCapture);
  8525. return {
  8526. destroy: function() {
  8527. element.removeEventListener(type, listenerFn, useCapture);
  8528. }
  8529. }
  8530. }
  8531. /**
  8532. * Delegates event to a selector.
  8533. *
  8534. * @param {Element|String|Array} [elements]
  8535. * @param {String} selector
  8536. * @param {String} type
  8537. * @param {Function} callback
  8538. * @param {Boolean} useCapture
  8539. * @return {Object}
  8540. */
  8541. function delegate(elements, selector, type, callback, useCapture) {
  8542. // Handle the regular Element usage
  8543. if (typeof elements.addEventListener === 'function') {
  8544. return _delegate.apply(null, arguments);
  8545. }
  8546. // Handle Element-less usage, it defaults to global delegation
  8547. if (typeof type === 'function') {
  8548. // Use `document` as the first parameter, then apply arguments
  8549. // This is a short way to .unshift `arguments` without running into deoptimizations
  8550. return _delegate.bind(null, document).apply(null, arguments);
  8551. }
  8552. // Handle Selector-based usage
  8553. if (typeof elements === 'string') {
  8554. elements = document.querySelectorAll(elements);
  8555. }
  8556. // Handle Array-like based usage
  8557. return Array.prototype.map.call(elements, function (element) {
  8558. return _delegate(element, selector, type, callback, useCapture);
  8559. });
  8560. }
  8561. /**
  8562. * Finds closest match and invokes callback.
  8563. *
  8564. * @param {Element} element
  8565. * @param {String} selector
  8566. * @param {String} type
  8567. * @param {Function} callback
  8568. * @return {Function}
  8569. */
  8570. function listener(element, selector, type, callback) {
  8571. return function(e) {
  8572. e.delegateTarget = closest(e.target, selector);
  8573. if (e.delegateTarget) {
  8574. callback.call(element, e);
  8575. }
  8576. }
  8577. }
  8578. module.exports = delegate;
  8579. /***/ }),
  8580. /* 7 */
  8581. /***/ (function(module, exports) {
  8582. var DOCUMENT_NODE_TYPE = 9;
  8583. /**
  8584. * A polyfill for Element.matches()
  8585. */
  8586. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8587. var proto = Element.prototype;
  8588. proto.matches = proto.matchesSelector ||
  8589. proto.mozMatchesSelector ||
  8590. proto.msMatchesSelector ||
  8591. proto.oMatchesSelector ||
  8592. proto.webkitMatchesSelector;
  8593. }
  8594. /**
  8595. * Finds the closest parent that matches a selector.
  8596. *
  8597. * @param {Element} element
  8598. * @param {String} selector
  8599. * @return {Function}
  8600. */
  8601. function closest (element, selector) {
  8602. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8603. if (typeof element.matches === 'function' &&
  8604. element.matches(selector)) {
  8605. return element;
  8606. }
  8607. element = element.parentNode;
  8608. }
  8609. }
  8610. module.exports = closest;
  8611. /***/ })
  8612. /******/ ]);
  8613. });
  8614. /***/ }),
  8615. /***/ "./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&":
  8616. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  8617. !*** ./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& ***!
  8618. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  8619. /*! no static exports found */
  8620. /***/ (function(module, exports, __webpack_require__) {
  8621. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8622. // imports
  8623. // module
  8624. 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", ""]);
  8625. // exports
  8626. /***/ }),
  8627. /***/ "./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&":
  8628. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8629. !*** ./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& ***!
  8630. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8631. /*! no static exports found */
  8632. /***/ (function(module, exports, __webpack_require__) {
  8633. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8634. // imports
  8635. // module
  8636. 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", ""]);
  8637. // exports
  8638. /***/ }),
  8639. /***/ "./node_modules/css-loader/lib/css-base.js":
  8640. /*!*************************************************!*\
  8641. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8642. \*************************************************/
  8643. /*! no static exports found */
  8644. /***/ (function(module, exports) {
  8645. /*
  8646. MIT License http://www.opensource.org/licenses/mit-license.php
  8647. Author Tobias Koppers @sokra
  8648. */
  8649. // css base code, injected by the css-loader
  8650. module.exports = function(useSourceMap) {
  8651. var list = [];
  8652. // return the list of modules as css string
  8653. list.toString = function toString() {
  8654. return this.map(function (item) {
  8655. var content = cssWithMappingToString(item, useSourceMap);
  8656. if(item[2]) {
  8657. return "@media " + item[2] + "{" + content + "}";
  8658. } else {
  8659. return content;
  8660. }
  8661. }).join("");
  8662. };
  8663. // import a list of modules into the list
  8664. list.i = function(modules, mediaQuery) {
  8665. if(typeof modules === "string")
  8666. modules = [[null, modules, ""]];
  8667. var alreadyImportedModules = {};
  8668. for(var i = 0; i < this.length; i++) {
  8669. var id = this[i][0];
  8670. if(typeof id === "number")
  8671. alreadyImportedModules[id] = true;
  8672. }
  8673. for(i = 0; i < modules.length; i++) {
  8674. var item = modules[i];
  8675. // skip already imported module
  8676. // this implementation is not 100% perfect for weird media query combinations
  8677. // when a module is imported multiple times with different media queries.
  8678. // I hope this will never occur (Hey this way we have smaller bundles)
  8679. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8680. if(mediaQuery && !item[2]) {
  8681. item[2] = mediaQuery;
  8682. } else if(mediaQuery) {
  8683. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  8684. }
  8685. list.push(item);
  8686. }
  8687. }
  8688. };
  8689. return list;
  8690. };
  8691. function cssWithMappingToString(item, useSourceMap) {
  8692. var content = item[1] || '';
  8693. var cssMapping = item[3];
  8694. if (!cssMapping) {
  8695. return content;
  8696. }
  8697. if (useSourceMap && typeof btoa === 'function') {
  8698. var sourceMapping = toComment(cssMapping);
  8699. var sourceURLs = cssMapping.sources.map(function (source) {
  8700. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  8701. });
  8702. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  8703. }
  8704. return [content].join('\n');
  8705. }
  8706. // Adapted from convert-source-map (MIT)
  8707. function toComment(sourceMap) {
  8708. // eslint-disable-next-line no-undef
  8709. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  8710. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  8711. return '/*# ' + data + ' */';
  8712. }
  8713. /***/ }),
  8714. /***/ "./node_modules/ieee754/index.js":
  8715. /*!***************************************!*\
  8716. !*** ./node_modules/ieee754/index.js ***!
  8717. \***************************************/
  8718. /*! no static exports found */
  8719. /***/ (function(module, exports) {
  8720. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8721. var e, m
  8722. var eLen = (nBytes * 8) - mLen - 1
  8723. var eMax = (1 << eLen) - 1
  8724. var eBias = eMax >> 1
  8725. var nBits = -7
  8726. var i = isLE ? (nBytes - 1) : 0
  8727. var d = isLE ? -1 : 1
  8728. var s = buffer[offset + i]
  8729. i += d
  8730. e = s & ((1 << (-nBits)) - 1)
  8731. s >>= (-nBits)
  8732. nBits += eLen
  8733. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8734. m = e & ((1 << (-nBits)) - 1)
  8735. e >>= (-nBits)
  8736. nBits += mLen
  8737. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8738. if (e === 0) {
  8739. e = 1 - eBias
  8740. } else if (e === eMax) {
  8741. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8742. } else {
  8743. m = m + Math.pow(2, mLen)
  8744. e = e - eBias
  8745. }
  8746. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8747. }
  8748. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8749. var e, m, c
  8750. var eLen = (nBytes * 8) - mLen - 1
  8751. var eMax = (1 << eLen) - 1
  8752. var eBias = eMax >> 1
  8753. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8754. var i = isLE ? 0 : (nBytes - 1)
  8755. var d = isLE ? 1 : -1
  8756. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8757. value = Math.abs(value)
  8758. if (isNaN(value) || value === Infinity) {
  8759. m = isNaN(value) ? 1 : 0
  8760. e = eMax
  8761. } else {
  8762. e = Math.floor(Math.log(value) / Math.LN2)
  8763. if (value * (c = Math.pow(2, -e)) < 1) {
  8764. e--
  8765. c *= 2
  8766. }
  8767. if (e + eBias >= 1) {
  8768. value += rt / c
  8769. } else {
  8770. value += rt * Math.pow(2, 1 - eBias)
  8771. }
  8772. if (value * c >= 2) {
  8773. e++
  8774. c /= 2
  8775. }
  8776. if (e + eBias >= eMax) {
  8777. m = 0
  8778. e = eMax
  8779. } else if (e + eBias >= 1) {
  8780. m = ((value * c) - 1) * Math.pow(2, mLen)
  8781. e = e + eBias
  8782. } else {
  8783. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8784. e = 0
  8785. }
  8786. }
  8787. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8788. e = (e << mLen) | m
  8789. eLen += mLen
  8790. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8791. buffer[offset + i - d] |= s * 128
  8792. }
  8793. /***/ }),
  8794. /***/ "./node_modules/isarray/index.js":
  8795. /*!***************************************!*\
  8796. !*** ./node_modules/isarray/index.js ***!
  8797. \***************************************/
  8798. /*! no static exports found */
  8799. /***/ (function(module, exports) {
  8800. var toString = {}.toString;
  8801. module.exports = Array.isArray || function (arr) {
  8802. return toString.call(arr) == '[object Array]';
  8803. };
  8804. /***/ }),
  8805. /***/ "./node_modules/jquery/dist/jquery.js":
  8806. /*!********************************************!*\
  8807. !*** ./node_modules/jquery/dist/jquery.js ***!
  8808. \********************************************/
  8809. /*! no static exports found */
  8810. /***/ (function(module, exports, __webpack_require__) {
  8811. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8812. * jQuery JavaScript Library v3.4.1
  8813. * https://jquery.com/
  8814. *
  8815. * Includes Sizzle.js
  8816. * https://sizzlejs.com/
  8817. *
  8818. * Copyright JS Foundation and other contributors
  8819. * Released under the MIT license
  8820. * https://jquery.org/license
  8821. *
  8822. * Date: 2019-05-01T21:04Z
  8823. */
  8824. ( function( global, factory ) {
  8825. "use strict";
  8826. if ( true && typeof module.exports === "object" ) {
  8827. // For CommonJS and CommonJS-like environments where a proper `window`
  8828. // is present, execute the factory and get jQuery.
  8829. // For environments that do not have a `window` with a `document`
  8830. // (such as Node.js), expose a factory as module.exports.
  8831. // This accentuates the need for the creation of a real `window`.
  8832. // e.g. var jQuery = require("jquery")(window);
  8833. // See ticket #14549 for more info.
  8834. module.exports = global.document ?
  8835. factory( global, true ) :
  8836. function( w ) {
  8837. if ( !w.document ) {
  8838. throw new Error( "jQuery requires a window with a document" );
  8839. }
  8840. return factory( w );
  8841. };
  8842. } else {
  8843. factory( global );
  8844. }
  8845. // Pass this if window is not defined yet
  8846. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8847. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8848. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8849. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8850. // enough that all such attempts are guarded in a try block.
  8851. "use strict";
  8852. var arr = [];
  8853. var document = window.document;
  8854. var getProto = Object.getPrototypeOf;
  8855. var slice = arr.slice;
  8856. var concat = arr.concat;
  8857. var push = arr.push;
  8858. var indexOf = arr.indexOf;
  8859. var class2type = {};
  8860. var toString = class2type.toString;
  8861. var hasOwn = class2type.hasOwnProperty;
  8862. var fnToString = hasOwn.toString;
  8863. var ObjectFunctionString = fnToString.call( Object );
  8864. var support = {};
  8865. var isFunction = function isFunction( obj ) {
  8866. // Support: Chrome <=57, Firefox <=52
  8867. // In some browsers, typeof returns "function" for HTML <object> elements
  8868. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8869. // We don't want to classify *any* DOM node as a function.
  8870. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8871. };
  8872. var isWindow = function isWindow( obj ) {
  8873. return obj != null && obj === obj.window;
  8874. };
  8875. var preservedScriptAttributes = {
  8876. type: true,
  8877. src: true,
  8878. nonce: true,
  8879. noModule: true
  8880. };
  8881. function DOMEval( code, node, doc ) {
  8882. doc = doc || document;
  8883. var i, val,
  8884. script = doc.createElement( "script" );
  8885. script.text = code;
  8886. if ( node ) {
  8887. for ( i in preservedScriptAttributes ) {
  8888. // Support: Firefox 64+, Edge 18+
  8889. // Some browsers don't support the "nonce" property on scripts.
  8890. // On the other hand, just using `getAttribute` is not enough as
  8891. // the `nonce` attribute is reset to an empty string whenever it
  8892. // becomes browsing-context connected.
  8893. // See https://github.com/whatwg/html/issues/2369
  8894. // See https://html.spec.whatwg.org/#nonce-attributes
  8895. // The `node.getAttribute` check was added for the sake of
  8896. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8897. // via an object.
  8898. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8899. if ( val ) {
  8900. script.setAttribute( i, val );
  8901. }
  8902. }
  8903. }
  8904. doc.head.appendChild( script ).parentNode.removeChild( script );
  8905. }
  8906. function toType( obj ) {
  8907. if ( obj == null ) {
  8908. return obj + "";
  8909. }
  8910. // Support: Android <=2.3 only (functionish RegExp)
  8911. return typeof obj === "object" || typeof obj === "function" ?
  8912. class2type[ toString.call( obj ) ] || "object" :
  8913. typeof obj;
  8914. }
  8915. /* global Symbol */
  8916. // Defining this global in .eslintrc.json would create a danger of using the global
  8917. // unguarded in another place, it seems safer to define global only for this module
  8918. var
  8919. version = "3.4.1",
  8920. // Define a local copy of jQuery
  8921. jQuery = function( selector, context ) {
  8922. // The jQuery object is actually just the init constructor 'enhanced'
  8923. // Need init if jQuery is called (just allow error to be thrown if not included)
  8924. return new jQuery.fn.init( selector, context );
  8925. },
  8926. // Support: Android <=4.0 only
  8927. // Make sure we trim BOM and NBSP
  8928. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8929. jQuery.fn = jQuery.prototype = {
  8930. // The current version of jQuery being used
  8931. jquery: version,
  8932. constructor: jQuery,
  8933. // The default length of a jQuery object is 0
  8934. length: 0,
  8935. toArray: function() {
  8936. return slice.call( this );
  8937. },
  8938. // Get the Nth element in the matched element set OR
  8939. // Get the whole matched element set as a clean array
  8940. get: function( num ) {
  8941. // Return all the elements in a clean array
  8942. if ( num == null ) {
  8943. return slice.call( this );
  8944. }
  8945. // Return just the one element from the set
  8946. return num < 0 ? this[ num + this.length ] : this[ num ];
  8947. },
  8948. // Take an array of elements and push it onto the stack
  8949. // (returning the new matched element set)
  8950. pushStack: function( elems ) {
  8951. // Build a new jQuery matched element set
  8952. var ret = jQuery.merge( this.constructor(), elems );
  8953. // Add the old object onto the stack (as a reference)
  8954. ret.prevObject = this;
  8955. // Return the newly-formed element set
  8956. return ret;
  8957. },
  8958. // Execute a callback for every element in the matched set.
  8959. each: function( callback ) {
  8960. return jQuery.each( this, callback );
  8961. },
  8962. map: function( callback ) {
  8963. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8964. return callback.call( elem, i, elem );
  8965. } ) );
  8966. },
  8967. slice: function() {
  8968. return this.pushStack( slice.apply( this, arguments ) );
  8969. },
  8970. first: function() {
  8971. return this.eq( 0 );
  8972. },
  8973. last: function() {
  8974. return this.eq( -1 );
  8975. },
  8976. eq: function( i ) {
  8977. var len = this.length,
  8978. j = +i + ( i < 0 ? len : 0 );
  8979. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8980. },
  8981. end: function() {
  8982. return this.prevObject || this.constructor();
  8983. },
  8984. // For internal use only.
  8985. // Behaves like an Array's method, not like a jQuery method.
  8986. push: push,
  8987. sort: arr.sort,
  8988. splice: arr.splice
  8989. };
  8990. jQuery.extend = jQuery.fn.extend = function() {
  8991. var options, name, src, copy, copyIsArray, clone,
  8992. target = arguments[ 0 ] || {},
  8993. i = 1,
  8994. length = arguments.length,
  8995. deep = false;
  8996. // Handle a deep copy situation
  8997. if ( typeof target === "boolean" ) {
  8998. deep = target;
  8999. // Skip the boolean and the target
  9000. target = arguments[ i ] || {};
  9001. i++;
  9002. }
  9003. // Handle case when target is a string or something (possible in deep copy)
  9004. if ( typeof target !== "object" && !isFunction( target ) ) {
  9005. target = {};
  9006. }
  9007. // Extend jQuery itself if only one argument is passed
  9008. if ( i === length ) {
  9009. target = this;
  9010. i--;
  9011. }
  9012. for ( ; i < length; i++ ) {
  9013. // Only deal with non-null/undefined values
  9014. if ( ( options = arguments[ i ] ) != null ) {
  9015. // Extend the base object
  9016. for ( name in options ) {
  9017. copy = options[ name ];
  9018. // Prevent Object.prototype pollution
  9019. // Prevent never-ending loop
  9020. if ( name === "__proto__" || target === copy ) {
  9021. continue;
  9022. }
  9023. // Recurse if we're merging plain objects or arrays
  9024. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9025. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9026. src = target[ name ];
  9027. // Ensure proper type for the source value
  9028. if ( copyIsArray && !Array.isArray( src ) ) {
  9029. clone = [];
  9030. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9031. clone = {};
  9032. } else {
  9033. clone = src;
  9034. }
  9035. copyIsArray = false;
  9036. // Never move original objects, clone them
  9037. target[ name ] = jQuery.extend( deep, clone, copy );
  9038. // Don't bring in undefined values
  9039. } else if ( copy !== undefined ) {
  9040. target[ name ] = copy;
  9041. }
  9042. }
  9043. }
  9044. }
  9045. // Return the modified object
  9046. return target;
  9047. };
  9048. jQuery.extend( {
  9049. // Unique for each copy of jQuery on the page
  9050. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9051. // Assume jQuery is ready without the ready module
  9052. isReady: true,
  9053. error: function( msg ) {
  9054. throw new Error( msg );
  9055. },
  9056. noop: function() {},
  9057. isPlainObject: function( obj ) {
  9058. var proto, Ctor;
  9059. // Detect obvious negatives
  9060. // Use toString instead of jQuery.type to catch host objects
  9061. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9062. return false;
  9063. }
  9064. proto = getProto( obj );
  9065. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9066. if ( !proto ) {
  9067. return true;
  9068. }
  9069. // Objects with prototype are plain iff they were constructed by a global Object function
  9070. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9071. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9072. },
  9073. isEmptyObject: function( obj ) {
  9074. var name;
  9075. for ( name in obj ) {
  9076. return false;
  9077. }
  9078. return true;
  9079. },
  9080. // Evaluates a script in a global context
  9081. globalEval: function( code, options ) {
  9082. DOMEval( code, { nonce: options && options.nonce } );
  9083. },
  9084. each: function( obj, callback ) {
  9085. var length, i = 0;
  9086. if ( isArrayLike( obj ) ) {
  9087. length = obj.length;
  9088. for ( ; i < length; i++ ) {
  9089. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9090. break;
  9091. }
  9092. }
  9093. } else {
  9094. for ( i in obj ) {
  9095. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9096. break;
  9097. }
  9098. }
  9099. }
  9100. return obj;
  9101. },
  9102. // Support: Android <=4.0 only
  9103. trim: function( text ) {
  9104. return text == null ?
  9105. "" :
  9106. ( text + "" ).replace( rtrim, "" );
  9107. },
  9108. // results is for internal usage only
  9109. makeArray: function( arr, results ) {
  9110. var ret = results || [];
  9111. if ( arr != null ) {
  9112. if ( isArrayLike( Object( arr ) ) ) {
  9113. jQuery.merge( ret,
  9114. typeof arr === "string" ?
  9115. [ arr ] : arr
  9116. );
  9117. } else {
  9118. push.call( ret, arr );
  9119. }
  9120. }
  9121. return ret;
  9122. },
  9123. inArray: function( elem, arr, i ) {
  9124. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9125. },
  9126. // Support: Android <=4.0 only, PhantomJS 1 only
  9127. // push.apply(_, arraylike) throws on ancient WebKit
  9128. merge: function( first, second ) {
  9129. var len = +second.length,
  9130. j = 0,
  9131. i = first.length;
  9132. for ( ; j < len; j++ ) {
  9133. first[ i++ ] = second[ j ];
  9134. }
  9135. first.length = i;
  9136. return first;
  9137. },
  9138. grep: function( elems, callback, invert ) {
  9139. var callbackInverse,
  9140. matches = [],
  9141. i = 0,
  9142. length = elems.length,
  9143. callbackExpect = !invert;
  9144. // Go through the array, only saving the items
  9145. // that pass the validator function
  9146. for ( ; i < length; i++ ) {
  9147. callbackInverse = !callback( elems[ i ], i );
  9148. if ( callbackInverse !== callbackExpect ) {
  9149. matches.push( elems[ i ] );
  9150. }
  9151. }
  9152. return matches;
  9153. },
  9154. // arg is for internal usage only
  9155. map: function( elems, callback, arg ) {
  9156. var length, value,
  9157. i = 0,
  9158. ret = [];
  9159. // Go through the array, translating each of the items to their new values
  9160. if ( isArrayLike( elems ) ) {
  9161. length = elems.length;
  9162. for ( ; i < length; i++ ) {
  9163. value = callback( elems[ i ], i, arg );
  9164. if ( value != null ) {
  9165. ret.push( value );
  9166. }
  9167. }
  9168. // Go through every key on the object,
  9169. } else {
  9170. for ( i in elems ) {
  9171. value = callback( elems[ i ], i, arg );
  9172. if ( value != null ) {
  9173. ret.push( value );
  9174. }
  9175. }
  9176. }
  9177. // Flatten any nested arrays
  9178. return concat.apply( [], ret );
  9179. },
  9180. // A global GUID counter for objects
  9181. guid: 1,
  9182. // jQuery.support is not used in Core but other projects attach their
  9183. // properties to it so it needs to exist.
  9184. support: support
  9185. } );
  9186. if ( typeof Symbol === "function" ) {
  9187. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9188. }
  9189. // Populate the class2type map
  9190. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9191. function( i, name ) {
  9192. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9193. } );
  9194. function isArrayLike( obj ) {
  9195. // Support: real iOS 8.2 only (not reproducible in simulator)
  9196. // `in` check used to prevent JIT error (gh-2145)
  9197. // hasOwn isn't used here due to false negatives
  9198. // regarding Nodelist length in IE
  9199. var length = !!obj && "length" in obj && obj.length,
  9200. type = toType( obj );
  9201. if ( isFunction( obj ) || isWindow( obj ) ) {
  9202. return false;
  9203. }
  9204. return type === "array" || length === 0 ||
  9205. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9206. }
  9207. var Sizzle =
  9208. /*!
  9209. * Sizzle CSS Selector Engine v2.3.4
  9210. * https://sizzlejs.com/
  9211. *
  9212. * Copyright JS Foundation and other contributors
  9213. * Released under the MIT license
  9214. * https://js.foundation/
  9215. *
  9216. * Date: 2019-04-08
  9217. */
  9218. (function( window ) {
  9219. var i,
  9220. support,
  9221. Expr,
  9222. getText,
  9223. isXML,
  9224. tokenize,
  9225. compile,
  9226. select,
  9227. outermostContext,
  9228. sortInput,
  9229. hasDuplicate,
  9230. // Local document vars
  9231. setDocument,
  9232. document,
  9233. docElem,
  9234. documentIsHTML,
  9235. rbuggyQSA,
  9236. rbuggyMatches,
  9237. matches,
  9238. contains,
  9239. // Instance-specific data
  9240. expando = "sizzle" + 1 * new Date(),
  9241. preferredDoc = window.document,
  9242. dirruns = 0,
  9243. done = 0,
  9244. classCache = createCache(),
  9245. tokenCache = createCache(),
  9246. compilerCache = createCache(),
  9247. nonnativeSelectorCache = createCache(),
  9248. sortOrder = function( a, b ) {
  9249. if ( a === b ) {
  9250. hasDuplicate = true;
  9251. }
  9252. return 0;
  9253. },
  9254. // Instance methods
  9255. hasOwn = ({}).hasOwnProperty,
  9256. arr = [],
  9257. pop = arr.pop,
  9258. push_native = arr.push,
  9259. push = arr.push,
  9260. slice = arr.slice,
  9261. // Use a stripped-down indexOf as it's faster than native
  9262. // https://jsperf.com/thor-indexof-vs-for/5
  9263. indexOf = function( list, elem ) {
  9264. var i = 0,
  9265. len = list.length;
  9266. for ( ; i < len; i++ ) {
  9267. if ( list[i] === elem ) {
  9268. return i;
  9269. }
  9270. }
  9271. return -1;
  9272. },
  9273. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9274. // Regular expressions
  9275. // http://www.w3.org/TR/css3-selectors/#whitespace
  9276. whitespace = "[\\x20\\t\\r\\n\\f]",
  9277. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9278. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9279. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9280. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9281. // Operator (capture 2)
  9282. "*([*^$|!~]?=)" + whitespace +
  9283. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9284. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9285. "*\\]",
  9286. pseudos = ":(" + identifier + ")(?:\\((" +
  9287. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9288. // 1. quoted (capture 3; capture 4 or capture 5)
  9289. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9290. // 2. simple (capture 6)
  9291. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9292. // 3. anything else (capture 2)
  9293. ".*" +
  9294. ")\\)|)",
  9295. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9296. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9297. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9298. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9299. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9300. rdescend = new RegExp( whitespace + "|>" ),
  9301. rpseudo = new RegExp( pseudos ),
  9302. ridentifier = new RegExp( "^" + identifier + "$" ),
  9303. matchExpr = {
  9304. "ID": new RegExp( "^#(" + identifier + ")" ),
  9305. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9306. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9307. "ATTR": new RegExp( "^" + attributes ),
  9308. "PSEUDO": new RegExp( "^" + pseudos ),
  9309. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9310. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9311. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9312. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9313. // For use in libraries implementing .is()
  9314. // We use this for POS matching in `select`
  9315. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9316. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9317. },
  9318. rhtml = /HTML$/i,
  9319. rinputs = /^(?:input|select|textarea|button)$/i,
  9320. rheader = /^h\d$/i,
  9321. rnative = /^[^{]+\{\s*\[native \w/,
  9322. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9323. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9324. rsibling = /[+~]/,
  9325. // CSS escapes
  9326. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9327. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9328. funescape = function( _, escaped, escapedWhitespace ) {
  9329. var high = "0x" + escaped - 0x10000;
  9330. // NaN means non-codepoint
  9331. // Support: Firefox<24
  9332. // Workaround erroneous numeric interpretation of +"0x"
  9333. return high !== high || escapedWhitespace ?
  9334. escaped :
  9335. high < 0 ?
  9336. // BMP codepoint
  9337. String.fromCharCode( high + 0x10000 ) :
  9338. // Supplemental Plane codepoint (surrogate pair)
  9339. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9340. },
  9341. // CSS string/identifier serialization
  9342. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9343. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9344. fcssescape = function( ch, asCodePoint ) {
  9345. if ( asCodePoint ) {
  9346. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9347. if ( ch === "\0" ) {
  9348. return "\uFFFD";
  9349. }
  9350. // Control characters and (dependent upon position) numbers get escaped as code points
  9351. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9352. }
  9353. // Other potentially-special ASCII characters get backslash-escaped
  9354. return "\\" + ch;
  9355. },
  9356. // Used for iframes
  9357. // See setDocument()
  9358. // Removing the function wrapper causes a "Permission Denied"
  9359. // error in IE
  9360. unloadHandler = function() {
  9361. setDocument();
  9362. },
  9363. inDisabledFieldset = addCombinator(
  9364. function( elem ) {
  9365. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9366. },
  9367. { dir: "parentNode", next: "legend" }
  9368. );
  9369. // Optimize for push.apply( _, NodeList )
  9370. try {
  9371. push.apply(
  9372. (arr = slice.call( preferredDoc.childNodes )),
  9373. preferredDoc.childNodes
  9374. );
  9375. // Support: Android<4.0
  9376. // Detect silently failing push.apply
  9377. arr[ preferredDoc.childNodes.length ].nodeType;
  9378. } catch ( e ) {
  9379. push = { apply: arr.length ?
  9380. // Leverage slice if possible
  9381. function( target, els ) {
  9382. push_native.apply( target, slice.call(els) );
  9383. } :
  9384. // Support: IE<9
  9385. // Otherwise append directly
  9386. function( target, els ) {
  9387. var j = target.length,
  9388. i = 0;
  9389. // Can't trust NodeList.length
  9390. while ( (target[j++] = els[i++]) ) {}
  9391. target.length = j - 1;
  9392. }
  9393. };
  9394. }
  9395. function Sizzle( selector, context, results, seed ) {
  9396. var m, i, elem, nid, match, groups, newSelector,
  9397. newContext = context && context.ownerDocument,
  9398. // nodeType defaults to 9, since context defaults to document
  9399. nodeType = context ? context.nodeType : 9;
  9400. results = results || [];
  9401. // Return early from calls with invalid selector or context
  9402. if ( typeof selector !== "string" || !selector ||
  9403. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9404. return results;
  9405. }
  9406. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9407. if ( !seed ) {
  9408. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9409. setDocument( context );
  9410. }
  9411. context = context || document;
  9412. if ( documentIsHTML ) {
  9413. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9414. // (excepting DocumentFragment context, where the methods don't exist)
  9415. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9416. // ID selector
  9417. if ( (m = match[1]) ) {
  9418. // Document context
  9419. if ( nodeType === 9 ) {
  9420. if ( (elem = context.getElementById( m )) ) {
  9421. // Support: IE, Opera, Webkit
  9422. // TODO: identify versions
  9423. // getElementById can match elements by name instead of ID
  9424. if ( elem.id === m ) {
  9425. results.push( elem );
  9426. return results;
  9427. }
  9428. } else {
  9429. return results;
  9430. }
  9431. // Element context
  9432. } else {
  9433. // Support: IE, Opera, Webkit
  9434. // TODO: identify versions
  9435. // getElementById can match elements by name instead of ID
  9436. if ( newContext && (elem = newContext.getElementById( m )) &&
  9437. contains( context, elem ) &&
  9438. elem.id === m ) {
  9439. results.push( elem );
  9440. return results;
  9441. }
  9442. }
  9443. // Type selector
  9444. } else if ( match[2] ) {
  9445. push.apply( results, context.getElementsByTagName( selector ) );
  9446. return results;
  9447. // Class selector
  9448. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9449. context.getElementsByClassName ) {
  9450. push.apply( results, context.getElementsByClassName( m ) );
  9451. return results;
  9452. }
  9453. }
  9454. // Take advantage of querySelectorAll
  9455. if ( support.qsa &&
  9456. !nonnativeSelectorCache[ selector + " " ] &&
  9457. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9458. // Support: IE 8 only
  9459. // Exclude object elements
  9460. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9461. newSelector = selector;
  9462. newContext = context;
  9463. // qSA considers elements outside a scoping root when evaluating child or
  9464. // descendant combinators, which is not what we want.
  9465. // In such cases, we work around the behavior by prefixing every selector in the
  9466. // list with an ID selector referencing the scope context.
  9467. // Thanks to Andrew Dupont for this technique.
  9468. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9469. // Capture the context ID, setting it first if necessary
  9470. if ( (nid = context.getAttribute( "id" )) ) {
  9471. nid = nid.replace( rcssescape, fcssescape );
  9472. } else {
  9473. context.setAttribute( "id", (nid = expando) );
  9474. }
  9475. // Prefix every selector in the list
  9476. groups = tokenize( selector );
  9477. i = groups.length;
  9478. while ( i-- ) {
  9479. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9480. }
  9481. newSelector = groups.join( "," );
  9482. // Expand context for sibling selectors
  9483. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9484. context;
  9485. }
  9486. try {
  9487. push.apply( results,
  9488. newContext.querySelectorAll( newSelector )
  9489. );
  9490. return results;
  9491. } catch ( qsaError ) {
  9492. nonnativeSelectorCache( selector, true );
  9493. } finally {
  9494. if ( nid === expando ) {
  9495. context.removeAttribute( "id" );
  9496. }
  9497. }
  9498. }
  9499. }
  9500. }
  9501. // All others
  9502. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9503. }
  9504. /**
  9505. * Create key-value caches of limited size
  9506. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9507. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9508. * deleting the oldest entry
  9509. */
  9510. function createCache() {
  9511. var keys = [];
  9512. function cache( key, value ) {
  9513. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9514. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9515. // Only keep the most recent entries
  9516. delete cache[ keys.shift() ];
  9517. }
  9518. return (cache[ key + " " ] = value);
  9519. }
  9520. return cache;
  9521. }
  9522. /**
  9523. * Mark a function for special use by Sizzle
  9524. * @param {Function} fn The function to mark
  9525. */
  9526. function markFunction( fn ) {
  9527. fn[ expando ] = true;
  9528. return fn;
  9529. }
  9530. /**
  9531. * Support testing using an element
  9532. * @param {Function} fn Passed the created element and returns a boolean result
  9533. */
  9534. function assert( fn ) {
  9535. var el = document.createElement("fieldset");
  9536. try {
  9537. return !!fn( el );
  9538. } catch (e) {
  9539. return false;
  9540. } finally {
  9541. // Remove from its parent by default
  9542. if ( el.parentNode ) {
  9543. el.parentNode.removeChild( el );
  9544. }
  9545. // release memory in IE
  9546. el = null;
  9547. }
  9548. }
  9549. /**
  9550. * Adds the same handler for all of the specified attrs
  9551. * @param {String} attrs Pipe-separated list of attributes
  9552. * @param {Function} handler The method that will be applied
  9553. */
  9554. function addHandle( attrs, handler ) {
  9555. var arr = attrs.split("|"),
  9556. i = arr.length;
  9557. while ( i-- ) {
  9558. Expr.attrHandle[ arr[i] ] = handler;
  9559. }
  9560. }
  9561. /**
  9562. * Checks document order of two siblings
  9563. * @param {Element} a
  9564. * @param {Element} b
  9565. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9566. */
  9567. function siblingCheck( a, b ) {
  9568. var cur = b && a,
  9569. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9570. a.sourceIndex - b.sourceIndex;
  9571. // Use IE sourceIndex if available on both nodes
  9572. if ( diff ) {
  9573. return diff;
  9574. }
  9575. // Check if b follows a
  9576. if ( cur ) {
  9577. while ( (cur = cur.nextSibling) ) {
  9578. if ( cur === b ) {
  9579. return -1;
  9580. }
  9581. }
  9582. }
  9583. return a ? 1 : -1;
  9584. }
  9585. /**
  9586. * Returns a function to use in pseudos for input types
  9587. * @param {String} type
  9588. */
  9589. function createInputPseudo( type ) {
  9590. return function( elem ) {
  9591. var name = elem.nodeName.toLowerCase();
  9592. return name === "input" && elem.type === type;
  9593. };
  9594. }
  9595. /**
  9596. * Returns a function to use in pseudos for buttons
  9597. * @param {String} type
  9598. */
  9599. function createButtonPseudo( type ) {
  9600. return function( elem ) {
  9601. var name = elem.nodeName.toLowerCase();
  9602. return (name === "input" || name === "button") && elem.type === type;
  9603. };
  9604. }
  9605. /**
  9606. * Returns a function to use in pseudos for :enabled/:disabled
  9607. * @param {Boolean} disabled true for :disabled; false for :enabled
  9608. */
  9609. function createDisabledPseudo( disabled ) {
  9610. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9611. return function( elem ) {
  9612. // Only certain elements can match :enabled or :disabled
  9613. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9614. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9615. if ( "form" in elem ) {
  9616. // Check for inherited disabledness on relevant non-disabled elements:
  9617. // * listed form-associated elements in a disabled fieldset
  9618. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9619. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9620. // * option elements in a disabled optgroup
  9621. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9622. // All such elements have a "form" property.
  9623. if ( elem.parentNode && elem.disabled === false ) {
  9624. // Option elements defer to a parent optgroup if present
  9625. if ( "label" in elem ) {
  9626. if ( "label" in elem.parentNode ) {
  9627. return elem.parentNode.disabled === disabled;
  9628. } else {
  9629. return elem.disabled === disabled;
  9630. }
  9631. }
  9632. // Support: IE 6 - 11
  9633. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9634. return elem.isDisabled === disabled ||
  9635. // Where there is no isDisabled, check manually
  9636. /* jshint -W018 */
  9637. elem.isDisabled !== !disabled &&
  9638. inDisabledFieldset( elem ) === disabled;
  9639. }
  9640. return elem.disabled === disabled;
  9641. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9642. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9643. // even exist on them, let alone have a boolean value.
  9644. } else if ( "label" in elem ) {
  9645. return elem.disabled === disabled;
  9646. }
  9647. // Remaining elements are neither :enabled nor :disabled
  9648. return false;
  9649. };
  9650. }
  9651. /**
  9652. * Returns a function to use in pseudos for positionals
  9653. * @param {Function} fn
  9654. */
  9655. function createPositionalPseudo( fn ) {
  9656. return markFunction(function( argument ) {
  9657. argument = +argument;
  9658. return markFunction(function( seed, matches ) {
  9659. var j,
  9660. matchIndexes = fn( [], seed.length, argument ),
  9661. i = matchIndexes.length;
  9662. // Match elements found at the specified indexes
  9663. while ( i-- ) {
  9664. if ( seed[ (j = matchIndexes[i]) ] ) {
  9665. seed[j] = !(matches[j] = seed[j]);
  9666. }
  9667. }
  9668. });
  9669. });
  9670. }
  9671. /**
  9672. * Checks a node for validity as a Sizzle context
  9673. * @param {Element|Object=} context
  9674. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9675. */
  9676. function testContext( context ) {
  9677. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9678. }
  9679. // Expose support vars for convenience
  9680. support = Sizzle.support = {};
  9681. /**
  9682. * Detects XML nodes
  9683. * @param {Element|Object} elem An element or a document
  9684. * @returns {Boolean} True iff elem is a non-HTML XML node
  9685. */
  9686. isXML = Sizzle.isXML = function( elem ) {
  9687. var namespace = elem.namespaceURI,
  9688. docElem = (elem.ownerDocument || elem).documentElement;
  9689. // Support: IE <=8
  9690. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9691. // https://bugs.jquery.com/ticket/4833
  9692. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9693. };
  9694. /**
  9695. * Sets document-related variables once based on the current document
  9696. * @param {Element|Object} [doc] An element or document object to use to set the document
  9697. * @returns {Object} Returns the current document
  9698. */
  9699. setDocument = Sizzle.setDocument = function( node ) {
  9700. var hasCompare, subWindow,
  9701. doc = node ? node.ownerDocument || node : preferredDoc;
  9702. // Return early if doc is invalid or already selected
  9703. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9704. return document;
  9705. }
  9706. // Update global variables
  9707. document = doc;
  9708. docElem = document.documentElement;
  9709. documentIsHTML = !isXML( document );
  9710. // Support: IE 9-11, Edge
  9711. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9712. if ( preferredDoc !== document &&
  9713. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9714. // Support: IE 11, Edge
  9715. if ( subWindow.addEventListener ) {
  9716. subWindow.addEventListener( "unload", unloadHandler, false );
  9717. // Support: IE 9 - 10 only
  9718. } else if ( subWindow.attachEvent ) {
  9719. subWindow.attachEvent( "onunload", unloadHandler );
  9720. }
  9721. }
  9722. /* Attributes
  9723. ---------------------------------------------------------------------- */
  9724. // Support: IE<8
  9725. // Verify that getAttribute really returns attributes and not properties
  9726. // (excepting IE8 booleans)
  9727. support.attributes = assert(function( el ) {
  9728. el.className = "i";
  9729. return !el.getAttribute("className");
  9730. });
  9731. /* getElement(s)By*
  9732. ---------------------------------------------------------------------- */
  9733. // Check if getElementsByTagName("*") returns only elements
  9734. support.getElementsByTagName = assert(function( el ) {
  9735. el.appendChild( document.createComment("") );
  9736. return !el.getElementsByTagName("*").length;
  9737. });
  9738. // Support: IE<9
  9739. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9740. // Support: IE<10
  9741. // Check if getElementById returns elements by name
  9742. // The broken getElementById methods don't pick up programmatically-set names,
  9743. // so use a roundabout getElementsByName test
  9744. support.getById = assert(function( el ) {
  9745. docElem.appendChild( el ).id = expando;
  9746. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9747. });
  9748. // ID filter and find
  9749. if ( support.getById ) {
  9750. Expr.filter["ID"] = function( id ) {
  9751. var attrId = id.replace( runescape, funescape );
  9752. return function( elem ) {
  9753. return elem.getAttribute("id") === attrId;
  9754. };
  9755. };
  9756. Expr.find["ID"] = function( id, context ) {
  9757. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9758. var elem = context.getElementById( id );
  9759. return elem ? [ elem ] : [];
  9760. }
  9761. };
  9762. } else {
  9763. Expr.filter["ID"] = function( id ) {
  9764. var attrId = id.replace( runescape, funescape );
  9765. return function( elem ) {
  9766. var node = typeof elem.getAttributeNode !== "undefined" &&
  9767. elem.getAttributeNode("id");
  9768. return node && node.value === attrId;
  9769. };
  9770. };
  9771. // Support: IE 6 - 7 only
  9772. // getElementById is not reliable as a find shortcut
  9773. Expr.find["ID"] = function( id, context ) {
  9774. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9775. var node, i, elems,
  9776. elem = context.getElementById( id );
  9777. if ( elem ) {
  9778. // Verify the id attribute
  9779. node = elem.getAttributeNode("id");
  9780. if ( node && node.value === id ) {
  9781. return [ elem ];
  9782. }
  9783. // Fall back on getElementsByName
  9784. elems = context.getElementsByName( id );
  9785. i = 0;
  9786. while ( (elem = elems[i++]) ) {
  9787. node = elem.getAttributeNode("id");
  9788. if ( node && node.value === id ) {
  9789. return [ elem ];
  9790. }
  9791. }
  9792. }
  9793. return [];
  9794. }
  9795. };
  9796. }
  9797. // Tag
  9798. Expr.find["TAG"] = support.getElementsByTagName ?
  9799. function( tag, context ) {
  9800. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9801. return context.getElementsByTagName( tag );
  9802. // DocumentFragment nodes don't have gEBTN
  9803. } else if ( support.qsa ) {
  9804. return context.querySelectorAll( tag );
  9805. }
  9806. } :
  9807. function( tag, context ) {
  9808. var elem,
  9809. tmp = [],
  9810. i = 0,
  9811. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9812. results = context.getElementsByTagName( tag );
  9813. // Filter out possible comments
  9814. if ( tag === "*" ) {
  9815. while ( (elem = results[i++]) ) {
  9816. if ( elem.nodeType === 1 ) {
  9817. tmp.push( elem );
  9818. }
  9819. }
  9820. return tmp;
  9821. }
  9822. return results;
  9823. };
  9824. // Class
  9825. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9826. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9827. return context.getElementsByClassName( className );
  9828. }
  9829. };
  9830. /* QSA/matchesSelector
  9831. ---------------------------------------------------------------------- */
  9832. // QSA and matchesSelector support
  9833. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9834. rbuggyMatches = [];
  9835. // qSa(:focus) reports false when true (Chrome 21)
  9836. // We allow this because of a bug in IE8/9 that throws an error
  9837. // whenever `document.activeElement` is accessed on an iframe
  9838. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9839. // See https://bugs.jquery.com/ticket/13378
  9840. rbuggyQSA = [];
  9841. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9842. // Build QSA regex
  9843. // Regex strategy adopted from Diego Perini
  9844. assert(function( el ) {
  9845. // Select is set to empty string on purpose
  9846. // This is to test IE's treatment of not explicitly
  9847. // setting a boolean content attribute,
  9848. // since its presence should be enough
  9849. // https://bugs.jquery.com/ticket/12359
  9850. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9851. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9852. "<option selected=''></option></select>";
  9853. // Support: IE8, Opera 11-12.16
  9854. // Nothing should be selected when empty strings follow ^= or $= or *=
  9855. // The test attribute must be unknown in Opera but "safe" for WinRT
  9856. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9857. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9858. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9859. }
  9860. // Support: IE8
  9861. // Boolean attributes and "value" are not treated correctly
  9862. if ( !el.querySelectorAll("[selected]").length ) {
  9863. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9864. }
  9865. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9866. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9867. rbuggyQSA.push("~=");
  9868. }
  9869. // Webkit/Opera - :checked should return selected option elements
  9870. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9871. // IE8 throws error here and will not see later tests
  9872. if ( !el.querySelectorAll(":checked").length ) {
  9873. rbuggyQSA.push(":checked");
  9874. }
  9875. // Support: Safari 8+, iOS 8+
  9876. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9877. // In-page `selector#id sibling-combinator selector` fails
  9878. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9879. rbuggyQSA.push(".#.+[+~]");
  9880. }
  9881. });
  9882. assert(function( el ) {
  9883. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9884. "<select disabled='disabled'><option/></select>";
  9885. // Support: Windows 8 Native Apps
  9886. // The type and name attributes are restricted during .innerHTML assignment
  9887. var input = document.createElement("input");
  9888. input.setAttribute( "type", "hidden" );
  9889. el.appendChild( input ).setAttribute( "name", "D" );
  9890. // Support: IE8
  9891. // Enforce case-sensitivity of name attribute
  9892. if ( el.querySelectorAll("[name=d]").length ) {
  9893. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9894. }
  9895. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9896. // IE8 throws error here and will not see later tests
  9897. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9898. rbuggyQSA.push( ":enabled", ":disabled" );
  9899. }
  9900. // Support: IE9-11+
  9901. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9902. docElem.appendChild( el ).disabled = true;
  9903. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9904. rbuggyQSA.push( ":enabled", ":disabled" );
  9905. }
  9906. // Opera 10-11 does not throw on post-comma invalid pseudos
  9907. el.querySelectorAll("*,:x");
  9908. rbuggyQSA.push(",.*:");
  9909. });
  9910. }
  9911. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9912. docElem.webkitMatchesSelector ||
  9913. docElem.mozMatchesSelector ||
  9914. docElem.oMatchesSelector ||
  9915. docElem.msMatchesSelector) )) ) {
  9916. assert(function( el ) {
  9917. // Check to see if it's possible to do matchesSelector
  9918. // on a disconnected node (IE 9)
  9919. support.disconnectedMatch = matches.call( el, "*" );
  9920. // This should fail with an exception
  9921. // Gecko does not error, returns false instead
  9922. matches.call( el, "[s!='']:x" );
  9923. rbuggyMatches.push( "!=", pseudos );
  9924. });
  9925. }
  9926. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9927. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9928. /* Contains
  9929. ---------------------------------------------------------------------- */
  9930. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9931. // Element contains another
  9932. // Purposefully self-exclusive
  9933. // As in, an element does not contain itself
  9934. contains = hasCompare || rnative.test( docElem.contains ) ?
  9935. function( a, b ) {
  9936. var adown = a.nodeType === 9 ? a.documentElement : a,
  9937. bup = b && b.parentNode;
  9938. return a === bup || !!( bup && bup.nodeType === 1 && (
  9939. adown.contains ?
  9940. adown.contains( bup ) :
  9941. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9942. ));
  9943. } :
  9944. function( a, b ) {
  9945. if ( b ) {
  9946. while ( (b = b.parentNode) ) {
  9947. if ( b === a ) {
  9948. return true;
  9949. }
  9950. }
  9951. }
  9952. return false;
  9953. };
  9954. /* Sorting
  9955. ---------------------------------------------------------------------- */
  9956. // Document order sorting
  9957. sortOrder = hasCompare ?
  9958. function( a, b ) {
  9959. // Flag for duplicate removal
  9960. if ( a === b ) {
  9961. hasDuplicate = true;
  9962. return 0;
  9963. }
  9964. // Sort on method existence if only one input has compareDocumentPosition
  9965. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9966. if ( compare ) {
  9967. return compare;
  9968. }
  9969. // Calculate position if both inputs belong to the same document
  9970. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9971. a.compareDocumentPosition( b ) :
  9972. // Otherwise we know they are disconnected
  9973. 1;
  9974. // Disconnected nodes
  9975. if ( compare & 1 ||
  9976. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9977. // Choose the first element that is related to our preferred document
  9978. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9979. return -1;
  9980. }
  9981. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9982. return 1;
  9983. }
  9984. // Maintain original order
  9985. return sortInput ?
  9986. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9987. 0;
  9988. }
  9989. return compare & 4 ? -1 : 1;
  9990. } :
  9991. function( a, b ) {
  9992. // Exit early if the nodes are identical
  9993. if ( a === b ) {
  9994. hasDuplicate = true;
  9995. return 0;
  9996. }
  9997. var cur,
  9998. i = 0,
  9999. aup = a.parentNode,
  10000. bup = b.parentNode,
  10001. ap = [ a ],
  10002. bp = [ b ];
  10003. // Parentless nodes are either documents or disconnected
  10004. if ( !aup || !bup ) {
  10005. return a === document ? -1 :
  10006. b === document ? 1 :
  10007. aup ? -1 :
  10008. bup ? 1 :
  10009. sortInput ?
  10010. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10011. 0;
  10012. // If the nodes are siblings, we can do a quick check
  10013. } else if ( aup === bup ) {
  10014. return siblingCheck( a, b );
  10015. }
  10016. // Otherwise we need full lists of their ancestors for comparison
  10017. cur = a;
  10018. while ( (cur = cur.parentNode) ) {
  10019. ap.unshift( cur );
  10020. }
  10021. cur = b;
  10022. while ( (cur = cur.parentNode) ) {
  10023. bp.unshift( cur );
  10024. }
  10025. // Walk down the tree looking for a discrepancy
  10026. while ( ap[i] === bp[i] ) {
  10027. i++;
  10028. }
  10029. return i ?
  10030. // Do a sibling check if the nodes have a common ancestor
  10031. siblingCheck( ap[i], bp[i] ) :
  10032. // Otherwise nodes in our document sort first
  10033. ap[i] === preferredDoc ? -1 :
  10034. bp[i] === preferredDoc ? 1 :
  10035. 0;
  10036. };
  10037. return document;
  10038. };
  10039. Sizzle.matches = function( expr, elements ) {
  10040. return Sizzle( expr, null, null, elements );
  10041. };
  10042. Sizzle.matchesSelector = function( elem, expr ) {
  10043. // Set document vars if needed
  10044. if ( ( elem.ownerDocument || elem ) !== document ) {
  10045. setDocument( elem );
  10046. }
  10047. if ( support.matchesSelector && documentIsHTML &&
  10048. !nonnativeSelectorCache[ expr + " " ] &&
  10049. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10050. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10051. try {
  10052. var ret = matches.call( elem, expr );
  10053. // IE 9's matchesSelector returns false on disconnected nodes
  10054. if ( ret || support.disconnectedMatch ||
  10055. // As well, disconnected nodes are said to be in a document
  10056. // fragment in IE 9
  10057. elem.document && elem.document.nodeType !== 11 ) {
  10058. return ret;
  10059. }
  10060. } catch (e) {
  10061. nonnativeSelectorCache( expr, true );
  10062. }
  10063. }
  10064. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10065. };
  10066. Sizzle.contains = function( context, elem ) {
  10067. // Set document vars if needed
  10068. if ( ( context.ownerDocument || context ) !== document ) {
  10069. setDocument( context );
  10070. }
  10071. return contains( context, elem );
  10072. };
  10073. Sizzle.attr = function( elem, name ) {
  10074. // Set document vars if needed
  10075. if ( ( elem.ownerDocument || elem ) !== document ) {
  10076. setDocument( elem );
  10077. }
  10078. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10079. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10080. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10081. fn( elem, name, !documentIsHTML ) :
  10082. undefined;
  10083. return val !== undefined ?
  10084. val :
  10085. support.attributes || !documentIsHTML ?
  10086. elem.getAttribute( name ) :
  10087. (val = elem.getAttributeNode(name)) && val.specified ?
  10088. val.value :
  10089. null;
  10090. };
  10091. Sizzle.escape = function( sel ) {
  10092. return (sel + "").replace( rcssescape, fcssescape );
  10093. };
  10094. Sizzle.error = function( msg ) {
  10095. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10096. };
  10097. /**
  10098. * Document sorting and removing duplicates
  10099. * @param {ArrayLike} results
  10100. */
  10101. Sizzle.uniqueSort = function( results ) {
  10102. var elem,
  10103. duplicates = [],
  10104. j = 0,
  10105. i = 0;
  10106. // Unless we *know* we can detect duplicates, assume their presence
  10107. hasDuplicate = !support.detectDuplicates;
  10108. sortInput = !support.sortStable && results.slice( 0 );
  10109. results.sort( sortOrder );
  10110. if ( hasDuplicate ) {
  10111. while ( (elem = results[i++]) ) {
  10112. if ( elem === results[ i ] ) {
  10113. j = duplicates.push( i );
  10114. }
  10115. }
  10116. while ( j-- ) {
  10117. results.splice( duplicates[ j ], 1 );
  10118. }
  10119. }
  10120. // Clear input after sorting to release objects
  10121. // See https://github.com/jquery/sizzle/pull/225
  10122. sortInput = null;
  10123. return results;
  10124. };
  10125. /**
  10126. * Utility function for retrieving the text value of an array of DOM nodes
  10127. * @param {Array|Element} elem
  10128. */
  10129. getText = Sizzle.getText = function( elem ) {
  10130. var node,
  10131. ret = "",
  10132. i = 0,
  10133. nodeType = elem.nodeType;
  10134. if ( !nodeType ) {
  10135. // If no nodeType, this is expected to be an array
  10136. while ( (node = elem[i++]) ) {
  10137. // Do not traverse comment nodes
  10138. ret += getText( node );
  10139. }
  10140. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10141. // Use textContent for elements
  10142. // innerText usage removed for consistency of new lines (jQuery #11153)
  10143. if ( typeof elem.textContent === "string" ) {
  10144. return elem.textContent;
  10145. } else {
  10146. // Traverse its children
  10147. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10148. ret += getText( elem );
  10149. }
  10150. }
  10151. } else if ( nodeType === 3 || nodeType === 4 ) {
  10152. return elem.nodeValue;
  10153. }
  10154. // Do not include comment or processing instruction nodes
  10155. return ret;
  10156. };
  10157. Expr = Sizzle.selectors = {
  10158. // Can be adjusted by the user
  10159. cacheLength: 50,
  10160. createPseudo: markFunction,
  10161. match: matchExpr,
  10162. attrHandle: {},
  10163. find: {},
  10164. relative: {
  10165. ">": { dir: "parentNode", first: true },
  10166. " ": { dir: "parentNode" },
  10167. "+": { dir: "previousSibling", first: true },
  10168. "~": { dir: "previousSibling" }
  10169. },
  10170. preFilter: {
  10171. "ATTR": function( match ) {
  10172. match[1] = match[1].replace( runescape, funescape );
  10173. // Move the given value to match[3] whether quoted or unquoted
  10174. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10175. if ( match[2] === "~=" ) {
  10176. match[3] = " " + match[3] + " ";
  10177. }
  10178. return match.slice( 0, 4 );
  10179. },
  10180. "CHILD": function( match ) {
  10181. /* matches from matchExpr["CHILD"]
  10182. 1 type (only|nth|...)
  10183. 2 what (child|of-type)
  10184. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10185. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10186. 5 sign of xn-component
  10187. 6 x of xn-component
  10188. 7 sign of y-component
  10189. 8 y of y-component
  10190. */
  10191. match[1] = match[1].toLowerCase();
  10192. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10193. // nth-* requires argument
  10194. if ( !match[3] ) {
  10195. Sizzle.error( match[0] );
  10196. }
  10197. // numeric x and y parameters for Expr.filter.CHILD
  10198. // remember that false/true cast respectively to 0/1
  10199. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10200. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10201. // other types prohibit arguments
  10202. } else if ( match[3] ) {
  10203. Sizzle.error( match[0] );
  10204. }
  10205. return match;
  10206. },
  10207. "PSEUDO": function( match ) {
  10208. var excess,
  10209. unquoted = !match[6] && match[2];
  10210. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10211. return null;
  10212. }
  10213. // Accept quoted arguments as-is
  10214. if ( match[3] ) {
  10215. match[2] = match[4] || match[5] || "";
  10216. // Strip excess characters from unquoted arguments
  10217. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10218. // Get excess from tokenize (recursively)
  10219. (excess = tokenize( unquoted, true )) &&
  10220. // advance to the next closing parenthesis
  10221. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10222. // excess is a negative index
  10223. match[0] = match[0].slice( 0, excess );
  10224. match[2] = unquoted.slice( 0, excess );
  10225. }
  10226. // Return only captures needed by the pseudo filter method (type and argument)
  10227. return match.slice( 0, 3 );
  10228. }
  10229. },
  10230. filter: {
  10231. "TAG": function( nodeNameSelector ) {
  10232. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10233. return nodeNameSelector === "*" ?
  10234. function() { return true; } :
  10235. function( elem ) {
  10236. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10237. };
  10238. },
  10239. "CLASS": function( className ) {
  10240. var pattern = classCache[ className + " " ];
  10241. return pattern ||
  10242. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10243. classCache( className, function( elem ) {
  10244. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10245. });
  10246. },
  10247. "ATTR": function( name, operator, check ) {
  10248. return function( elem ) {
  10249. var result = Sizzle.attr( elem, name );
  10250. if ( result == null ) {
  10251. return operator === "!=";
  10252. }
  10253. if ( !operator ) {
  10254. return true;
  10255. }
  10256. result += "";
  10257. return operator === "=" ? result === check :
  10258. operator === "!=" ? result !== check :
  10259. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10260. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10261. operator === "$=" ? check && result.slice( -check.length ) === check :
  10262. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10263. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10264. false;
  10265. };
  10266. },
  10267. "CHILD": function( type, what, argument, first, last ) {
  10268. var simple = type.slice( 0, 3 ) !== "nth",
  10269. forward = type.slice( -4 ) !== "last",
  10270. ofType = what === "of-type";
  10271. return first === 1 && last === 0 ?
  10272. // Shortcut for :nth-*(n)
  10273. function( elem ) {
  10274. return !!elem.parentNode;
  10275. } :
  10276. function( elem, context, xml ) {
  10277. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10278. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10279. parent = elem.parentNode,
  10280. name = ofType && elem.nodeName.toLowerCase(),
  10281. useCache = !xml && !ofType,
  10282. diff = false;
  10283. if ( parent ) {
  10284. // :(first|last|only)-(child|of-type)
  10285. if ( simple ) {
  10286. while ( dir ) {
  10287. node = elem;
  10288. while ( (node = node[ dir ]) ) {
  10289. if ( ofType ?
  10290. node.nodeName.toLowerCase() === name :
  10291. node.nodeType === 1 ) {
  10292. return false;
  10293. }
  10294. }
  10295. // Reverse direction for :only-* (if we haven't yet done so)
  10296. start = dir = type === "only" && !start && "nextSibling";
  10297. }
  10298. return true;
  10299. }
  10300. start = [ forward ? parent.firstChild : parent.lastChild ];
  10301. // non-xml :nth-child(...) stores cache data on `parent`
  10302. if ( forward && useCache ) {
  10303. // Seek `elem` from a previously-cached index
  10304. // ...in a gzip-friendly way
  10305. node = parent;
  10306. outerCache = node[ expando ] || (node[ expando ] = {});
  10307. // Support: IE <9 only
  10308. // Defend against cloned attroperties (jQuery gh-1709)
  10309. uniqueCache = outerCache[ node.uniqueID ] ||
  10310. (outerCache[ node.uniqueID ] = {});
  10311. cache = uniqueCache[ type ] || [];
  10312. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10313. diff = nodeIndex && cache[ 2 ];
  10314. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10315. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10316. // Fallback to seeking `elem` from the start
  10317. (diff = nodeIndex = 0) || start.pop()) ) {
  10318. // When found, cache indexes on `parent` and break
  10319. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10320. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10321. break;
  10322. }
  10323. }
  10324. } else {
  10325. // Use previously-cached element index if available
  10326. if ( useCache ) {
  10327. // ...in a gzip-friendly way
  10328. node = elem;
  10329. outerCache = node[ expando ] || (node[ expando ] = {});
  10330. // Support: IE <9 only
  10331. // Defend against cloned attroperties (jQuery gh-1709)
  10332. uniqueCache = outerCache[ node.uniqueID ] ||
  10333. (outerCache[ node.uniqueID ] = {});
  10334. cache = uniqueCache[ type ] || [];
  10335. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10336. diff = nodeIndex;
  10337. }
  10338. // xml :nth-child(...)
  10339. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10340. if ( diff === false ) {
  10341. // Use the same loop as above to seek `elem` from the start
  10342. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10343. (diff = nodeIndex = 0) || start.pop()) ) {
  10344. if ( ( ofType ?
  10345. node.nodeName.toLowerCase() === name :
  10346. node.nodeType === 1 ) &&
  10347. ++diff ) {
  10348. // Cache the index of each encountered element
  10349. if ( useCache ) {
  10350. outerCache = node[ expando ] || (node[ expando ] = {});
  10351. // Support: IE <9 only
  10352. // Defend against cloned attroperties (jQuery gh-1709)
  10353. uniqueCache = outerCache[ node.uniqueID ] ||
  10354. (outerCache[ node.uniqueID ] = {});
  10355. uniqueCache[ type ] = [ dirruns, diff ];
  10356. }
  10357. if ( node === elem ) {
  10358. break;
  10359. }
  10360. }
  10361. }
  10362. }
  10363. }
  10364. // Incorporate the offset, then check against cycle size
  10365. diff -= last;
  10366. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10367. }
  10368. };
  10369. },
  10370. "PSEUDO": function( pseudo, argument ) {
  10371. // pseudo-class names are case-insensitive
  10372. // http://www.w3.org/TR/selectors/#pseudo-classes
  10373. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10374. // Remember that setFilters inherits from pseudos
  10375. var args,
  10376. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10377. Sizzle.error( "unsupported pseudo: " + pseudo );
  10378. // The user may use createPseudo to indicate that
  10379. // arguments are needed to create the filter function
  10380. // just as Sizzle does
  10381. if ( fn[ expando ] ) {
  10382. return fn( argument );
  10383. }
  10384. // But maintain support for old signatures
  10385. if ( fn.length > 1 ) {
  10386. args = [ pseudo, pseudo, "", argument ];
  10387. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10388. markFunction(function( seed, matches ) {
  10389. var idx,
  10390. matched = fn( seed, argument ),
  10391. i = matched.length;
  10392. while ( i-- ) {
  10393. idx = indexOf( seed, matched[i] );
  10394. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10395. }
  10396. }) :
  10397. function( elem ) {
  10398. return fn( elem, 0, args );
  10399. };
  10400. }
  10401. return fn;
  10402. }
  10403. },
  10404. pseudos: {
  10405. // Potentially complex pseudos
  10406. "not": markFunction(function( selector ) {
  10407. // Trim the selector passed to compile
  10408. // to avoid treating leading and trailing
  10409. // spaces as combinators
  10410. var input = [],
  10411. results = [],
  10412. matcher = compile( selector.replace( rtrim, "$1" ) );
  10413. return matcher[ expando ] ?
  10414. markFunction(function( seed, matches, context, xml ) {
  10415. var elem,
  10416. unmatched = matcher( seed, null, xml, [] ),
  10417. i = seed.length;
  10418. // Match elements unmatched by `matcher`
  10419. while ( i-- ) {
  10420. if ( (elem = unmatched[i]) ) {
  10421. seed[i] = !(matches[i] = elem);
  10422. }
  10423. }
  10424. }) :
  10425. function( elem, context, xml ) {
  10426. input[0] = elem;
  10427. matcher( input, null, xml, results );
  10428. // Don't keep the element (issue #299)
  10429. input[0] = null;
  10430. return !results.pop();
  10431. };
  10432. }),
  10433. "has": markFunction(function( selector ) {
  10434. return function( elem ) {
  10435. return Sizzle( selector, elem ).length > 0;
  10436. };
  10437. }),
  10438. "contains": markFunction(function( text ) {
  10439. text = text.replace( runescape, funescape );
  10440. return function( elem ) {
  10441. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10442. };
  10443. }),
  10444. // "Whether an element is represented by a :lang() selector
  10445. // is based solely on the element's language value
  10446. // being equal to the identifier C,
  10447. // or beginning with the identifier C immediately followed by "-".
  10448. // The matching of C against the element's language value is performed case-insensitively.
  10449. // The identifier C does not have to be a valid language name."
  10450. // http://www.w3.org/TR/selectors/#lang-pseudo
  10451. "lang": markFunction( function( lang ) {
  10452. // lang value must be a valid identifier
  10453. if ( !ridentifier.test(lang || "") ) {
  10454. Sizzle.error( "unsupported lang: " + lang );
  10455. }
  10456. lang = lang.replace( runescape, funescape ).toLowerCase();
  10457. return function( elem ) {
  10458. var elemLang;
  10459. do {
  10460. if ( (elemLang = documentIsHTML ?
  10461. elem.lang :
  10462. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10463. elemLang = elemLang.toLowerCase();
  10464. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10465. }
  10466. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10467. return false;
  10468. };
  10469. }),
  10470. // Miscellaneous
  10471. "target": function( elem ) {
  10472. var hash = window.location && window.location.hash;
  10473. return hash && hash.slice( 1 ) === elem.id;
  10474. },
  10475. "root": function( elem ) {
  10476. return elem === docElem;
  10477. },
  10478. "focus": function( elem ) {
  10479. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10480. },
  10481. // Boolean properties
  10482. "enabled": createDisabledPseudo( false ),
  10483. "disabled": createDisabledPseudo( true ),
  10484. "checked": function( elem ) {
  10485. // In CSS3, :checked should return both checked and selected elements
  10486. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10487. var nodeName = elem.nodeName.toLowerCase();
  10488. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10489. },
  10490. "selected": function( elem ) {
  10491. // Accessing this property makes selected-by-default
  10492. // options in Safari work properly
  10493. if ( elem.parentNode ) {
  10494. elem.parentNode.selectedIndex;
  10495. }
  10496. return elem.selected === true;
  10497. },
  10498. // Contents
  10499. "empty": function( elem ) {
  10500. // http://www.w3.org/TR/selectors/#empty-pseudo
  10501. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10502. // but not by others (comment: 8; processing instruction: 7; etc.)
  10503. // nodeType < 6 works because attributes (2) do not appear as children
  10504. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10505. if ( elem.nodeType < 6 ) {
  10506. return false;
  10507. }
  10508. }
  10509. return true;
  10510. },
  10511. "parent": function( elem ) {
  10512. return !Expr.pseudos["empty"]( elem );
  10513. },
  10514. // Element/input types
  10515. "header": function( elem ) {
  10516. return rheader.test( elem.nodeName );
  10517. },
  10518. "input": function( elem ) {
  10519. return rinputs.test( elem.nodeName );
  10520. },
  10521. "button": function( elem ) {
  10522. var name = elem.nodeName.toLowerCase();
  10523. return name === "input" && elem.type === "button" || name === "button";
  10524. },
  10525. "text": function( elem ) {
  10526. var attr;
  10527. return elem.nodeName.toLowerCase() === "input" &&
  10528. elem.type === "text" &&
  10529. // Support: IE<8
  10530. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10531. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10532. },
  10533. // Position-in-collection
  10534. "first": createPositionalPseudo(function() {
  10535. return [ 0 ];
  10536. }),
  10537. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10538. return [ length - 1 ];
  10539. }),
  10540. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10541. return [ argument < 0 ? argument + length : argument ];
  10542. }),
  10543. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10544. var i = 0;
  10545. for ( ; i < length; i += 2 ) {
  10546. matchIndexes.push( i );
  10547. }
  10548. return matchIndexes;
  10549. }),
  10550. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10551. var i = 1;
  10552. for ( ; i < length; i += 2 ) {
  10553. matchIndexes.push( i );
  10554. }
  10555. return matchIndexes;
  10556. }),
  10557. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10558. var i = argument < 0 ?
  10559. argument + length :
  10560. argument > length ?
  10561. length :
  10562. argument;
  10563. for ( ; --i >= 0; ) {
  10564. matchIndexes.push( i );
  10565. }
  10566. return matchIndexes;
  10567. }),
  10568. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10569. var i = argument < 0 ? argument + length : argument;
  10570. for ( ; ++i < length; ) {
  10571. matchIndexes.push( i );
  10572. }
  10573. return matchIndexes;
  10574. })
  10575. }
  10576. };
  10577. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10578. // Add button/input type pseudos
  10579. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10580. Expr.pseudos[ i ] = createInputPseudo( i );
  10581. }
  10582. for ( i in { submit: true, reset: true } ) {
  10583. Expr.pseudos[ i ] = createButtonPseudo( i );
  10584. }
  10585. // Easy API for creating new setFilters
  10586. function setFilters() {}
  10587. setFilters.prototype = Expr.filters = Expr.pseudos;
  10588. Expr.setFilters = new setFilters();
  10589. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10590. var matched, match, tokens, type,
  10591. soFar, groups, preFilters,
  10592. cached = tokenCache[ selector + " " ];
  10593. if ( cached ) {
  10594. return parseOnly ? 0 : cached.slice( 0 );
  10595. }
  10596. soFar = selector;
  10597. groups = [];
  10598. preFilters = Expr.preFilter;
  10599. while ( soFar ) {
  10600. // Comma and first run
  10601. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10602. if ( match ) {
  10603. // Don't consume trailing commas as valid
  10604. soFar = soFar.slice( match[0].length ) || soFar;
  10605. }
  10606. groups.push( (tokens = []) );
  10607. }
  10608. matched = false;
  10609. // Combinators
  10610. if ( (match = rcombinators.exec( soFar )) ) {
  10611. matched = match.shift();
  10612. tokens.push({
  10613. value: matched,
  10614. // Cast descendant combinators to space
  10615. type: match[0].replace( rtrim, " " )
  10616. });
  10617. soFar = soFar.slice( matched.length );
  10618. }
  10619. // Filters
  10620. for ( type in Expr.filter ) {
  10621. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10622. (match = preFilters[ type ]( match ))) ) {
  10623. matched = match.shift();
  10624. tokens.push({
  10625. value: matched,
  10626. type: type,
  10627. matches: match
  10628. });
  10629. soFar = soFar.slice( matched.length );
  10630. }
  10631. }
  10632. if ( !matched ) {
  10633. break;
  10634. }
  10635. }
  10636. // Return the length of the invalid excess
  10637. // if we're just parsing
  10638. // Otherwise, throw an error or return tokens
  10639. return parseOnly ?
  10640. soFar.length :
  10641. soFar ?
  10642. Sizzle.error( selector ) :
  10643. // Cache the tokens
  10644. tokenCache( selector, groups ).slice( 0 );
  10645. };
  10646. function toSelector( tokens ) {
  10647. var i = 0,
  10648. len = tokens.length,
  10649. selector = "";
  10650. for ( ; i < len; i++ ) {
  10651. selector += tokens[i].value;
  10652. }
  10653. return selector;
  10654. }
  10655. function addCombinator( matcher, combinator, base ) {
  10656. var dir = combinator.dir,
  10657. skip = combinator.next,
  10658. key = skip || dir,
  10659. checkNonElements = base && key === "parentNode",
  10660. doneName = done++;
  10661. return combinator.first ?
  10662. // Check against closest ancestor/preceding element
  10663. function( elem, context, xml ) {
  10664. while ( (elem = elem[ dir ]) ) {
  10665. if ( elem.nodeType === 1 || checkNonElements ) {
  10666. return matcher( elem, context, xml );
  10667. }
  10668. }
  10669. return false;
  10670. } :
  10671. // Check against all ancestor/preceding elements
  10672. function( elem, context, xml ) {
  10673. var oldCache, uniqueCache, outerCache,
  10674. newCache = [ dirruns, doneName ];
  10675. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10676. if ( xml ) {
  10677. while ( (elem = elem[ dir ]) ) {
  10678. if ( elem.nodeType === 1 || checkNonElements ) {
  10679. if ( matcher( elem, context, xml ) ) {
  10680. return true;
  10681. }
  10682. }
  10683. }
  10684. } else {
  10685. while ( (elem = elem[ dir ]) ) {
  10686. if ( elem.nodeType === 1 || checkNonElements ) {
  10687. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10688. // Support: IE <9 only
  10689. // Defend against cloned attroperties (jQuery gh-1709)
  10690. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10691. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10692. elem = elem[ dir ] || elem;
  10693. } else if ( (oldCache = uniqueCache[ key ]) &&
  10694. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10695. // Assign to newCache so results back-propagate to previous elements
  10696. return (newCache[ 2 ] = oldCache[ 2 ]);
  10697. } else {
  10698. // Reuse newcache so results back-propagate to previous elements
  10699. uniqueCache[ key ] = newCache;
  10700. // A match means we're done; a fail means we have to keep checking
  10701. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10702. return true;
  10703. }
  10704. }
  10705. }
  10706. }
  10707. }
  10708. return false;
  10709. };
  10710. }
  10711. function elementMatcher( matchers ) {
  10712. return matchers.length > 1 ?
  10713. function( elem, context, xml ) {
  10714. var i = matchers.length;
  10715. while ( i-- ) {
  10716. if ( !matchers[i]( elem, context, xml ) ) {
  10717. return false;
  10718. }
  10719. }
  10720. return true;
  10721. } :
  10722. matchers[0];
  10723. }
  10724. function multipleContexts( selector, contexts, results ) {
  10725. var i = 0,
  10726. len = contexts.length;
  10727. for ( ; i < len; i++ ) {
  10728. Sizzle( selector, contexts[i], results );
  10729. }
  10730. return results;
  10731. }
  10732. function condense( unmatched, map, filter, context, xml ) {
  10733. var elem,
  10734. newUnmatched = [],
  10735. i = 0,
  10736. len = unmatched.length,
  10737. mapped = map != null;
  10738. for ( ; i < len; i++ ) {
  10739. if ( (elem = unmatched[i]) ) {
  10740. if ( !filter || filter( elem, context, xml ) ) {
  10741. newUnmatched.push( elem );
  10742. if ( mapped ) {
  10743. map.push( i );
  10744. }
  10745. }
  10746. }
  10747. }
  10748. return newUnmatched;
  10749. }
  10750. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10751. if ( postFilter && !postFilter[ expando ] ) {
  10752. postFilter = setMatcher( postFilter );
  10753. }
  10754. if ( postFinder && !postFinder[ expando ] ) {
  10755. postFinder = setMatcher( postFinder, postSelector );
  10756. }
  10757. return markFunction(function( seed, results, context, xml ) {
  10758. var temp, i, elem,
  10759. preMap = [],
  10760. postMap = [],
  10761. preexisting = results.length,
  10762. // Get initial elements from seed or context
  10763. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10764. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10765. matcherIn = preFilter && ( seed || !selector ) ?
  10766. condense( elems, preMap, preFilter, context, xml ) :
  10767. elems,
  10768. matcherOut = matcher ?
  10769. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10770. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10771. // ...intermediate processing is necessary
  10772. [] :
  10773. // ...otherwise use results directly
  10774. results :
  10775. matcherIn;
  10776. // Find primary matches
  10777. if ( matcher ) {
  10778. matcher( matcherIn, matcherOut, context, xml );
  10779. }
  10780. // Apply postFilter
  10781. if ( postFilter ) {
  10782. temp = condense( matcherOut, postMap );
  10783. postFilter( temp, [], context, xml );
  10784. // Un-match failing elements by moving them back to matcherIn
  10785. i = temp.length;
  10786. while ( i-- ) {
  10787. if ( (elem = temp[i]) ) {
  10788. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10789. }
  10790. }
  10791. }
  10792. if ( seed ) {
  10793. if ( postFinder || preFilter ) {
  10794. if ( postFinder ) {
  10795. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10796. temp = [];
  10797. i = matcherOut.length;
  10798. while ( i-- ) {
  10799. if ( (elem = matcherOut[i]) ) {
  10800. // Restore matcherIn since elem is not yet a final match
  10801. temp.push( (matcherIn[i] = elem) );
  10802. }
  10803. }
  10804. postFinder( null, (matcherOut = []), temp, xml );
  10805. }
  10806. // Move matched elements from seed to results to keep them synchronized
  10807. i = matcherOut.length;
  10808. while ( i-- ) {
  10809. if ( (elem = matcherOut[i]) &&
  10810. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10811. seed[temp] = !(results[temp] = elem);
  10812. }
  10813. }
  10814. }
  10815. // Add elements to results, through postFinder if defined
  10816. } else {
  10817. matcherOut = condense(
  10818. matcherOut === results ?
  10819. matcherOut.splice( preexisting, matcherOut.length ) :
  10820. matcherOut
  10821. );
  10822. if ( postFinder ) {
  10823. postFinder( null, results, matcherOut, xml );
  10824. } else {
  10825. push.apply( results, matcherOut );
  10826. }
  10827. }
  10828. });
  10829. }
  10830. function matcherFromTokens( tokens ) {
  10831. var checkContext, matcher, j,
  10832. len = tokens.length,
  10833. leadingRelative = Expr.relative[ tokens[0].type ],
  10834. implicitRelative = leadingRelative || Expr.relative[" "],
  10835. i = leadingRelative ? 1 : 0,
  10836. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10837. matchContext = addCombinator( function( elem ) {
  10838. return elem === checkContext;
  10839. }, implicitRelative, true ),
  10840. matchAnyContext = addCombinator( function( elem ) {
  10841. return indexOf( checkContext, elem ) > -1;
  10842. }, implicitRelative, true ),
  10843. matchers = [ function( elem, context, xml ) {
  10844. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10845. (checkContext = context).nodeType ?
  10846. matchContext( elem, context, xml ) :
  10847. matchAnyContext( elem, context, xml ) );
  10848. // Avoid hanging onto element (issue #299)
  10849. checkContext = null;
  10850. return ret;
  10851. } ];
  10852. for ( ; i < len; i++ ) {
  10853. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10854. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10855. } else {
  10856. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10857. // Return special upon seeing a positional matcher
  10858. if ( matcher[ expando ] ) {
  10859. // Find the next relative operator (if any) for proper handling
  10860. j = ++i;
  10861. for ( ; j < len; j++ ) {
  10862. if ( Expr.relative[ tokens[j].type ] ) {
  10863. break;
  10864. }
  10865. }
  10866. return setMatcher(
  10867. i > 1 && elementMatcher( matchers ),
  10868. i > 1 && toSelector(
  10869. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10870. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10871. ).replace( rtrim, "$1" ),
  10872. matcher,
  10873. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10874. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10875. j < len && toSelector( tokens )
  10876. );
  10877. }
  10878. matchers.push( matcher );
  10879. }
  10880. }
  10881. return elementMatcher( matchers );
  10882. }
  10883. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10884. var bySet = setMatchers.length > 0,
  10885. byElement = elementMatchers.length > 0,
  10886. superMatcher = function( seed, context, xml, results, outermost ) {
  10887. var elem, j, matcher,
  10888. matchedCount = 0,
  10889. i = "0",
  10890. unmatched = seed && [],
  10891. setMatched = [],
  10892. contextBackup = outermostContext,
  10893. // We must always have either seed elements or outermost context
  10894. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10895. // Use integer dirruns iff this is the outermost matcher
  10896. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10897. len = elems.length;
  10898. if ( outermost ) {
  10899. outermostContext = context === document || context || outermost;
  10900. }
  10901. // Add elements passing elementMatchers directly to results
  10902. // Support: IE<9, Safari
  10903. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10904. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10905. if ( byElement && elem ) {
  10906. j = 0;
  10907. if ( !context && elem.ownerDocument !== document ) {
  10908. setDocument( elem );
  10909. xml = !documentIsHTML;
  10910. }
  10911. while ( (matcher = elementMatchers[j++]) ) {
  10912. if ( matcher( elem, context || document, xml) ) {
  10913. results.push( elem );
  10914. break;
  10915. }
  10916. }
  10917. if ( outermost ) {
  10918. dirruns = dirrunsUnique;
  10919. }
  10920. }
  10921. // Track unmatched elements for set filters
  10922. if ( bySet ) {
  10923. // They will have gone through all possible matchers
  10924. if ( (elem = !matcher && elem) ) {
  10925. matchedCount--;
  10926. }
  10927. // Lengthen the array for every element, matched or not
  10928. if ( seed ) {
  10929. unmatched.push( elem );
  10930. }
  10931. }
  10932. }
  10933. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10934. // makes the latter nonnegative.
  10935. matchedCount += i;
  10936. // Apply set filters to unmatched elements
  10937. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10938. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10939. // no element matchers and no seed.
  10940. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10941. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10942. // numerically zero.
  10943. if ( bySet && i !== matchedCount ) {
  10944. j = 0;
  10945. while ( (matcher = setMatchers[j++]) ) {
  10946. matcher( unmatched, setMatched, context, xml );
  10947. }
  10948. if ( seed ) {
  10949. // Reintegrate element matches to eliminate the need for sorting
  10950. if ( matchedCount > 0 ) {
  10951. while ( i-- ) {
  10952. if ( !(unmatched[i] || setMatched[i]) ) {
  10953. setMatched[i] = pop.call( results );
  10954. }
  10955. }
  10956. }
  10957. // Discard index placeholder values to get only actual matches
  10958. setMatched = condense( setMatched );
  10959. }
  10960. // Add matches to results
  10961. push.apply( results, setMatched );
  10962. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10963. if ( outermost && !seed && setMatched.length > 0 &&
  10964. ( matchedCount + setMatchers.length ) > 1 ) {
  10965. Sizzle.uniqueSort( results );
  10966. }
  10967. }
  10968. // Override manipulation of globals by nested matchers
  10969. if ( outermost ) {
  10970. dirruns = dirrunsUnique;
  10971. outermostContext = contextBackup;
  10972. }
  10973. return unmatched;
  10974. };
  10975. return bySet ?
  10976. markFunction( superMatcher ) :
  10977. superMatcher;
  10978. }
  10979. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10980. var i,
  10981. setMatchers = [],
  10982. elementMatchers = [],
  10983. cached = compilerCache[ selector + " " ];
  10984. if ( !cached ) {
  10985. // Generate a function of recursive functions that can be used to check each element
  10986. if ( !match ) {
  10987. match = tokenize( selector );
  10988. }
  10989. i = match.length;
  10990. while ( i-- ) {
  10991. cached = matcherFromTokens( match[i] );
  10992. if ( cached[ expando ] ) {
  10993. setMatchers.push( cached );
  10994. } else {
  10995. elementMatchers.push( cached );
  10996. }
  10997. }
  10998. // Cache the compiled function
  10999. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11000. // Save selector and tokenization
  11001. cached.selector = selector;
  11002. }
  11003. return cached;
  11004. };
  11005. /**
  11006. * A low-level selection function that works with Sizzle's compiled
  11007. * selector functions
  11008. * @param {String|Function} selector A selector or a pre-compiled
  11009. * selector function built with Sizzle.compile
  11010. * @param {Element} context
  11011. * @param {Array} [results]
  11012. * @param {Array} [seed] A set of elements to match against
  11013. */
  11014. select = Sizzle.select = function( selector, context, results, seed ) {
  11015. var i, tokens, token, type, find,
  11016. compiled = typeof selector === "function" && selector,
  11017. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11018. results = results || [];
  11019. // Try to minimize operations if there is only one selector in the list and no seed
  11020. // (the latter of which guarantees us context)
  11021. if ( match.length === 1 ) {
  11022. // Reduce context if the leading compound selector is an ID
  11023. tokens = match[0] = match[0].slice( 0 );
  11024. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11025. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11026. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11027. if ( !context ) {
  11028. return results;
  11029. // Precompiled matchers will still verify ancestry, so step up a level
  11030. } else if ( compiled ) {
  11031. context = context.parentNode;
  11032. }
  11033. selector = selector.slice( tokens.shift().value.length );
  11034. }
  11035. // Fetch a seed set for right-to-left matching
  11036. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11037. while ( i-- ) {
  11038. token = tokens[i];
  11039. // Abort if we hit a combinator
  11040. if ( Expr.relative[ (type = token.type) ] ) {
  11041. break;
  11042. }
  11043. if ( (find = Expr.find[ type ]) ) {
  11044. // Search, expanding context for leading sibling combinators
  11045. if ( (seed = find(
  11046. token.matches[0].replace( runescape, funescape ),
  11047. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11048. )) ) {
  11049. // If seed is empty or no tokens remain, we can return early
  11050. tokens.splice( i, 1 );
  11051. selector = seed.length && toSelector( tokens );
  11052. if ( !selector ) {
  11053. push.apply( results, seed );
  11054. return results;
  11055. }
  11056. break;
  11057. }
  11058. }
  11059. }
  11060. }
  11061. // Compile and execute a filtering function if one is not provided
  11062. // Provide `match` to avoid retokenization if we modified the selector above
  11063. ( compiled || compile( selector, match ) )(
  11064. seed,
  11065. context,
  11066. !documentIsHTML,
  11067. results,
  11068. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11069. );
  11070. return results;
  11071. };
  11072. // One-time assignments
  11073. // Sort stability
  11074. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11075. // Support: Chrome 14-35+
  11076. // Always assume duplicates if they aren't passed to the comparison function
  11077. support.detectDuplicates = !!hasDuplicate;
  11078. // Initialize against the default document
  11079. setDocument();
  11080. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11081. // Detached nodes confoundingly follow *each other*
  11082. support.sortDetached = assert(function( el ) {
  11083. // Should return 1, but returns 4 (following)
  11084. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11085. });
  11086. // Support: IE<8
  11087. // Prevent attribute/property "interpolation"
  11088. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11089. if ( !assert(function( el ) {
  11090. el.innerHTML = "<a href='#'></a>";
  11091. return el.firstChild.getAttribute("href") === "#" ;
  11092. }) ) {
  11093. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11094. if ( !isXML ) {
  11095. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11096. }
  11097. });
  11098. }
  11099. // Support: IE<9
  11100. // Use defaultValue in place of getAttribute("value")
  11101. if ( !support.attributes || !assert(function( el ) {
  11102. el.innerHTML = "<input/>";
  11103. el.firstChild.setAttribute( "value", "" );
  11104. return el.firstChild.getAttribute( "value" ) === "";
  11105. }) ) {
  11106. addHandle( "value", function( elem, name, isXML ) {
  11107. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11108. return elem.defaultValue;
  11109. }
  11110. });
  11111. }
  11112. // Support: IE<9
  11113. // Use getAttributeNode to fetch booleans when getAttribute lies
  11114. if ( !assert(function( el ) {
  11115. return el.getAttribute("disabled") == null;
  11116. }) ) {
  11117. addHandle( booleans, function( elem, name, isXML ) {
  11118. var val;
  11119. if ( !isXML ) {
  11120. return elem[ name ] === true ? name.toLowerCase() :
  11121. (val = elem.getAttributeNode( name )) && val.specified ?
  11122. val.value :
  11123. null;
  11124. }
  11125. });
  11126. }
  11127. return Sizzle;
  11128. })( window );
  11129. jQuery.find = Sizzle;
  11130. jQuery.expr = Sizzle.selectors;
  11131. // Deprecated
  11132. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11133. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11134. jQuery.text = Sizzle.getText;
  11135. jQuery.isXMLDoc = Sizzle.isXML;
  11136. jQuery.contains = Sizzle.contains;
  11137. jQuery.escapeSelector = Sizzle.escape;
  11138. var dir = function( elem, dir, until ) {
  11139. var matched = [],
  11140. truncate = until !== undefined;
  11141. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11142. if ( elem.nodeType === 1 ) {
  11143. if ( truncate && jQuery( elem ).is( until ) ) {
  11144. break;
  11145. }
  11146. matched.push( elem );
  11147. }
  11148. }
  11149. return matched;
  11150. };
  11151. var siblings = function( n, elem ) {
  11152. var matched = [];
  11153. for ( ; n; n = n.nextSibling ) {
  11154. if ( n.nodeType === 1 && n !== elem ) {
  11155. matched.push( n );
  11156. }
  11157. }
  11158. return matched;
  11159. };
  11160. var rneedsContext = jQuery.expr.match.needsContext;
  11161. function nodeName( elem, name ) {
  11162. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11163. };
  11164. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11165. // Implement the identical functionality for filter and not
  11166. function winnow( elements, qualifier, not ) {
  11167. if ( isFunction( qualifier ) ) {
  11168. return jQuery.grep( elements, function( elem, i ) {
  11169. return !!qualifier.call( elem, i, elem ) !== not;
  11170. } );
  11171. }
  11172. // Single element
  11173. if ( qualifier.nodeType ) {
  11174. return jQuery.grep( elements, function( elem ) {
  11175. return ( elem === qualifier ) !== not;
  11176. } );
  11177. }
  11178. // Arraylike of elements (jQuery, arguments, Array)
  11179. if ( typeof qualifier !== "string" ) {
  11180. return jQuery.grep( elements, function( elem ) {
  11181. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11182. } );
  11183. }
  11184. // Filtered directly for both simple and complex selectors
  11185. return jQuery.filter( qualifier, elements, not );
  11186. }
  11187. jQuery.filter = function( expr, elems, not ) {
  11188. var elem = elems[ 0 ];
  11189. if ( not ) {
  11190. expr = ":not(" + expr + ")";
  11191. }
  11192. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11193. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11194. }
  11195. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11196. return elem.nodeType === 1;
  11197. } ) );
  11198. };
  11199. jQuery.fn.extend( {
  11200. find: function( selector ) {
  11201. var i, ret,
  11202. len = this.length,
  11203. self = this;
  11204. if ( typeof selector !== "string" ) {
  11205. return this.pushStack( jQuery( selector ).filter( function() {
  11206. for ( i = 0; i < len; i++ ) {
  11207. if ( jQuery.contains( self[ i ], this ) ) {
  11208. return true;
  11209. }
  11210. }
  11211. } ) );
  11212. }
  11213. ret = this.pushStack( [] );
  11214. for ( i = 0; i < len; i++ ) {
  11215. jQuery.find( selector, self[ i ], ret );
  11216. }
  11217. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11218. },
  11219. filter: function( selector ) {
  11220. return this.pushStack( winnow( this, selector || [], false ) );
  11221. },
  11222. not: function( selector ) {
  11223. return this.pushStack( winnow( this, selector || [], true ) );
  11224. },
  11225. is: function( selector ) {
  11226. return !!winnow(
  11227. this,
  11228. // If this is a positional/relative selector, check membership in the returned set
  11229. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11230. typeof selector === "string" && rneedsContext.test( selector ) ?
  11231. jQuery( selector ) :
  11232. selector || [],
  11233. false
  11234. ).length;
  11235. }
  11236. } );
  11237. // Initialize a jQuery object
  11238. // A central reference to the root jQuery(document)
  11239. var rootjQuery,
  11240. // A simple way to check for HTML strings
  11241. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11242. // Strict HTML recognition (#11290: must start with <)
  11243. // Shortcut simple #id case for speed
  11244. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11245. init = jQuery.fn.init = function( selector, context, root ) {
  11246. var match, elem;
  11247. // HANDLE: $(""), $(null), $(undefined), $(false)
  11248. if ( !selector ) {
  11249. return this;
  11250. }
  11251. // Method init() accepts an alternate rootjQuery
  11252. // so migrate can support jQuery.sub (gh-2101)
  11253. root = root || rootjQuery;
  11254. // Handle HTML strings
  11255. if ( typeof selector === "string" ) {
  11256. if ( selector[ 0 ] === "<" &&
  11257. selector[ selector.length - 1 ] === ">" &&
  11258. selector.length >= 3 ) {
  11259. // Assume that strings that start and end with <> are HTML and skip the regex check
  11260. match = [ null, selector, null ];
  11261. } else {
  11262. match = rquickExpr.exec( selector );
  11263. }
  11264. // Match html or make sure no context is specified for #id
  11265. if ( match && ( match[ 1 ] || !context ) ) {
  11266. // HANDLE: $(html) -> $(array)
  11267. if ( match[ 1 ] ) {
  11268. context = context instanceof jQuery ? context[ 0 ] : context;
  11269. // Option to run scripts is true for back-compat
  11270. // Intentionally let the error be thrown if parseHTML is not present
  11271. jQuery.merge( this, jQuery.parseHTML(
  11272. match[ 1 ],
  11273. context && context.nodeType ? context.ownerDocument || context : document,
  11274. true
  11275. ) );
  11276. // HANDLE: $(html, props)
  11277. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11278. for ( match in context ) {
  11279. // Properties of context are called as methods if possible
  11280. if ( isFunction( this[ match ] ) ) {
  11281. this[ match ]( context[ match ] );
  11282. // ...and otherwise set as attributes
  11283. } else {
  11284. this.attr( match, context[ match ] );
  11285. }
  11286. }
  11287. }
  11288. return this;
  11289. // HANDLE: $(#id)
  11290. } else {
  11291. elem = document.getElementById( match[ 2 ] );
  11292. if ( elem ) {
  11293. // Inject the element directly into the jQuery object
  11294. this[ 0 ] = elem;
  11295. this.length = 1;
  11296. }
  11297. return this;
  11298. }
  11299. // HANDLE: $(expr, $(...))
  11300. } else if ( !context || context.jquery ) {
  11301. return ( context || root ).find( selector );
  11302. // HANDLE: $(expr, context)
  11303. // (which is just equivalent to: $(context).find(expr)
  11304. } else {
  11305. return this.constructor( context ).find( selector );
  11306. }
  11307. // HANDLE: $(DOMElement)
  11308. } else if ( selector.nodeType ) {
  11309. this[ 0 ] = selector;
  11310. this.length = 1;
  11311. return this;
  11312. // HANDLE: $(function)
  11313. // Shortcut for document ready
  11314. } else if ( isFunction( selector ) ) {
  11315. return root.ready !== undefined ?
  11316. root.ready( selector ) :
  11317. // Execute immediately if ready is not present
  11318. selector( jQuery );
  11319. }
  11320. return jQuery.makeArray( selector, this );
  11321. };
  11322. // Give the init function the jQuery prototype for later instantiation
  11323. init.prototype = jQuery.fn;
  11324. // Initialize central reference
  11325. rootjQuery = jQuery( document );
  11326. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11327. // Methods guaranteed to produce a unique set when starting from a unique set
  11328. guaranteedUnique = {
  11329. children: true,
  11330. contents: true,
  11331. next: true,
  11332. prev: true
  11333. };
  11334. jQuery.fn.extend( {
  11335. has: function( target ) {
  11336. var targets = jQuery( target, this ),
  11337. l = targets.length;
  11338. return this.filter( function() {
  11339. var i = 0;
  11340. for ( ; i < l; i++ ) {
  11341. if ( jQuery.contains( this, targets[ i ] ) ) {
  11342. return true;
  11343. }
  11344. }
  11345. } );
  11346. },
  11347. closest: function( selectors, context ) {
  11348. var cur,
  11349. i = 0,
  11350. l = this.length,
  11351. matched = [],
  11352. targets = typeof selectors !== "string" && jQuery( selectors );
  11353. // Positional selectors never match, since there's no _selection_ context
  11354. if ( !rneedsContext.test( selectors ) ) {
  11355. for ( ; i < l; i++ ) {
  11356. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11357. // Always skip document fragments
  11358. if ( cur.nodeType < 11 && ( targets ?
  11359. targets.index( cur ) > -1 :
  11360. // Don't pass non-elements to Sizzle
  11361. cur.nodeType === 1 &&
  11362. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11363. matched.push( cur );
  11364. break;
  11365. }
  11366. }
  11367. }
  11368. }
  11369. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11370. },
  11371. // Determine the position of an element within the set
  11372. index: function( elem ) {
  11373. // No argument, return index in parent
  11374. if ( !elem ) {
  11375. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11376. }
  11377. // Index in selector
  11378. if ( typeof elem === "string" ) {
  11379. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11380. }
  11381. // Locate the position of the desired element
  11382. return indexOf.call( this,
  11383. // If it receives a jQuery object, the first element is used
  11384. elem.jquery ? elem[ 0 ] : elem
  11385. );
  11386. },
  11387. add: function( selector, context ) {
  11388. return this.pushStack(
  11389. jQuery.uniqueSort(
  11390. jQuery.merge( this.get(), jQuery( selector, context ) )
  11391. )
  11392. );
  11393. },
  11394. addBack: function( selector ) {
  11395. return this.add( selector == null ?
  11396. this.prevObject : this.prevObject.filter( selector )
  11397. );
  11398. }
  11399. } );
  11400. function sibling( cur, dir ) {
  11401. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11402. return cur;
  11403. }
  11404. jQuery.each( {
  11405. parent: function( elem ) {
  11406. var parent = elem.parentNode;
  11407. return parent && parent.nodeType !== 11 ? parent : null;
  11408. },
  11409. parents: function( elem ) {
  11410. return dir( elem, "parentNode" );
  11411. },
  11412. parentsUntil: function( elem, i, until ) {
  11413. return dir( elem, "parentNode", until );
  11414. },
  11415. next: function( elem ) {
  11416. return sibling( elem, "nextSibling" );
  11417. },
  11418. prev: function( elem ) {
  11419. return sibling( elem, "previousSibling" );
  11420. },
  11421. nextAll: function( elem ) {
  11422. return dir( elem, "nextSibling" );
  11423. },
  11424. prevAll: function( elem ) {
  11425. return dir( elem, "previousSibling" );
  11426. },
  11427. nextUntil: function( elem, i, until ) {
  11428. return dir( elem, "nextSibling", until );
  11429. },
  11430. prevUntil: function( elem, i, until ) {
  11431. return dir( elem, "previousSibling", until );
  11432. },
  11433. siblings: function( elem ) {
  11434. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11435. },
  11436. children: function( elem ) {
  11437. return siblings( elem.firstChild );
  11438. },
  11439. contents: function( elem ) {
  11440. if ( typeof elem.contentDocument !== "undefined" ) {
  11441. return elem.contentDocument;
  11442. }
  11443. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11444. // Treat the template element as a regular one in browsers that
  11445. // don't support it.
  11446. if ( nodeName( elem, "template" ) ) {
  11447. elem = elem.content || elem;
  11448. }
  11449. return jQuery.merge( [], elem.childNodes );
  11450. }
  11451. }, function( name, fn ) {
  11452. jQuery.fn[ name ] = function( until, selector ) {
  11453. var matched = jQuery.map( this, fn, until );
  11454. if ( name.slice( -5 ) !== "Until" ) {
  11455. selector = until;
  11456. }
  11457. if ( selector && typeof selector === "string" ) {
  11458. matched = jQuery.filter( selector, matched );
  11459. }
  11460. if ( this.length > 1 ) {
  11461. // Remove duplicates
  11462. if ( !guaranteedUnique[ name ] ) {
  11463. jQuery.uniqueSort( matched );
  11464. }
  11465. // Reverse order for parents* and prev-derivatives
  11466. if ( rparentsprev.test( name ) ) {
  11467. matched.reverse();
  11468. }
  11469. }
  11470. return this.pushStack( matched );
  11471. };
  11472. } );
  11473. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11474. // Convert String-formatted options into Object-formatted ones
  11475. function createOptions( options ) {
  11476. var object = {};
  11477. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11478. object[ flag ] = true;
  11479. } );
  11480. return object;
  11481. }
  11482. /*
  11483. * Create a callback list using the following parameters:
  11484. *
  11485. * options: an optional list of space-separated options that will change how
  11486. * the callback list behaves or a more traditional option object
  11487. *
  11488. * By default a callback list will act like an event callback list and can be
  11489. * "fired" multiple times.
  11490. *
  11491. * Possible options:
  11492. *
  11493. * once: will ensure the callback list can only be fired once (like a Deferred)
  11494. *
  11495. * memory: will keep track of previous values and will call any callback added
  11496. * after the list has been fired right away with the latest "memorized"
  11497. * values (like a Deferred)
  11498. *
  11499. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11500. *
  11501. * stopOnFalse: interrupt callings when a callback returns false
  11502. *
  11503. */
  11504. jQuery.Callbacks = function( options ) {
  11505. // Convert options from String-formatted to Object-formatted if needed
  11506. // (we check in cache first)
  11507. options = typeof options === "string" ?
  11508. createOptions( options ) :
  11509. jQuery.extend( {}, options );
  11510. var // Flag to know if list is currently firing
  11511. firing,
  11512. // Last fire value for non-forgettable lists
  11513. memory,
  11514. // Flag to know if list was already fired
  11515. fired,
  11516. // Flag to prevent firing
  11517. locked,
  11518. // Actual callback list
  11519. list = [],
  11520. // Queue of execution data for repeatable lists
  11521. queue = [],
  11522. // Index of currently firing callback (modified by add/remove as needed)
  11523. firingIndex = -1,
  11524. // Fire callbacks
  11525. fire = function() {
  11526. // Enforce single-firing
  11527. locked = locked || options.once;
  11528. // Execute callbacks for all pending executions,
  11529. // respecting firingIndex overrides and runtime changes
  11530. fired = firing = true;
  11531. for ( ; queue.length; firingIndex = -1 ) {
  11532. memory = queue.shift();
  11533. while ( ++firingIndex < list.length ) {
  11534. // Run callback and check for early termination
  11535. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11536. options.stopOnFalse ) {
  11537. // Jump to end and forget the data so .add doesn't re-fire
  11538. firingIndex = list.length;
  11539. memory = false;
  11540. }
  11541. }
  11542. }
  11543. // Forget the data if we're done with it
  11544. if ( !options.memory ) {
  11545. memory = false;
  11546. }
  11547. firing = false;
  11548. // Clean up if we're done firing for good
  11549. if ( locked ) {
  11550. // Keep an empty list if we have data for future add calls
  11551. if ( memory ) {
  11552. list = [];
  11553. // Otherwise, this object is spent
  11554. } else {
  11555. list = "";
  11556. }
  11557. }
  11558. },
  11559. // Actual Callbacks object
  11560. self = {
  11561. // Add a callback or a collection of callbacks to the list
  11562. add: function() {
  11563. if ( list ) {
  11564. // If we have memory from a past run, we should fire after adding
  11565. if ( memory && !firing ) {
  11566. firingIndex = list.length - 1;
  11567. queue.push( memory );
  11568. }
  11569. ( function add( args ) {
  11570. jQuery.each( args, function( _, arg ) {
  11571. if ( isFunction( arg ) ) {
  11572. if ( !options.unique || !self.has( arg ) ) {
  11573. list.push( arg );
  11574. }
  11575. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11576. // Inspect recursively
  11577. add( arg );
  11578. }
  11579. } );
  11580. } )( arguments );
  11581. if ( memory && !firing ) {
  11582. fire();
  11583. }
  11584. }
  11585. return this;
  11586. },
  11587. // Remove a callback from the list
  11588. remove: function() {
  11589. jQuery.each( arguments, function( _, arg ) {
  11590. var index;
  11591. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11592. list.splice( index, 1 );
  11593. // Handle firing indexes
  11594. if ( index <= firingIndex ) {
  11595. firingIndex--;
  11596. }
  11597. }
  11598. } );
  11599. return this;
  11600. },
  11601. // Check if a given callback is in the list.
  11602. // If no argument is given, return whether or not list has callbacks attached.
  11603. has: function( fn ) {
  11604. return fn ?
  11605. jQuery.inArray( fn, list ) > -1 :
  11606. list.length > 0;
  11607. },
  11608. // Remove all callbacks from the list
  11609. empty: function() {
  11610. if ( list ) {
  11611. list = [];
  11612. }
  11613. return this;
  11614. },
  11615. // Disable .fire and .add
  11616. // Abort any current/pending executions
  11617. // Clear all callbacks and values
  11618. disable: function() {
  11619. locked = queue = [];
  11620. list = memory = "";
  11621. return this;
  11622. },
  11623. disabled: function() {
  11624. return !list;
  11625. },
  11626. // Disable .fire
  11627. // Also disable .add unless we have memory (since it would have no effect)
  11628. // Abort any pending executions
  11629. lock: function() {
  11630. locked = queue = [];
  11631. if ( !memory && !firing ) {
  11632. list = memory = "";
  11633. }
  11634. return this;
  11635. },
  11636. locked: function() {
  11637. return !!locked;
  11638. },
  11639. // Call all callbacks with the given context and arguments
  11640. fireWith: function( context, args ) {
  11641. if ( !locked ) {
  11642. args = args || [];
  11643. args = [ context, args.slice ? args.slice() : args ];
  11644. queue.push( args );
  11645. if ( !firing ) {
  11646. fire();
  11647. }
  11648. }
  11649. return this;
  11650. },
  11651. // Call all the callbacks with the given arguments
  11652. fire: function() {
  11653. self.fireWith( this, arguments );
  11654. return this;
  11655. },
  11656. // To know if the callbacks have already been called at least once
  11657. fired: function() {
  11658. return !!fired;
  11659. }
  11660. };
  11661. return self;
  11662. };
  11663. function Identity( v ) {
  11664. return v;
  11665. }
  11666. function Thrower( ex ) {
  11667. throw ex;
  11668. }
  11669. function adoptValue( value, resolve, reject, noValue ) {
  11670. var method;
  11671. try {
  11672. // Check for promise aspect first to privilege synchronous behavior
  11673. if ( value && isFunction( ( method = value.promise ) ) ) {
  11674. method.call( value ).done( resolve ).fail( reject );
  11675. // Other thenables
  11676. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11677. method.call( value, resolve, reject );
  11678. // Other non-thenables
  11679. } else {
  11680. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11681. // * false: [ value ].slice( 0 ) => resolve( value )
  11682. // * true: [ value ].slice( 1 ) => resolve()
  11683. resolve.apply( undefined, [ value ].slice( noValue ) );
  11684. }
  11685. // For Promises/A+, convert exceptions into rejections
  11686. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11687. // Deferred#then to conditionally suppress rejection.
  11688. } catch ( value ) {
  11689. // Support: Android 4.0 only
  11690. // Strict mode functions invoked without .call/.apply get global-object context
  11691. reject.apply( undefined, [ value ] );
  11692. }
  11693. }
  11694. jQuery.extend( {
  11695. Deferred: function( func ) {
  11696. var tuples = [
  11697. // action, add listener, callbacks,
  11698. // ... .then handlers, argument index, [final state]
  11699. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11700. jQuery.Callbacks( "memory" ), 2 ],
  11701. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11702. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11703. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11704. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11705. ],
  11706. state = "pending",
  11707. promise = {
  11708. state: function() {
  11709. return state;
  11710. },
  11711. always: function() {
  11712. deferred.done( arguments ).fail( arguments );
  11713. return this;
  11714. },
  11715. "catch": function( fn ) {
  11716. return promise.then( null, fn );
  11717. },
  11718. // Keep pipe for back-compat
  11719. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11720. var fns = arguments;
  11721. return jQuery.Deferred( function( newDefer ) {
  11722. jQuery.each( tuples, function( i, tuple ) {
  11723. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11724. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11725. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11726. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11727. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11728. deferred[ tuple[ 1 ] ]( function() {
  11729. var returned = fn && fn.apply( this, arguments );
  11730. if ( returned && isFunction( returned.promise ) ) {
  11731. returned.promise()
  11732. .progress( newDefer.notify )
  11733. .done( newDefer.resolve )
  11734. .fail( newDefer.reject );
  11735. } else {
  11736. newDefer[ tuple[ 0 ] + "With" ](
  11737. this,
  11738. fn ? [ returned ] : arguments
  11739. );
  11740. }
  11741. } );
  11742. } );
  11743. fns = null;
  11744. } ).promise();
  11745. },
  11746. then: function( onFulfilled, onRejected, onProgress ) {
  11747. var maxDepth = 0;
  11748. function resolve( depth, deferred, handler, special ) {
  11749. return function() {
  11750. var that = this,
  11751. args = arguments,
  11752. mightThrow = function() {
  11753. var returned, then;
  11754. // Support: Promises/A+ section 2.3.3.3.3
  11755. // https://promisesaplus.com/#point-59
  11756. // Ignore double-resolution attempts
  11757. if ( depth < maxDepth ) {
  11758. return;
  11759. }
  11760. returned = handler.apply( that, args );
  11761. // Support: Promises/A+ section 2.3.1
  11762. // https://promisesaplus.com/#point-48
  11763. if ( returned === deferred.promise() ) {
  11764. throw new TypeError( "Thenable self-resolution" );
  11765. }
  11766. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11767. // https://promisesaplus.com/#point-54
  11768. // https://promisesaplus.com/#point-75
  11769. // Retrieve `then` only once
  11770. then = returned &&
  11771. // Support: Promises/A+ section 2.3.4
  11772. // https://promisesaplus.com/#point-64
  11773. // Only check objects and functions for thenability
  11774. ( typeof returned === "object" ||
  11775. typeof returned === "function" ) &&
  11776. returned.then;
  11777. // Handle a returned thenable
  11778. if ( isFunction( then ) ) {
  11779. // Special processors (notify) just wait for resolution
  11780. if ( special ) {
  11781. then.call(
  11782. returned,
  11783. resolve( maxDepth, deferred, Identity, special ),
  11784. resolve( maxDepth, deferred, Thrower, special )
  11785. );
  11786. // Normal processors (resolve) also hook into progress
  11787. } else {
  11788. // ...and disregard older resolution values
  11789. maxDepth++;
  11790. then.call(
  11791. returned,
  11792. resolve( maxDepth, deferred, Identity, special ),
  11793. resolve( maxDepth, deferred, Thrower, special ),
  11794. resolve( maxDepth, deferred, Identity,
  11795. deferred.notifyWith )
  11796. );
  11797. }
  11798. // Handle all other returned values
  11799. } else {
  11800. // Only substitute handlers pass on context
  11801. // and multiple values (non-spec behavior)
  11802. if ( handler !== Identity ) {
  11803. that = undefined;
  11804. args = [ returned ];
  11805. }
  11806. // Process the value(s)
  11807. // Default process is resolve
  11808. ( special || deferred.resolveWith )( that, args );
  11809. }
  11810. },
  11811. // Only normal processors (resolve) catch and reject exceptions
  11812. process = special ?
  11813. mightThrow :
  11814. function() {
  11815. try {
  11816. mightThrow();
  11817. } catch ( e ) {
  11818. if ( jQuery.Deferred.exceptionHook ) {
  11819. jQuery.Deferred.exceptionHook( e,
  11820. process.stackTrace );
  11821. }
  11822. // Support: Promises/A+ section 2.3.3.3.4.1
  11823. // https://promisesaplus.com/#point-61
  11824. // Ignore post-resolution exceptions
  11825. if ( depth + 1 >= maxDepth ) {
  11826. // Only substitute handlers pass on context
  11827. // and multiple values (non-spec behavior)
  11828. if ( handler !== Thrower ) {
  11829. that = undefined;
  11830. args = [ e ];
  11831. }
  11832. deferred.rejectWith( that, args );
  11833. }
  11834. }
  11835. };
  11836. // Support: Promises/A+ section 2.3.3.3.1
  11837. // https://promisesaplus.com/#point-57
  11838. // Re-resolve promises immediately to dodge false rejection from
  11839. // subsequent errors
  11840. if ( depth ) {
  11841. process();
  11842. } else {
  11843. // Call an optional hook to record the stack, in case of exception
  11844. // since it's otherwise lost when execution goes async
  11845. if ( jQuery.Deferred.getStackHook ) {
  11846. process.stackTrace = jQuery.Deferred.getStackHook();
  11847. }
  11848. window.setTimeout( process );
  11849. }
  11850. };
  11851. }
  11852. return jQuery.Deferred( function( newDefer ) {
  11853. // progress_handlers.add( ... )
  11854. tuples[ 0 ][ 3 ].add(
  11855. resolve(
  11856. 0,
  11857. newDefer,
  11858. isFunction( onProgress ) ?
  11859. onProgress :
  11860. Identity,
  11861. newDefer.notifyWith
  11862. )
  11863. );
  11864. // fulfilled_handlers.add( ... )
  11865. tuples[ 1 ][ 3 ].add(
  11866. resolve(
  11867. 0,
  11868. newDefer,
  11869. isFunction( onFulfilled ) ?
  11870. onFulfilled :
  11871. Identity
  11872. )
  11873. );
  11874. // rejected_handlers.add( ... )
  11875. tuples[ 2 ][ 3 ].add(
  11876. resolve(
  11877. 0,
  11878. newDefer,
  11879. isFunction( onRejected ) ?
  11880. onRejected :
  11881. Thrower
  11882. )
  11883. );
  11884. } ).promise();
  11885. },
  11886. // Get a promise for this deferred
  11887. // If obj is provided, the promise aspect is added to the object
  11888. promise: function( obj ) {
  11889. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11890. }
  11891. },
  11892. deferred = {};
  11893. // Add list-specific methods
  11894. jQuery.each( tuples, function( i, tuple ) {
  11895. var list = tuple[ 2 ],
  11896. stateString = tuple[ 5 ];
  11897. // promise.progress = list.add
  11898. // promise.done = list.add
  11899. // promise.fail = list.add
  11900. promise[ tuple[ 1 ] ] = list.add;
  11901. // Handle state
  11902. if ( stateString ) {
  11903. list.add(
  11904. function() {
  11905. // state = "resolved" (i.e., fulfilled)
  11906. // state = "rejected"
  11907. state = stateString;
  11908. },
  11909. // rejected_callbacks.disable
  11910. // fulfilled_callbacks.disable
  11911. tuples[ 3 - i ][ 2 ].disable,
  11912. // rejected_handlers.disable
  11913. // fulfilled_handlers.disable
  11914. tuples[ 3 - i ][ 3 ].disable,
  11915. // progress_callbacks.lock
  11916. tuples[ 0 ][ 2 ].lock,
  11917. // progress_handlers.lock
  11918. tuples[ 0 ][ 3 ].lock
  11919. );
  11920. }
  11921. // progress_handlers.fire
  11922. // fulfilled_handlers.fire
  11923. // rejected_handlers.fire
  11924. list.add( tuple[ 3 ].fire );
  11925. // deferred.notify = function() { deferred.notifyWith(...) }
  11926. // deferred.resolve = function() { deferred.resolveWith(...) }
  11927. // deferred.reject = function() { deferred.rejectWith(...) }
  11928. deferred[ tuple[ 0 ] ] = function() {
  11929. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11930. return this;
  11931. };
  11932. // deferred.notifyWith = list.fireWith
  11933. // deferred.resolveWith = list.fireWith
  11934. // deferred.rejectWith = list.fireWith
  11935. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11936. } );
  11937. // Make the deferred a promise
  11938. promise.promise( deferred );
  11939. // Call given func if any
  11940. if ( func ) {
  11941. func.call( deferred, deferred );
  11942. }
  11943. // All done!
  11944. return deferred;
  11945. },
  11946. // Deferred helper
  11947. when: function( singleValue ) {
  11948. var
  11949. // count of uncompleted subordinates
  11950. remaining = arguments.length,
  11951. // count of unprocessed arguments
  11952. i = remaining,
  11953. // subordinate fulfillment data
  11954. resolveContexts = Array( i ),
  11955. resolveValues = slice.call( arguments ),
  11956. // the master Deferred
  11957. master = jQuery.Deferred(),
  11958. // subordinate callback factory
  11959. updateFunc = function( i ) {
  11960. return function( value ) {
  11961. resolveContexts[ i ] = this;
  11962. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11963. if ( !( --remaining ) ) {
  11964. master.resolveWith( resolveContexts, resolveValues );
  11965. }
  11966. };
  11967. };
  11968. // Single- and empty arguments are adopted like Promise.resolve
  11969. if ( remaining <= 1 ) {
  11970. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11971. !remaining );
  11972. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11973. if ( master.state() === "pending" ||
  11974. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11975. return master.then();
  11976. }
  11977. }
  11978. // Multiple arguments are aggregated like Promise.all array elements
  11979. while ( i-- ) {
  11980. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11981. }
  11982. return master.promise();
  11983. }
  11984. } );
  11985. // These usually indicate a programmer mistake during development,
  11986. // warn about them ASAP rather than swallowing them by default.
  11987. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11988. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11989. // Support: IE 8 - 9 only
  11990. // Console exists when dev tools are open, which can happen at any time
  11991. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11992. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11993. }
  11994. };
  11995. jQuery.readyException = function( error ) {
  11996. window.setTimeout( function() {
  11997. throw error;
  11998. } );
  11999. };
  12000. // The deferred used on DOM ready
  12001. var readyList = jQuery.Deferred();
  12002. jQuery.fn.ready = function( fn ) {
  12003. readyList
  12004. .then( fn )
  12005. // Wrap jQuery.readyException in a function so that the lookup
  12006. // happens at the time of error handling instead of callback
  12007. // registration.
  12008. .catch( function( error ) {
  12009. jQuery.readyException( error );
  12010. } );
  12011. return this;
  12012. };
  12013. jQuery.extend( {
  12014. // Is the DOM ready to be used? Set to true once it occurs.
  12015. isReady: false,
  12016. // A counter to track how many items to wait for before
  12017. // the ready event fires. See #6781
  12018. readyWait: 1,
  12019. // Handle when the DOM is ready
  12020. ready: function( wait ) {
  12021. // Abort if there are pending holds or we're already ready
  12022. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12023. return;
  12024. }
  12025. // Remember that the DOM is ready
  12026. jQuery.isReady = true;
  12027. // If a normal DOM Ready event fired, decrement, and wait if need be
  12028. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12029. return;
  12030. }
  12031. // If there are functions bound, to execute
  12032. readyList.resolveWith( document, [ jQuery ] );
  12033. }
  12034. } );
  12035. jQuery.ready.then = readyList.then;
  12036. // The ready event handler and self cleanup method
  12037. function completed() {
  12038. document.removeEventListener( "DOMContentLoaded", completed );
  12039. window.removeEventListener( "load", completed );
  12040. jQuery.ready();
  12041. }
  12042. // Catch cases where $(document).ready() is called
  12043. // after the browser event has already occurred.
  12044. // Support: IE <=9 - 10 only
  12045. // Older IE sometimes signals "interactive" too soon
  12046. if ( document.readyState === "complete" ||
  12047. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12048. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12049. window.setTimeout( jQuery.ready );
  12050. } else {
  12051. // Use the handy event callback
  12052. document.addEventListener( "DOMContentLoaded", completed );
  12053. // A fallback to window.onload, that will always work
  12054. window.addEventListener( "load", completed );
  12055. }
  12056. // Multifunctional method to get and set values of a collection
  12057. // The value/s can optionally be executed if it's a function
  12058. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12059. var i = 0,
  12060. len = elems.length,
  12061. bulk = key == null;
  12062. // Sets many values
  12063. if ( toType( key ) === "object" ) {
  12064. chainable = true;
  12065. for ( i in key ) {
  12066. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12067. }
  12068. // Sets one value
  12069. } else if ( value !== undefined ) {
  12070. chainable = true;
  12071. if ( !isFunction( value ) ) {
  12072. raw = true;
  12073. }
  12074. if ( bulk ) {
  12075. // Bulk operations run against the entire set
  12076. if ( raw ) {
  12077. fn.call( elems, value );
  12078. fn = null;
  12079. // ...except when executing function values
  12080. } else {
  12081. bulk = fn;
  12082. fn = function( elem, key, value ) {
  12083. return bulk.call( jQuery( elem ), value );
  12084. };
  12085. }
  12086. }
  12087. if ( fn ) {
  12088. for ( ; i < len; i++ ) {
  12089. fn(
  12090. elems[ i ], key, raw ?
  12091. value :
  12092. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12093. );
  12094. }
  12095. }
  12096. }
  12097. if ( chainable ) {
  12098. return elems;
  12099. }
  12100. // Gets
  12101. if ( bulk ) {
  12102. return fn.call( elems );
  12103. }
  12104. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12105. };
  12106. // Matches dashed string for camelizing
  12107. var rmsPrefix = /^-ms-/,
  12108. rdashAlpha = /-([a-z])/g;
  12109. // Used by camelCase as callback to replace()
  12110. function fcamelCase( all, letter ) {
  12111. return letter.toUpperCase();
  12112. }
  12113. // Convert dashed to camelCase; used by the css and data modules
  12114. // Support: IE <=9 - 11, Edge 12 - 15
  12115. // Microsoft forgot to hump their vendor prefix (#9572)
  12116. function camelCase( string ) {
  12117. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12118. }
  12119. var acceptData = function( owner ) {
  12120. // Accepts only:
  12121. // - Node
  12122. // - Node.ELEMENT_NODE
  12123. // - Node.DOCUMENT_NODE
  12124. // - Object
  12125. // - Any
  12126. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12127. };
  12128. function Data() {
  12129. this.expando = jQuery.expando + Data.uid++;
  12130. }
  12131. Data.uid = 1;
  12132. Data.prototype = {
  12133. cache: function( owner ) {
  12134. // Check if the owner object already has a cache
  12135. var value = owner[ this.expando ];
  12136. // If not, create one
  12137. if ( !value ) {
  12138. value = {};
  12139. // We can accept data for non-element nodes in modern browsers,
  12140. // but we should not, see #8335.
  12141. // Always return an empty object.
  12142. if ( acceptData( owner ) ) {
  12143. // If it is a node unlikely to be stringify-ed or looped over
  12144. // use plain assignment
  12145. if ( owner.nodeType ) {
  12146. owner[ this.expando ] = value;
  12147. // Otherwise secure it in a non-enumerable property
  12148. // configurable must be true to allow the property to be
  12149. // deleted when data is removed
  12150. } else {
  12151. Object.defineProperty( owner, this.expando, {
  12152. value: value,
  12153. configurable: true
  12154. } );
  12155. }
  12156. }
  12157. }
  12158. return value;
  12159. },
  12160. set: function( owner, data, value ) {
  12161. var prop,
  12162. cache = this.cache( owner );
  12163. // Handle: [ owner, key, value ] args
  12164. // Always use camelCase key (gh-2257)
  12165. if ( typeof data === "string" ) {
  12166. cache[ camelCase( data ) ] = value;
  12167. // Handle: [ owner, { properties } ] args
  12168. } else {
  12169. // Copy the properties one-by-one to the cache object
  12170. for ( prop in data ) {
  12171. cache[ camelCase( prop ) ] = data[ prop ];
  12172. }
  12173. }
  12174. return cache;
  12175. },
  12176. get: function( owner, key ) {
  12177. return key === undefined ?
  12178. this.cache( owner ) :
  12179. // Always use camelCase key (gh-2257)
  12180. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12181. },
  12182. access: function( owner, key, value ) {
  12183. // In cases where either:
  12184. //
  12185. // 1. No key was specified
  12186. // 2. A string key was specified, but no value provided
  12187. //
  12188. // Take the "read" path and allow the get method to determine
  12189. // which value to return, respectively either:
  12190. //
  12191. // 1. The entire cache object
  12192. // 2. The data stored at the key
  12193. //
  12194. if ( key === undefined ||
  12195. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12196. return this.get( owner, key );
  12197. }
  12198. // When the key is not a string, or both a key and value
  12199. // are specified, set or extend (existing objects) with either:
  12200. //
  12201. // 1. An object of properties
  12202. // 2. A key and value
  12203. //
  12204. this.set( owner, key, value );
  12205. // Since the "set" path can have two possible entry points
  12206. // return the expected data based on which path was taken[*]
  12207. return value !== undefined ? value : key;
  12208. },
  12209. remove: function( owner, key ) {
  12210. var i,
  12211. cache = owner[ this.expando ];
  12212. if ( cache === undefined ) {
  12213. return;
  12214. }
  12215. if ( key !== undefined ) {
  12216. // Support array or space separated string of keys
  12217. if ( Array.isArray( key ) ) {
  12218. // If key is an array of keys...
  12219. // We always set camelCase keys, so remove that.
  12220. key = key.map( camelCase );
  12221. } else {
  12222. key = camelCase( key );
  12223. // If a key with the spaces exists, use it.
  12224. // Otherwise, create an array by matching non-whitespace
  12225. key = key in cache ?
  12226. [ key ] :
  12227. ( key.match( rnothtmlwhite ) || [] );
  12228. }
  12229. i = key.length;
  12230. while ( i-- ) {
  12231. delete cache[ key[ i ] ];
  12232. }
  12233. }
  12234. // Remove the expando if there's no more data
  12235. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12236. // Support: Chrome <=35 - 45
  12237. // Webkit & Blink performance suffers when deleting properties
  12238. // from DOM nodes, so set to undefined instead
  12239. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12240. if ( owner.nodeType ) {
  12241. owner[ this.expando ] = undefined;
  12242. } else {
  12243. delete owner[ this.expando ];
  12244. }
  12245. }
  12246. },
  12247. hasData: function( owner ) {
  12248. var cache = owner[ this.expando ];
  12249. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12250. }
  12251. };
  12252. var dataPriv = new Data();
  12253. var dataUser = new Data();
  12254. // Implementation Summary
  12255. //
  12256. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12257. // 2. Improve the module's maintainability by reducing the storage
  12258. // paths to a single mechanism.
  12259. // 3. Use the same single mechanism to support "private" and "user" data.
  12260. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12261. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12262. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12263. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12264. rmultiDash = /[A-Z]/g;
  12265. function getData( data ) {
  12266. if ( data === "true" ) {
  12267. return true;
  12268. }
  12269. if ( data === "false" ) {
  12270. return false;
  12271. }
  12272. if ( data === "null" ) {
  12273. return null;
  12274. }
  12275. // Only convert to a number if it doesn't change the string
  12276. if ( data === +data + "" ) {
  12277. return +data;
  12278. }
  12279. if ( rbrace.test( data ) ) {
  12280. return JSON.parse( data );
  12281. }
  12282. return data;
  12283. }
  12284. function dataAttr( elem, key, data ) {
  12285. var name;
  12286. // If nothing was found internally, try to fetch any
  12287. // data from the HTML5 data-* attribute
  12288. if ( data === undefined && elem.nodeType === 1 ) {
  12289. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12290. data = elem.getAttribute( name );
  12291. if ( typeof data === "string" ) {
  12292. try {
  12293. data = getData( data );
  12294. } catch ( e ) {}
  12295. // Make sure we set the data so it isn't changed later
  12296. dataUser.set( elem, key, data );
  12297. } else {
  12298. data = undefined;
  12299. }
  12300. }
  12301. return data;
  12302. }
  12303. jQuery.extend( {
  12304. hasData: function( elem ) {
  12305. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12306. },
  12307. data: function( elem, name, data ) {
  12308. return dataUser.access( elem, name, data );
  12309. },
  12310. removeData: function( elem, name ) {
  12311. dataUser.remove( elem, name );
  12312. },
  12313. // TODO: Now that all calls to _data and _removeData have been replaced
  12314. // with direct calls to dataPriv methods, these can be deprecated.
  12315. _data: function( elem, name, data ) {
  12316. return dataPriv.access( elem, name, data );
  12317. },
  12318. _removeData: function( elem, name ) {
  12319. dataPriv.remove( elem, name );
  12320. }
  12321. } );
  12322. jQuery.fn.extend( {
  12323. data: function( key, value ) {
  12324. var i, name, data,
  12325. elem = this[ 0 ],
  12326. attrs = elem && elem.attributes;
  12327. // Gets all values
  12328. if ( key === undefined ) {
  12329. if ( this.length ) {
  12330. data = dataUser.get( elem );
  12331. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12332. i = attrs.length;
  12333. while ( i-- ) {
  12334. // Support: IE 11 only
  12335. // The attrs elements can be null (#14894)
  12336. if ( attrs[ i ] ) {
  12337. name = attrs[ i ].name;
  12338. if ( name.indexOf( "data-" ) === 0 ) {
  12339. name = camelCase( name.slice( 5 ) );
  12340. dataAttr( elem, name, data[ name ] );
  12341. }
  12342. }
  12343. }
  12344. dataPriv.set( elem, "hasDataAttrs", true );
  12345. }
  12346. }
  12347. return data;
  12348. }
  12349. // Sets multiple values
  12350. if ( typeof key === "object" ) {
  12351. return this.each( function() {
  12352. dataUser.set( this, key );
  12353. } );
  12354. }
  12355. return access( this, function( value ) {
  12356. var data;
  12357. // The calling jQuery object (element matches) is not empty
  12358. // (and therefore has an element appears at this[ 0 ]) and the
  12359. // `value` parameter was not undefined. An empty jQuery object
  12360. // will result in `undefined` for elem = this[ 0 ] which will
  12361. // throw an exception if an attempt to read a data cache is made.
  12362. if ( elem && value === undefined ) {
  12363. // Attempt to get data from the cache
  12364. // The key will always be camelCased in Data
  12365. data = dataUser.get( elem, key );
  12366. if ( data !== undefined ) {
  12367. return data;
  12368. }
  12369. // Attempt to "discover" the data in
  12370. // HTML5 custom data-* attrs
  12371. data = dataAttr( elem, key );
  12372. if ( data !== undefined ) {
  12373. return data;
  12374. }
  12375. // We tried really hard, but the data doesn't exist.
  12376. return;
  12377. }
  12378. // Set the data...
  12379. this.each( function() {
  12380. // We always store the camelCased key
  12381. dataUser.set( this, key, value );
  12382. } );
  12383. }, null, value, arguments.length > 1, null, true );
  12384. },
  12385. removeData: function( key ) {
  12386. return this.each( function() {
  12387. dataUser.remove( this, key );
  12388. } );
  12389. }
  12390. } );
  12391. jQuery.extend( {
  12392. queue: function( elem, type, data ) {
  12393. var queue;
  12394. if ( elem ) {
  12395. type = ( type || "fx" ) + "queue";
  12396. queue = dataPriv.get( elem, type );
  12397. // Speed up dequeue by getting out quickly if this is just a lookup
  12398. if ( data ) {
  12399. if ( !queue || Array.isArray( data ) ) {
  12400. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12401. } else {
  12402. queue.push( data );
  12403. }
  12404. }
  12405. return queue || [];
  12406. }
  12407. },
  12408. dequeue: function( elem, type ) {
  12409. type = type || "fx";
  12410. var queue = jQuery.queue( elem, type ),
  12411. startLength = queue.length,
  12412. fn = queue.shift(),
  12413. hooks = jQuery._queueHooks( elem, type ),
  12414. next = function() {
  12415. jQuery.dequeue( elem, type );
  12416. };
  12417. // If the fx queue is dequeued, always remove the progress sentinel
  12418. if ( fn === "inprogress" ) {
  12419. fn = queue.shift();
  12420. startLength--;
  12421. }
  12422. if ( fn ) {
  12423. // Add a progress sentinel to prevent the fx queue from being
  12424. // automatically dequeued
  12425. if ( type === "fx" ) {
  12426. queue.unshift( "inprogress" );
  12427. }
  12428. // Clear up the last queue stop function
  12429. delete hooks.stop;
  12430. fn.call( elem, next, hooks );
  12431. }
  12432. if ( !startLength && hooks ) {
  12433. hooks.empty.fire();
  12434. }
  12435. },
  12436. // Not public - generate a queueHooks object, or return the current one
  12437. _queueHooks: function( elem, type ) {
  12438. var key = type + "queueHooks";
  12439. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12440. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12441. dataPriv.remove( elem, [ type + "queue", key ] );
  12442. } )
  12443. } );
  12444. }
  12445. } );
  12446. jQuery.fn.extend( {
  12447. queue: function( type, data ) {
  12448. var setter = 2;
  12449. if ( typeof type !== "string" ) {
  12450. data = type;
  12451. type = "fx";
  12452. setter--;
  12453. }
  12454. if ( arguments.length < setter ) {
  12455. return jQuery.queue( this[ 0 ], type );
  12456. }
  12457. return data === undefined ?
  12458. this :
  12459. this.each( function() {
  12460. var queue = jQuery.queue( this, type, data );
  12461. // Ensure a hooks for this queue
  12462. jQuery._queueHooks( this, type );
  12463. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12464. jQuery.dequeue( this, type );
  12465. }
  12466. } );
  12467. },
  12468. dequeue: function( type ) {
  12469. return this.each( function() {
  12470. jQuery.dequeue( this, type );
  12471. } );
  12472. },
  12473. clearQueue: function( type ) {
  12474. return this.queue( type || "fx", [] );
  12475. },
  12476. // Get a promise resolved when queues of a certain type
  12477. // are emptied (fx is the type by default)
  12478. promise: function( type, obj ) {
  12479. var tmp,
  12480. count = 1,
  12481. defer = jQuery.Deferred(),
  12482. elements = this,
  12483. i = this.length,
  12484. resolve = function() {
  12485. if ( !( --count ) ) {
  12486. defer.resolveWith( elements, [ elements ] );
  12487. }
  12488. };
  12489. if ( typeof type !== "string" ) {
  12490. obj = type;
  12491. type = undefined;
  12492. }
  12493. type = type || "fx";
  12494. while ( i-- ) {
  12495. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12496. if ( tmp && tmp.empty ) {
  12497. count++;
  12498. tmp.empty.add( resolve );
  12499. }
  12500. }
  12501. resolve();
  12502. return defer.promise( obj );
  12503. }
  12504. } );
  12505. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12506. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12507. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12508. var documentElement = document.documentElement;
  12509. var isAttached = function( elem ) {
  12510. return jQuery.contains( elem.ownerDocument, elem );
  12511. },
  12512. composed = { composed: true };
  12513. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12514. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12515. // Support: iOS 10.0-10.2 only
  12516. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12517. // leading to errors. We need to check for `getRootNode`.
  12518. if ( documentElement.getRootNode ) {
  12519. isAttached = function( elem ) {
  12520. return jQuery.contains( elem.ownerDocument, elem ) ||
  12521. elem.getRootNode( composed ) === elem.ownerDocument;
  12522. };
  12523. }
  12524. var isHiddenWithinTree = function( elem, el ) {
  12525. // isHiddenWithinTree might be called from jQuery#filter function;
  12526. // in that case, element will be second argument
  12527. elem = el || elem;
  12528. // Inline style trumps all
  12529. return elem.style.display === "none" ||
  12530. elem.style.display === "" &&
  12531. // Otherwise, check computed style
  12532. // Support: Firefox <=43 - 45
  12533. // Disconnected elements can have computed display: none, so first confirm that elem is
  12534. // in the document.
  12535. isAttached( elem ) &&
  12536. jQuery.css( elem, "display" ) === "none";
  12537. };
  12538. var swap = function( elem, options, callback, args ) {
  12539. var ret, name,
  12540. old = {};
  12541. // Remember the old values, and insert the new ones
  12542. for ( name in options ) {
  12543. old[ name ] = elem.style[ name ];
  12544. elem.style[ name ] = options[ name ];
  12545. }
  12546. ret = callback.apply( elem, args || [] );
  12547. // Revert the old values
  12548. for ( name in options ) {
  12549. elem.style[ name ] = old[ name ];
  12550. }
  12551. return ret;
  12552. };
  12553. function adjustCSS( elem, prop, valueParts, tween ) {
  12554. var adjusted, scale,
  12555. maxIterations = 20,
  12556. currentValue = tween ?
  12557. function() {
  12558. return tween.cur();
  12559. } :
  12560. function() {
  12561. return jQuery.css( elem, prop, "" );
  12562. },
  12563. initial = currentValue(),
  12564. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12565. // Starting value computation is required for potential unit mismatches
  12566. initialInUnit = elem.nodeType &&
  12567. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12568. rcssNum.exec( jQuery.css( elem, prop ) );
  12569. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12570. // Support: Firefox <=54
  12571. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12572. initial = initial / 2;
  12573. // Trust units reported by jQuery.css
  12574. unit = unit || initialInUnit[ 3 ];
  12575. // Iteratively approximate from a nonzero starting point
  12576. initialInUnit = +initial || 1;
  12577. while ( maxIterations-- ) {
  12578. // Evaluate and update our best guess (doubling guesses that zero out).
  12579. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12580. jQuery.style( elem, prop, initialInUnit + unit );
  12581. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12582. maxIterations = 0;
  12583. }
  12584. initialInUnit = initialInUnit / scale;
  12585. }
  12586. initialInUnit = initialInUnit * 2;
  12587. jQuery.style( elem, prop, initialInUnit + unit );
  12588. // Make sure we update the tween properties later on
  12589. valueParts = valueParts || [];
  12590. }
  12591. if ( valueParts ) {
  12592. initialInUnit = +initialInUnit || +initial || 0;
  12593. // Apply relative offset (+=/-=) if specified
  12594. adjusted = valueParts[ 1 ] ?
  12595. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12596. +valueParts[ 2 ];
  12597. if ( tween ) {
  12598. tween.unit = unit;
  12599. tween.start = initialInUnit;
  12600. tween.end = adjusted;
  12601. }
  12602. }
  12603. return adjusted;
  12604. }
  12605. var defaultDisplayMap = {};
  12606. function getDefaultDisplay( elem ) {
  12607. var temp,
  12608. doc = elem.ownerDocument,
  12609. nodeName = elem.nodeName,
  12610. display = defaultDisplayMap[ nodeName ];
  12611. if ( display ) {
  12612. return display;
  12613. }
  12614. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12615. display = jQuery.css( temp, "display" );
  12616. temp.parentNode.removeChild( temp );
  12617. if ( display === "none" ) {
  12618. display = "block";
  12619. }
  12620. defaultDisplayMap[ nodeName ] = display;
  12621. return display;
  12622. }
  12623. function showHide( elements, show ) {
  12624. var display, elem,
  12625. values = [],
  12626. index = 0,
  12627. length = elements.length;
  12628. // Determine new display value for elements that need to change
  12629. for ( ; index < length; index++ ) {
  12630. elem = elements[ index ];
  12631. if ( !elem.style ) {
  12632. continue;
  12633. }
  12634. display = elem.style.display;
  12635. if ( show ) {
  12636. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12637. // check is required in this first loop unless we have a nonempty display value (either
  12638. // inline or about-to-be-restored)
  12639. if ( display === "none" ) {
  12640. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12641. if ( !values[ index ] ) {
  12642. elem.style.display = "";
  12643. }
  12644. }
  12645. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12646. values[ index ] = getDefaultDisplay( elem );
  12647. }
  12648. } else {
  12649. if ( display !== "none" ) {
  12650. values[ index ] = "none";
  12651. // Remember what we're overwriting
  12652. dataPriv.set( elem, "display", display );
  12653. }
  12654. }
  12655. }
  12656. // Set the display of the elements in a second loop to avoid constant reflow
  12657. for ( index = 0; index < length; index++ ) {
  12658. if ( values[ index ] != null ) {
  12659. elements[ index ].style.display = values[ index ];
  12660. }
  12661. }
  12662. return elements;
  12663. }
  12664. jQuery.fn.extend( {
  12665. show: function() {
  12666. return showHide( this, true );
  12667. },
  12668. hide: function() {
  12669. return showHide( this );
  12670. },
  12671. toggle: function( state ) {
  12672. if ( typeof state === "boolean" ) {
  12673. return state ? this.show() : this.hide();
  12674. }
  12675. return this.each( function() {
  12676. if ( isHiddenWithinTree( this ) ) {
  12677. jQuery( this ).show();
  12678. } else {
  12679. jQuery( this ).hide();
  12680. }
  12681. } );
  12682. }
  12683. } );
  12684. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12685. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12686. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12687. // We have to close these tags to support XHTML (#13200)
  12688. var wrapMap = {
  12689. // Support: IE <=9 only
  12690. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12691. // XHTML parsers do not magically insert elements in the
  12692. // same way that tag soup parsers do. So we cannot shorten
  12693. // this by omitting <tbody> or other required elements.
  12694. thead: [ 1, "<table>", "</table>" ],
  12695. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12696. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12697. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12698. _default: [ 0, "", "" ]
  12699. };
  12700. // Support: IE <=9 only
  12701. wrapMap.optgroup = wrapMap.option;
  12702. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12703. wrapMap.th = wrapMap.td;
  12704. function getAll( context, tag ) {
  12705. // Support: IE <=9 - 11 only
  12706. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12707. var ret;
  12708. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12709. ret = context.getElementsByTagName( tag || "*" );
  12710. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12711. ret = context.querySelectorAll( tag || "*" );
  12712. } else {
  12713. ret = [];
  12714. }
  12715. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12716. return jQuery.merge( [ context ], ret );
  12717. }
  12718. return ret;
  12719. }
  12720. // Mark scripts as having already been evaluated
  12721. function setGlobalEval( elems, refElements ) {
  12722. var i = 0,
  12723. l = elems.length;
  12724. for ( ; i < l; i++ ) {
  12725. dataPriv.set(
  12726. elems[ i ],
  12727. "globalEval",
  12728. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12729. );
  12730. }
  12731. }
  12732. var rhtml = /<|&#?\w+;/;
  12733. function buildFragment( elems, context, scripts, selection, ignored ) {
  12734. var elem, tmp, tag, wrap, attached, j,
  12735. fragment = context.createDocumentFragment(),
  12736. nodes = [],
  12737. i = 0,
  12738. l = elems.length;
  12739. for ( ; i < l; i++ ) {
  12740. elem = elems[ i ];
  12741. if ( elem || elem === 0 ) {
  12742. // Add nodes directly
  12743. if ( toType( elem ) === "object" ) {
  12744. // Support: Android <=4.0 only, PhantomJS 1 only
  12745. // push.apply(_, arraylike) throws on ancient WebKit
  12746. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12747. // Convert non-html into a text node
  12748. } else if ( !rhtml.test( elem ) ) {
  12749. nodes.push( context.createTextNode( elem ) );
  12750. // Convert html into DOM nodes
  12751. } else {
  12752. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12753. // Deserialize a standard representation
  12754. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12755. wrap = wrapMap[ tag ] || wrapMap._default;
  12756. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12757. // Descend through wrappers to the right content
  12758. j = wrap[ 0 ];
  12759. while ( j-- ) {
  12760. tmp = tmp.lastChild;
  12761. }
  12762. // Support: Android <=4.0 only, PhantomJS 1 only
  12763. // push.apply(_, arraylike) throws on ancient WebKit
  12764. jQuery.merge( nodes, tmp.childNodes );
  12765. // Remember the top-level container
  12766. tmp = fragment.firstChild;
  12767. // Ensure the created nodes are orphaned (#12392)
  12768. tmp.textContent = "";
  12769. }
  12770. }
  12771. }
  12772. // Remove wrapper from fragment
  12773. fragment.textContent = "";
  12774. i = 0;
  12775. while ( ( elem = nodes[ i++ ] ) ) {
  12776. // Skip elements already in the context collection (trac-4087)
  12777. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12778. if ( ignored ) {
  12779. ignored.push( elem );
  12780. }
  12781. continue;
  12782. }
  12783. attached = isAttached( elem );
  12784. // Append to fragment
  12785. tmp = getAll( fragment.appendChild( elem ), "script" );
  12786. // Preserve script evaluation history
  12787. if ( attached ) {
  12788. setGlobalEval( tmp );
  12789. }
  12790. // Capture executables
  12791. if ( scripts ) {
  12792. j = 0;
  12793. while ( ( elem = tmp[ j++ ] ) ) {
  12794. if ( rscriptType.test( elem.type || "" ) ) {
  12795. scripts.push( elem );
  12796. }
  12797. }
  12798. }
  12799. }
  12800. return fragment;
  12801. }
  12802. ( function() {
  12803. var fragment = document.createDocumentFragment(),
  12804. div = fragment.appendChild( document.createElement( "div" ) ),
  12805. input = document.createElement( "input" );
  12806. // Support: Android 4.0 - 4.3 only
  12807. // Check state lost if the name is set (#11217)
  12808. // Support: Windows Web Apps (WWA)
  12809. // `name` and `type` must use .setAttribute for WWA (#14901)
  12810. input.setAttribute( "type", "radio" );
  12811. input.setAttribute( "checked", "checked" );
  12812. input.setAttribute( "name", "t" );
  12813. div.appendChild( input );
  12814. // Support: Android <=4.1 only
  12815. // Older WebKit doesn't clone checked state correctly in fragments
  12816. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12817. // Support: IE <=11 only
  12818. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12819. div.innerHTML = "<textarea>x</textarea>";
  12820. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12821. } )();
  12822. var
  12823. rkeyEvent = /^key/,
  12824. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12825. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12826. function returnTrue() {
  12827. return true;
  12828. }
  12829. function returnFalse() {
  12830. return false;
  12831. }
  12832. // Support: IE <=9 - 11+
  12833. // focus() and blur() are asynchronous, except when they are no-op.
  12834. // So expect focus to be synchronous when the element is already active,
  12835. // and blur to be synchronous when the element is not already active.
  12836. // (focus and blur are always synchronous in other supported browsers,
  12837. // this just defines when we can count on it).
  12838. function expectSync( elem, type ) {
  12839. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12840. }
  12841. // Support: IE <=9 only
  12842. // Accessing document.activeElement can throw unexpectedly
  12843. // https://bugs.jquery.com/ticket/13393
  12844. function safeActiveElement() {
  12845. try {
  12846. return document.activeElement;
  12847. } catch ( err ) { }
  12848. }
  12849. function on( elem, types, selector, data, fn, one ) {
  12850. var origFn, type;
  12851. // Types can be a map of types/handlers
  12852. if ( typeof types === "object" ) {
  12853. // ( types-Object, selector, data )
  12854. if ( typeof selector !== "string" ) {
  12855. // ( types-Object, data )
  12856. data = data || selector;
  12857. selector = undefined;
  12858. }
  12859. for ( type in types ) {
  12860. on( elem, type, selector, data, types[ type ], one );
  12861. }
  12862. return elem;
  12863. }
  12864. if ( data == null && fn == null ) {
  12865. // ( types, fn )
  12866. fn = selector;
  12867. data = selector = undefined;
  12868. } else if ( fn == null ) {
  12869. if ( typeof selector === "string" ) {
  12870. // ( types, selector, fn )
  12871. fn = data;
  12872. data = undefined;
  12873. } else {
  12874. // ( types, data, fn )
  12875. fn = data;
  12876. data = selector;
  12877. selector = undefined;
  12878. }
  12879. }
  12880. if ( fn === false ) {
  12881. fn = returnFalse;
  12882. } else if ( !fn ) {
  12883. return elem;
  12884. }
  12885. if ( one === 1 ) {
  12886. origFn = fn;
  12887. fn = function( event ) {
  12888. // Can use an empty set, since event contains the info
  12889. jQuery().off( event );
  12890. return origFn.apply( this, arguments );
  12891. };
  12892. // Use same guid so caller can remove using origFn
  12893. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12894. }
  12895. return elem.each( function() {
  12896. jQuery.event.add( this, types, fn, data, selector );
  12897. } );
  12898. }
  12899. /*
  12900. * Helper functions for managing events -- not part of the public interface.
  12901. * Props to Dean Edwards' addEvent library for many of the ideas.
  12902. */
  12903. jQuery.event = {
  12904. global: {},
  12905. add: function( elem, types, handler, data, selector ) {
  12906. var handleObjIn, eventHandle, tmp,
  12907. events, t, handleObj,
  12908. special, handlers, type, namespaces, origType,
  12909. elemData = dataPriv.get( elem );
  12910. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12911. if ( !elemData ) {
  12912. return;
  12913. }
  12914. // Caller can pass in an object of custom data in lieu of the handler
  12915. if ( handler.handler ) {
  12916. handleObjIn = handler;
  12917. handler = handleObjIn.handler;
  12918. selector = handleObjIn.selector;
  12919. }
  12920. // Ensure that invalid selectors throw exceptions at attach time
  12921. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12922. if ( selector ) {
  12923. jQuery.find.matchesSelector( documentElement, selector );
  12924. }
  12925. // Make sure that the handler has a unique ID, used to find/remove it later
  12926. if ( !handler.guid ) {
  12927. handler.guid = jQuery.guid++;
  12928. }
  12929. // Init the element's event structure and main handler, if this is the first
  12930. if ( !( events = elemData.events ) ) {
  12931. events = elemData.events = {};
  12932. }
  12933. if ( !( eventHandle = elemData.handle ) ) {
  12934. eventHandle = elemData.handle = function( e ) {
  12935. // Discard the second event of a jQuery.event.trigger() and
  12936. // when an event is called after a page has unloaded
  12937. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12938. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12939. };
  12940. }
  12941. // Handle multiple events separated by a space
  12942. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12943. t = types.length;
  12944. while ( t-- ) {
  12945. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12946. type = origType = tmp[ 1 ];
  12947. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12948. // There *must* be a type, no attaching namespace-only handlers
  12949. if ( !type ) {
  12950. continue;
  12951. }
  12952. // If event changes its type, use the special event handlers for the changed type
  12953. special = jQuery.event.special[ type ] || {};
  12954. // If selector defined, determine special event api type, otherwise given type
  12955. type = ( selector ? special.delegateType : special.bindType ) || type;
  12956. // Update special based on newly reset type
  12957. special = jQuery.event.special[ type ] || {};
  12958. // handleObj is passed to all event handlers
  12959. handleObj = jQuery.extend( {
  12960. type: type,
  12961. origType: origType,
  12962. data: data,
  12963. handler: handler,
  12964. guid: handler.guid,
  12965. selector: selector,
  12966. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12967. namespace: namespaces.join( "." )
  12968. }, handleObjIn );
  12969. // Init the event handler queue if we're the first
  12970. if ( !( handlers = events[ type ] ) ) {
  12971. handlers = events[ type ] = [];
  12972. handlers.delegateCount = 0;
  12973. // Only use addEventListener if the special events handler returns false
  12974. if ( !special.setup ||
  12975. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12976. if ( elem.addEventListener ) {
  12977. elem.addEventListener( type, eventHandle );
  12978. }
  12979. }
  12980. }
  12981. if ( special.add ) {
  12982. special.add.call( elem, handleObj );
  12983. if ( !handleObj.handler.guid ) {
  12984. handleObj.handler.guid = handler.guid;
  12985. }
  12986. }
  12987. // Add to the element's handler list, delegates in front
  12988. if ( selector ) {
  12989. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12990. } else {
  12991. handlers.push( handleObj );
  12992. }
  12993. // Keep track of which events have ever been used, for event optimization
  12994. jQuery.event.global[ type ] = true;
  12995. }
  12996. },
  12997. // Detach an event or set of events from an element
  12998. remove: function( elem, types, handler, selector, mappedTypes ) {
  12999. var j, origCount, tmp,
  13000. events, t, handleObj,
  13001. special, handlers, type, namespaces, origType,
  13002. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13003. if ( !elemData || !( events = elemData.events ) ) {
  13004. return;
  13005. }
  13006. // Once for each type.namespace in types; type may be omitted
  13007. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13008. t = types.length;
  13009. while ( t-- ) {
  13010. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13011. type = origType = tmp[ 1 ];
  13012. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13013. // Unbind all events (on this namespace, if provided) for the element
  13014. if ( !type ) {
  13015. for ( type in events ) {
  13016. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13017. }
  13018. continue;
  13019. }
  13020. special = jQuery.event.special[ type ] || {};
  13021. type = ( selector ? special.delegateType : special.bindType ) || type;
  13022. handlers = events[ type ] || [];
  13023. tmp = tmp[ 2 ] &&
  13024. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13025. // Remove matching events
  13026. origCount = j = handlers.length;
  13027. while ( j-- ) {
  13028. handleObj = handlers[ j ];
  13029. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13030. ( !handler || handler.guid === handleObj.guid ) &&
  13031. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13032. ( !selector || selector === handleObj.selector ||
  13033. selector === "**" && handleObj.selector ) ) {
  13034. handlers.splice( j, 1 );
  13035. if ( handleObj.selector ) {
  13036. handlers.delegateCount--;
  13037. }
  13038. if ( special.remove ) {
  13039. special.remove.call( elem, handleObj );
  13040. }
  13041. }
  13042. }
  13043. // Remove generic event handler if we removed something and no more handlers exist
  13044. // (avoids potential for endless recursion during removal of special event handlers)
  13045. if ( origCount && !handlers.length ) {
  13046. if ( !special.teardown ||
  13047. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13048. jQuery.removeEvent( elem, type, elemData.handle );
  13049. }
  13050. delete events[ type ];
  13051. }
  13052. }
  13053. // Remove data and the expando if it's no longer used
  13054. if ( jQuery.isEmptyObject( events ) ) {
  13055. dataPriv.remove( elem, "handle events" );
  13056. }
  13057. },
  13058. dispatch: function( nativeEvent ) {
  13059. // Make a writable jQuery.Event from the native event object
  13060. var event = jQuery.event.fix( nativeEvent );
  13061. var i, j, ret, matched, handleObj, handlerQueue,
  13062. args = new Array( arguments.length ),
  13063. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13064. special = jQuery.event.special[ event.type ] || {};
  13065. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13066. args[ 0 ] = event;
  13067. for ( i = 1; i < arguments.length; i++ ) {
  13068. args[ i ] = arguments[ i ];
  13069. }
  13070. event.delegateTarget = this;
  13071. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13072. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13073. return;
  13074. }
  13075. // Determine handlers
  13076. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13077. // Run delegates first; they may want to stop propagation beneath us
  13078. i = 0;
  13079. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13080. event.currentTarget = matched.elem;
  13081. j = 0;
  13082. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13083. !event.isImmediatePropagationStopped() ) {
  13084. // If the event is namespaced, then each handler is only invoked if it is
  13085. // specially universal or its namespaces are a superset of the event's.
  13086. if ( !event.rnamespace || handleObj.namespace === false ||
  13087. event.rnamespace.test( handleObj.namespace ) ) {
  13088. event.handleObj = handleObj;
  13089. event.data = handleObj.data;
  13090. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13091. handleObj.handler ).apply( matched.elem, args );
  13092. if ( ret !== undefined ) {
  13093. if ( ( event.result = ret ) === false ) {
  13094. event.preventDefault();
  13095. event.stopPropagation();
  13096. }
  13097. }
  13098. }
  13099. }
  13100. }
  13101. // Call the postDispatch hook for the mapped type
  13102. if ( special.postDispatch ) {
  13103. special.postDispatch.call( this, event );
  13104. }
  13105. return event.result;
  13106. },
  13107. handlers: function( event, handlers ) {
  13108. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13109. handlerQueue = [],
  13110. delegateCount = handlers.delegateCount,
  13111. cur = event.target;
  13112. // Find delegate handlers
  13113. if ( delegateCount &&
  13114. // Support: IE <=9
  13115. // Black-hole SVG <use> instance trees (trac-13180)
  13116. cur.nodeType &&
  13117. // Support: Firefox <=42
  13118. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13119. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13120. // Support: IE 11 only
  13121. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13122. !( event.type === "click" && event.button >= 1 ) ) {
  13123. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13124. // Don't check non-elements (#13208)
  13125. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13126. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13127. matchedHandlers = [];
  13128. matchedSelectors = {};
  13129. for ( i = 0; i < delegateCount; i++ ) {
  13130. handleObj = handlers[ i ];
  13131. // Don't conflict with Object.prototype properties (#13203)
  13132. sel = handleObj.selector + " ";
  13133. if ( matchedSelectors[ sel ] === undefined ) {
  13134. matchedSelectors[ sel ] = handleObj.needsContext ?
  13135. jQuery( sel, this ).index( cur ) > -1 :
  13136. jQuery.find( sel, this, null, [ cur ] ).length;
  13137. }
  13138. if ( matchedSelectors[ sel ] ) {
  13139. matchedHandlers.push( handleObj );
  13140. }
  13141. }
  13142. if ( matchedHandlers.length ) {
  13143. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13144. }
  13145. }
  13146. }
  13147. }
  13148. // Add the remaining (directly-bound) handlers
  13149. cur = this;
  13150. if ( delegateCount < handlers.length ) {
  13151. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13152. }
  13153. return handlerQueue;
  13154. },
  13155. addProp: function( name, hook ) {
  13156. Object.defineProperty( jQuery.Event.prototype, name, {
  13157. enumerable: true,
  13158. configurable: true,
  13159. get: isFunction( hook ) ?
  13160. function() {
  13161. if ( this.originalEvent ) {
  13162. return hook( this.originalEvent );
  13163. }
  13164. } :
  13165. function() {
  13166. if ( this.originalEvent ) {
  13167. return this.originalEvent[ name ];
  13168. }
  13169. },
  13170. set: function( value ) {
  13171. Object.defineProperty( this, name, {
  13172. enumerable: true,
  13173. configurable: true,
  13174. writable: true,
  13175. value: value
  13176. } );
  13177. }
  13178. } );
  13179. },
  13180. fix: function( originalEvent ) {
  13181. return originalEvent[ jQuery.expando ] ?
  13182. originalEvent :
  13183. new jQuery.Event( originalEvent );
  13184. },
  13185. special: {
  13186. load: {
  13187. // Prevent triggered image.load events from bubbling to window.load
  13188. noBubble: true
  13189. },
  13190. click: {
  13191. // Utilize native event to ensure correct state for checkable inputs
  13192. setup: function( data ) {
  13193. // For mutual compressibility with _default, replace `this` access with a local var.
  13194. // `|| data` is dead code meant only to preserve the variable through minification.
  13195. var el = this || data;
  13196. // Claim the first handler
  13197. if ( rcheckableType.test( el.type ) &&
  13198. el.click && nodeName( el, "input" ) ) {
  13199. // dataPriv.set( el, "click", ... )
  13200. leverageNative( el, "click", returnTrue );
  13201. }
  13202. // Return false to allow normal processing in the caller
  13203. return false;
  13204. },
  13205. trigger: function( data ) {
  13206. // For mutual compressibility with _default, replace `this` access with a local var.
  13207. // `|| data` is dead code meant only to preserve the variable through minification.
  13208. var el = this || data;
  13209. // Force setup before triggering a click
  13210. if ( rcheckableType.test( el.type ) &&
  13211. el.click && nodeName( el, "input" ) ) {
  13212. leverageNative( el, "click" );
  13213. }
  13214. // Return non-false to allow normal event-path propagation
  13215. return true;
  13216. },
  13217. // For cross-browser consistency, suppress native .click() on links
  13218. // Also prevent it if we're currently inside a leveraged native-event stack
  13219. _default: function( event ) {
  13220. var target = event.target;
  13221. return rcheckableType.test( target.type ) &&
  13222. target.click && nodeName( target, "input" ) &&
  13223. dataPriv.get( target, "click" ) ||
  13224. nodeName( target, "a" );
  13225. }
  13226. },
  13227. beforeunload: {
  13228. postDispatch: function( event ) {
  13229. // Support: Firefox 20+
  13230. // Firefox doesn't alert if the returnValue field is not set.
  13231. if ( event.result !== undefined && event.originalEvent ) {
  13232. event.originalEvent.returnValue = event.result;
  13233. }
  13234. }
  13235. }
  13236. }
  13237. };
  13238. // Ensure the presence of an event listener that handles manually-triggered
  13239. // synthetic events by interrupting progress until reinvoked in response to
  13240. // *native* events that it fires directly, ensuring that state changes have
  13241. // already occurred before other listeners are invoked.
  13242. function leverageNative( el, type, expectSync ) {
  13243. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13244. if ( !expectSync ) {
  13245. if ( dataPriv.get( el, type ) === undefined ) {
  13246. jQuery.event.add( el, type, returnTrue );
  13247. }
  13248. return;
  13249. }
  13250. // Register the controller as a special universal handler for all event namespaces
  13251. dataPriv.set( el, type, false );
  13252. jQuery.event.add( el, type, {
  13253. namespace: false,
  13254. handler: function( event ) {
  13255. var notAsync, result,
  13256. saved = dataPriv.get( this, type );
  13257. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13258. // Interrupt processing of the outer synthetic .trigger()ed event
  13259. // Saved data should be false in such cases, but might be a leftover capture object
  13260. // from an async native handler (gh-4350)
  13261. if ( !saved.length ) {
  13262. // Store arguments for use when handling the inner native event
  13263. // There will always be at least one argument (an event object), so this array
  13264. // will not be confused with a leftover capture object.
  13265. saved = slice.call( arguments );
  13266. dataPriv.set( this, type, saved );
  13267. // Trigger the native event and capture its result
  13268. // Support: IE <=9 - 11+
  13269. // focus() and blur() are asynchronous
  13270. notAsync = expectSync( this, type );
  13271. this[ type ]();
  13272. result = dataPriv.get( this, type );
  13273. if ( saved !== result || notAsync ) {
  13274. dataPriv.set( this, type, false );
  13275. } else {
  13276. result = {};
  13277. }
  13278. if ( saved !== result ) {
  13279. // Cancel the outer synthetic event
  13280. event.stopImmediatePropagation();
  13281. event.preventDefault();
  13282. return result.value;
  13283. }
  13284. // If this is an inner synthetic event for an event with a bubbling surrogate
  13285. // (focus or blur), assume that the surrogate already propagated from triggering the
  13286. // native event and prevent that from happening again here.
  13287. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13288. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13289. // less bad than duplication.
  13290. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13291. event.stopPropagation();
  13292. }
  13293. // If this is a native event triggered above, everything is now in order
  13294. // Fire an inner synthetic event with the original arguments
  13295. } else if ( saved.length ) {
  13296. // ...and capture the result
  13297. dataPriv.set( this, type, {
  13298. value: jQuery.event.trigger(
  13299. // Support: IE <=9 - 11+
  13300. // Extend with the prototype to reset the above stopImmediatePropagation()
  13301. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13302. saved.slice( 1 ),
  13303. this
  13304. )
  13305. } );
  13306. // Abort handling of the native event
  13307. event.stopImmediatePropagation();
  13308. }
  13309. }
  13310. } );
  13311. }
  13312. jQuery.removeEvent = function( elem, type, handle ) {
  13313. // This "if" is needed for plain objects
  13314. if ( elem.removeEventListener ) {
  13315. elem.removeEventListener( type, handle );
  13316. }
  13317. };
  13318. jQuery.Event = function( src, props ) {
  13319. // Allow instantiation without the 'new' keyword
  13320. if ( !( this instanceof jQuery.Event ) ) {
  13321. return new jQuery.Event( src, props );
  13322. }
  13323. // Event object
  13324. if ( src && src.type ) {
  13325. this.originalEvent = src;
  13326. this.type = src.type;
  13327. // Events bubbling up the document may have been marked as prevented
  13328. // by a handler lower down the tree; reflect the correct value.
  13329. this.isDefaultPrevented = src.defaultPrevented ||
  13330. src.defaultPrevented === undefined &&
  13331. // Support: Android <=2.3 only
  13332. src.returnValue === false ?
  13333. returnTrue :
  13334. returnFalse;
  13335. // Create target properties
  13336. // Support: Safari <=6 - 7 only
  13337. // Target should not be a text node (#504, #13143)
  13338. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13339. src.target.parentNode :
  13340. src.target;
  13341. this.currentTarget = src.currentTarget;
  13342. this.relatedTarget = src.relatedTarget;
  13343. // Event type
  13344. } else {
  13345. this.type = src;
  13346. }
  13347. // Put explicitly provided properties onto the event object
  13348. if ( props ) {
  13349. jQuery.extend( this, props );
  13350. }
  13351. // Create a timestamp if incoming event doesn't have one
  13352. this.timeStamp = src && src.timeStamp || Date.now();
  13353. // Mark it as fixed
  13354. this[ jQuery.expando ] = true;
  13355. };
  13356. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13357. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13358. jQuery.Event.prototype = {
  13359. constructor: jQuery.Event,
  13360. isDefaultPrevented: returnFalse,
  13361. isPropagationStopped: returnFalse,
  13362. isImmediatePropagationStopped: returnFalse,
  13363. isSimulated: false,
  13364. preventDefault: function() {
  13365. var e = this.originalEvent;
  13366. this.isDefaultPrevented = returnTrue;
  13367. if ( e && !this.isSimulated ) {
  13368. e.preventDefault();
  13369. }
  13370. },
  13371. stopPropagation: function() {
  13372. var e = this.originalEvent;
  13373. this.isPropagationStopped = returnTrue;
  13374. if ( e && !this.isSimulated ) {
  13375. e.stopPropagation();
  13376. }
  13377. },
  13378. stopImmediatePropagation: function() {
  13379. var e = this.originalEvent;
  13380. this.isImmediatePropagationStopped = returnTrue;
  13381. if ( e && !this.isSimulated ) {
  13382. e.stopImmediatePropagation();
  13383. }
  13384. this.stopPropagation();
  13385. }
  13386. };
  13387. // Includes all common event props including KeyEvent and MouseEvent specific props
  13388. jQuery.each( {
  13389. altKey: true,
  13390. bubbles: true,
  13391. cancelable: true,
  13392. changedTouches: true,
  13393. ctrlKey: true,
  13394. detail: true,
  13395. eventPhase: true,
  13396. metaKey: true,
  13397. pageX: true,
  13398. pageY: true,
  13399. shiftKey: true,
  13400. view: true,
  13401. "char": true,
  13402. code: true,
  13403. charCode: true,
  13404. key: true,
  13405. keyCode: true,
  13406. button: true,
  13407. buttons: true,
  13408. clientX: true,
  13409. clientY: true,
  13410. offsetX: true,
  13411. offsetY: true,
  13412. pointerId: true,
  13413. pointerType: true,
  13414. screenX: true,
  13415. screenY: true,
  13416. targetTouches: true,
  13417. toElement: true,
  13418. touches: true,
  13419. which: function( event ) {
  13420. var button = event.button;
  13421. // Add which for key events
  13422. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13423. return event.charCode != null ? event.charCode : event.keyCode;
  13424. }
  13425. // Add which for click: 1 === left; 2 === middle; 3 === right
  13426. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13427. if ( button & 1 ) {
  13428. return 1;
  13429. }
  13430. if ( button & 2 ) {
  13431. return 3;
  13432. }
  13433. if ( button & 4 ) {
  13434. return 2;
  13435. }
  13436. return 0;
  13437. }
  13438. return event.which;
  13439. }
  13440. }, jQuery.event.addProp );
  13441. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13442. jQuery.event.special[ type ] = {
  13443. // Utilize native event if possible so blur/focus sequence is correct
  13444. setup: function() {
  13445. // Claim the first handler
  13446. // dataPriv.set( this, "focus", ... )
  13447. // dataPriv.set( this, "blur", ... )
  13448. leverageNative( this, type, expectSync );
  13449. // Return false to allow normal processing in the caller
  13450. return false;
  13451. },
  13452. trigger: function() {
  13453. // Force setup before trigger
  13454. leverageNative( this, type );
  13455. // Return non-false to allow normal event-path propagation
  13456. return true;
  13457. },
  13458. delegateType: delegateType
  13459. };
  13460. } );
  13461. // Create mouseenter/leave events using mouseover/out and event-time checks
  13462. // so that event delegation works in jQuery.
  13463. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13464. //
  13465. // Support: Safari 7 only
  13466. // Safari sends mouseenter too often; see:
  13467. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13468. // for the description of the bug (it existed in older Chrome versions as well).
  13469. jQuery.each( {
  13470. mouseenter: "mouseover",
  13471. mouseleave: "mouseout",
  13472. pointerenter: "pointerover",
  13473. pointerleave: "pointerout"
  13474. }, function( orig, fix ) {
  13475. jQuery.event.special[ orig ] = {
  13476. delegateType: fix,
  13477. bindType: fix,
  13478. handle: function( event ) {
  13479. var ret,
  13480. target = this,
  13481. related = event.relatedTarget,
  13482. handleObj = event.handleObj;
  13483. // For mouseenter/leave call the handler if related is outside the target.
  13484. // NB: No relatedTarget if the mouse left/entered the browser window
  13485. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13486. event.type = handleObj.origType;
  13487. ret = handleObj.handler.apply( this, arguments );
  13488. event.type = fix;
  13489. }
  13490. return ret;
  13491. }
  13492. };
  13493. } );
  13494. jQuery.fn.extend( {
  13495. on: function( types, selector, data, fn ) {
  13496. return on( this, types, selector, data, fn );
  13497. },
  13498. one: function( types, selector, data, fn ) {
  13499. return on( this, types, selector, data, fn, 1 );
  13500. },
  13501. off: function( types, selector, fn ) {
  13502. var handleObj, type;
  13503. if ( types && types.preventDefault && types.handleObj ) {
  13504. // ( event ) dispatched jQuery.Event
  13505. handleObj = types.handleObj;
  13506. jQuery( types.delegateTarget ).off(
  13507. handleObj.namespace ?
  13508. handleObj.origType + "." + handleObj.namespace :
  13509. handleObj.origType,
  13510. handleObj.selector,
  13511. handleObj.handler
  13512. );
  13513. return this;
  13514. }
  13515. if ( typeof types === "object" ) {
  13516. // ( types-object [, selector] )
  13517. for ( type in types ) {
  13518. this.off( type, selector, types[ type ] );
  13519. }
  13520. return this;
  13521. }
  13522. if ( selector === false || typeof selector === "function" ) {
  13523. // ( types [, fn] )
  13524. fn = selector;
  13525. selector = undefined;
  13526. }
  13527. if ( fn === false ) {
  13528. fn = returnFalse;
  13529. }
  13530. return this.each( function() {
  13531. jQuery.event.remove( this, types, fn, selector );
  13532. } );
  13533. }
  13534. } );
  13535. var
  13536. /* eslint-disable max-len */
  13537. // See https://github.com/eslint/eslint/issues/3229
  13538. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13539. /* eslint-enable */
  13540. // Support: IE <=10 - 11, Edge 12 - 13 only
  13541. // In IE/Edge using regex groups here causes severe slowdowns.
  13542. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13543. rnoInnerhtml = /<script|<style|<link/i,
  13544. // checked="checked" or checked
  13545. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13546. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13547. // Prefer a tbody over its parent table for containing new rows
  13548. function manipulationTarget( elem, content ) {
  13549. if ( nodeName( elem, "table" ) &&
  13550. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13551. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13552. }
  13553. return elem;
  13554. }
  13555. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13556. function disableScript( elem ) {
  13557. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13558. return elem;
  13559. }
  13560. function restoreScript( elem ) {
  13561. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13562. elem.type = elem.type.slice( 5 );
  13563. } else {
  13564. elem.removeAttribute( "type" );
  13565. }
  13566. return elem;
  13567. }
  13568. function cloneCopyEvent( src, dest ) {
  13569. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13570. if ( dest.nodeType !== 1 ) {
  13571. return;
  13572. }
  13573. // 1. Copy private data: events, handlers, etc.
  13574. if ( dataPriv.hasData( src ) ) {
  13575. pdataOld = dataPriv.access( src );
  13576. pdataCur = dataPriv.set( dest, pdataOld );
  13577. events = pdataOld.events;
  13578. if ( events ) {
  13579. delete pdataCur.handle;
  13580. pdataCur.events = {};
  13581. for ( type in events ) {
  13582. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13583. jQuery.event.add( dest, type, events[ type ][ i ] );
  13584. }
  13585. }
  13586. }
  13587. }
  13588. // 2. Copy user data
  13589. if ( dataUser.hasData( src ) ) {
  13590. udataOld = dataUser.access( src );
  13591. udataCur = jQuery.extend( {}, udataOld );
  13592. dataUser.set( dest, udataCur );
  13593. }
  13594. }
  13595. // Fix IE bugs, see support tests
  13596. function fixInput( src, dest ) {
  13597. var nodeName = dest.nodeName.toLowerCase();
  13598. // Fails to persist the checked state of a cloned checkbox or radio button.
  13599. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13600. dest.checked = src.checked;
  13601. // Fails to return the selected option to the default selected state when cloning options
  13602. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13603. dest.defaultValue = src.defaultValue;
  13604. }
  13605. }
  13606. function domManip( collection, args, callback, ignored ) {
  13607. // Flatten any nested arrays
  13608. args = concat.apply( [], args );
  13609. var fragment, first, scripts, hasScripts, node, doc,
  13610. i = 0,
  13611. l = collection.length,
  13612. iNoClone = l - 1,
  13613. value = args[ 0 ],
  13614. valueIsFunction = isFunction( value );
  13615. // We can't cloneNode fragments that contain checked, in WebKit
  13616. if ( valueIsFunction ||
  13617. ( l > 1 && typeof value === "string" &&
  13618. !support.checkClone && rchecked.test( value ) ) ) {
  13619. return collection.each( function( index ) {
  13620. var self = collection.eq( index );
  13621. if ( valueIsFunction ) {
  13622. args[ 0 ] = value.call( this, index, self.html() );
  13623. }
  13624. domManip( self, args, callback, ignored );
  13625. } );
  13626. }
  13627. if ( l ) {
  13628. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13629. first = fragment.firstChild;
  13630. if ( fragment.childNodes.length === 1 ) {
  13631. fragment = first;
  13632. }
  13633. // Require either new content or an interest in ignored elements to invoke the callback
  13634. if ( first || ignored ) {
  13635. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13636. hasScripts = scripts.length;
  13637. // Use the original fragment for the last item
  13638. // instead of the first because it can end up
  13639. // being emptied incorrectly in certain situations (#8070).
  13640. for ( ; i < l; i++ ) {
  13641. node = fragment;
  13642. if ( i !== iNoClone ) {
  13643. node = jQuery.clone( node, true, true );
  13644. // Keep references to cloned scripts for later restoration
  13645. if ( hasScripts ) {
  13646. // Support: Android <=4.0 only, PhantomJS 1 only
  13647. // push.apply(_, arraylike) throws on ancient WebKit
  13648. jQuery.merge( scripts, getAll( node, "script" ) );
  13649. }
  13650. }
  13651. callback.call( collection[ i ], node, i );
  13652. }
  13653. if ( hasScripts ) {
  13654. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13655. // Reenable scripts
  13656. jQuery.map( scripts, restoreScript );
  13657. // Evaluate executable scripts on first document insertion
  13658. for ( i = 0; i < hasScripts; i++ ) {
  13659. node = scripts[ i ];
  13660. if ( rscriptType.test( node.type || "" ) &&
  13661. !dataPriv.access( node, "globalEval" ) &&
  13662. jQuery.contains( doc, node ) ) {
  13663. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13664. // Optional AJAX dependency, but won't run scripts if not present
  13665. if ( jQuery._evalUrl && !node.noModule ) {
  13666. jQuery._evalUrl( node.src, {
  13667. nonce: node.nonce || node.getAttribute( "nonce" )
  13668. } );
  13669. }
  13670. } else {
  13671. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13672. }
  13673. }
  13674. }
  13675. }
  13676. }
  13677. }
  13678. return collection;
  13679. }
  13680. function remove( elem, selector, keepData ) {
  13681. var node,
  13682. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13683. i = 0;
  13684. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13685. if ( !keepData && node.nodeType === 1 ) {
  13686. jQuery.cleanData( getAll( node ) );
  13687. }
  13688. if ( node.parentNode ) {
  13689. if ( keepData && isAttached( node ) ) {
  13690. setGlobalEval( getAll( node, "script" ) );
  13691. }
  13692. node.parentNode.removeChild( node );
  13693. }
  13694. }
  13695. return elem;
  13696. }
  13697. jQuery.extend( {
  13698. htmlPrefilter: function( html ) {
  13699. return html.replace( rxhtmlTag, "<$1></$2>" );
  13700. },
  13701. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13702. var i, l, srcElements, destElements,
  13703. clone = elem.cloneNode( true ),
  13704. inPage = isAttached( elem );
  13705. // Fix IE cloning issues
  13706. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13707. !jQuery.isXMLDoc( elem ) ) {
  13708. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13709. destElements = getAll( clone );
  13710. srcElements = getAll( elem );
  13711. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13712. fixInput( srcElements[ i ], destElements[ i ] );
  13713. }
  13714. }
  13715. // Copy the events from the original to the clone
  13716. if ( dataAndEvents ) {
  13717. if ( deepDataAndEvents ) {
  13718. srcElements = srcElements || getAll( elem );
  13719. destElements = destElements || getAll( clone );
  13720. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13721. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13722. }
  13723. } else {
  13724. cloneCopyEvent( elem, clone );
  13725. }
  13726. }
  13727. // Preserve script evaluation history
  13728. destElements = getAll( clone, "script" );
  13729. if ( destElements.length > 0 ) {
  13730. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13731. }
  13732. // Return the cloned set
  13733. return clone;
  13734. },
  13735. cleanData: function( elems ) {
  13736. var data, elem, type,
  13737. special = jQuery.event.special,
  13738. i = 0;
  13739. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13740. if ( acceptData( elem ) ) {
  13741. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13742. if ( data.events ) {
  13743. for ( type in data.events ) {
  13744. if ( special[ type ] ) {
  13745. jQuery.event.remove( elem, type );
  13746. // This is a shortcut to avoid jQuery.event.remove's overhead
  13747. } else {
  13748. jQuery.removeEvent( elem, type, data.handle );
  13749. }
  13750. }
  13751. }
  13752. // Support: Chrome <=35 - 45+
  13753. // Assign undefined instead of using delete, see Data#remove
  13754. elem[ dataPriv.expando ] = undefined;
  13755. }
  13756. if ( elem[ dataUser.expando ] ) {
  13757. // Support: Chrome <=35 - 45+
  13758. // Assign undefined instead of using delete, see Data#remove
  13759. elem[ dataUser.expando ] = undefined;
  13760. }
  13761. }
  13762. }
  13763. }
  13764. } );
  13765. jQuery.fn.extend( {
  13766. detach: function( selector ) {
  13767. return remove( this, selector, true );
  13768. },
  13769. remove: function( selector ) {
  13770. return remove( this, selector );
  13771. },
  13772. text: function( value ) {
  13773. return access( this, function( value ) {
  13774. return value === undefined ?
  13775. jQuery.text( this ) :
  13776. this.empty().each( function() {
  13777. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13778. this.textContent = value;
  13779. }
  13780. } );
  13781. }, null, value, arguments.length );
  13782. },
  13783. append: function() {
  13784. return domManip( this, arguments, function( elem ) {
  13785. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13786. var target = manipulationTarget( this, elem );
  13787. target.appendChild( elem );
  13788. }
  13789. } );
  13790. },
  13791. prepend: function() {
  13792. return domManip( this, arguments, function( elem ) {
  13793. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13794. var target = manipulationTarget( this, elem );
  13795. target.insertBefore( elem, target.firstChild );
  13796. }
  13797. } );
  13798. },
  13799. before: function() {
  13800. return domManip( this, arguments, function( elem ) {
  13801. if ( this.parentNode ) {
  13802. this.parentNode.insertBefore( elem, this );
  13803. }
  13804. } );
  13805. },
  13806. after: function() {
  13807. return domManip( this, arguments, function( elem ) {
  13808. if ( this.parentNode ) {
  13809. this.parentNode.insertBefore( elem, this.nextSibling );
  13810. }
  13811. } );
  13812. },
  13813. empty: function() {
  13814. var elem,
  13815. i = 0;
  13816. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13817. if ( elem.nodeType === 1 ) {
  13818. // Prevent memory leaks
  13819. jQuery.cleanData( getAll( elem, false ) );
  13820. // Remove any remaining nodes
  13821. elem.textContent = "";
  13822. }
  13823. }
  13824. return this;
  13825. },
  13826. clone: function( dataAndEvents, deepDataAndEvents ) {
  13827. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13828. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13829. return this.map( function() {
  13830. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13831. } );
  13832. },
  13833. html: function( value ) {
  13834. return access( this, function( value ) {
  13835. var elem = this[ 0 ] || {},
  13836. i = 0,
  13837. l = this.length;
  13838. if ( value === undefined && elem.nodeType === 1 ) {
  13839. return elem.innerHTML;
  13840. }
  13841. // See if we can take a shortcut and just use innerHTML
  13842. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13843. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13844. value = jQuery.htmlPrefilter( value );
  13845. try {
  13846. for ( ; i < l; i++ ) {
  13847. elem = this[ i ] || {};
  13848. // Remove element nodes and prevent memory leaks
  13849. if ( elem.nodeType === 1 ) {
  13850. jQuery.cleanData( getAll( elem, false ) );
  13851. elem.innerHTML = value;
  13852. }
  13853. }
  13854. elem = 0;
  13855. // If using innerHTML throws an exception, use the fallback method
  13856. } catch ( e ) {}
  13857. }
  13858. if ( elem ) {
  13859. this.empty().append( value );
  13860. }
  13861. }, null, value, arguments.length );
  13862. },
  13863. replaceWith: function() {
  13864. var ignored = [];
  13865. // Make the changes, replacing each non-ignored context element with the new content
  13866. return domManip( this, arguments, function( elem ) {
  13867. var parent = this.parentNode;
  13868. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13869. jQuery.cleanData( getAll( this ) );
  13870. if ( parent ) {
  13871. parent.replaceChild( elem, this );
  13872. }
  13873. }
  13874. // Force callback invocation
  13875. }, ignored );
  13876. }
  13877. } );
  13878. jQuery.each( {
  13879. appendTo: "append",
  13880. prependTo: "prepend",
  13881. insertBefore: "before",
  13882. insertAfter: "after",
  13883. replaceAll: "replaceWith"
  13884. }, function( name, original ) {
  13885. jQuery.fn[ name ] = function( selector ) {
  13886. var elems,
  13887. ret = [],
  13888. insert = jQuery( selector ),
  13889. last = insert.length - 1,
  13890. i = 0;
  13891. for ( ; i <= last; i++ ) {
  13892. elems = i === last ? this : this.clone( true );
  13893. jQuery( insert[ i ] )[ original ]( elems );
  13894. // Support: Android <=4.0 only, PhantomJS 1 only
  13895. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13896. push.apply( ret, elems.get() );
  13897. }
  13898. return this.pushStack( ret );
  13899. };
  13900. } );
  13901. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13902. var getStyles = function( elem ) {
  13903. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13904. // IE throws on elements created in popups
  13905. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13906. var view = elem.ownerDocument.defaultView;
  13907. if ( !view || !view.opener ) {
  13908. view = window;
  13909. }
  13910. return view.getComputedStyle( elem );
  13911. };
  13912. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13913. ( function() {
  13914. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13915. // so they're executed at the same time to save the second computation.
  13916. function computeStyleTests() {
  13917. // This is a singleton, we need to execute it only once
  13918. if ( !div ) {
  13919. return;
  13920. }
  13921. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13922. "margin-top:1px;padding:0;border:0";
  13923. div.style.cssText =
  13924. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13925. "margin:auto;border:1px;padding:1px;" +
  13926. "width:60%;top:1%";
  13927. documentElement.appendChild( container ).appendChild( div );
  13928. var divStyle = window.getComputedStyle( div );
  13929. pixelPositionVal = divStyle.top !== "1%";
  13930. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13931. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13932. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13933. // Some styles come back with percentage values, even though they shouldn't
  13934. div.style.right = "60%";
  13935. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13936. // Support: IE 9 - 11 only
  13937. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13938. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13939. // Support: IE 9 only
  13940. // Detect overflow:scroll screwiness (gh-3699)
  13941. // Support: Chrome <=64
  13942. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13943. div.style.position = "absolute";
  13944. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13945. documentElement.removeChild( container );
  13946. // Nullify the div so it wouldn't be stored in the memory and
  13947. // it will also be a sign that checks already performed
  13948. div = null;
  13949. }
  13950. function roundPixelMeasures( measure ) {
  13951. return Math.round( parseFloat( measure ) );
  13952. }
  13953. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13954. reliableMarginLeftVal,
  13955. container = document.createElement( "div" ),
  13956. div = document.createElement( "div" );
  13957. // Finish early in limited (non-browser) environments
  13958. if ( !div.style ) {
  13959. return;
  13960. }
  13961. // Support: IE <=9 - 11 only
  13962. // Style of cloned element affects source element cloned (#8908)
  13963. div.style.backgroundClip = "content-box";
  13964. div.cloneNode( true ).style.backgroundClip = "";
  13965. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13966. jQuery.extend( support, {
  13967. boxSizingReliable: function() {
  13968. computeStyleTests();
  13969. return boxSizingReliableVal;
  13970. },
  13971. pixelBoxStyles: function() {
  13972. computeStyleTests();
  13973. return pixelBoxStylesVal;
  13974. },
  13975. pixelPosition: function() {
  13976. computeStyleTests();
  13977. return pixelPositionVal;
  13978. },
  13979. reliableMarginLeft: function() {
  13980. computeStyleTests();
  13981. return reliableMarginLeftVal;
  13982. },
  13983. scrollboxSize: function() {
  13984. computeStyleTests();
  13985. return scrollboxSizeVal;
  13986. }
  13987. } );
  13988. } )();
  13989. function curCSS( elem, name, computed ) {
  13990. var width, minWidth, maxWidth, ret,
  13991. // Support: Firefox 51+
  13992. // Retrieving style before computed somehow
  13993. // fixes an issue with getting wrong values
  13994. // on detached elements
  13995. style = elem.style;
  13996. computed = computed || getStyles( elem );
  13997. // getPropertyValue is needed for:
  13998. // .css('filter') (IE 9 only, #12537)
  13999. // .css('--customProperty) (#3144)
  14000. if ( computed ) {
  14001. ret = computed.getPropertyValue( name ) || computed[ name ];
  14002. if ( ret === "" && !isAttached( elem ) ) {
  14003. ret = jQuery.style( elem, name );
  14004. }
  14005. // A tribute to the "awesome hack by Dean Edwards"
  14006. // Android Browser returns percentage for some values,
  14007. // but width seems to be reliably pixels.
  14008. // This is against the CSSOM draft spec:
  14009. // https://drafts.csswg.org/cssom/#resolved-values
  14010. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14011. // Remember the original values
  14012. width = style.width;
  14013. minWidth = style.minWidth;
  14014. maxWidth = style.maxWidth;
  14015. // Put in the new values to get a computed value out
  14016. style.minWidth = style.maxWidth = style.width = ret;
  14017. ret = computed.width;
  14018. // Revert the changed values
  14019. style.width = width;
  14020. style.minWidth = minWidth;
  14021. style.maxWidth = maxWidth;
  14022. }
  14023. }
  14024. return ret !== undefined ?
  14025. // Support: IE <=9 - 11 only
  14026. // IE returns zIndex value as an integer.
  14027. ret + "" :
  14028. ret;
  14029. }
  14030. function addGetHookIf( conditionFn, hookFn ) {
  14031. // Define the hook, we'll check on the first run if it's really needed.
  14032. return {
  14033. get: function() {
  14034. if ( conditionFn() ) {
  14035. // Hook not needed (or it's not possible to use it due
  14036. // to missing dependency), remove it.
  14037. delete this.get;
  14038. return;
  14039. }
  14040. // Hook needed; redefine it so that the support test is not executed again.
  14041. return ( this.get = hookFn ).apply( this, arguments );
  14042. }
  14043. };
  14044. }
  14045. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14046. emptyStyle = document.createElement( "div" ).style,
  14047. vendorProps = {};
  14048. // Return a vendor-prefixed property or undefined
  14049. function vendorPropName( name ) {
  14050. // Check for vendor prefixed names
  14051. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14052. i = cssPrefixes.length;
  14053. while ( i-- ) {
  14054. name = cssPrefixes[ i ] + capName;
  14055. if ( name in emptyStyle ) {
  14056. return name;
  14057. }
  14058. }
  14059. }
  14060. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14061. function finalPropName( name ) {
  14062. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14063. if ( final ) {
  14064. return final;
  14065. }
  14066. if ( name in emptyStyle ) {
  14067. return name;
  14068. }
  14069. return vendorProps[ name ] = vendorPropName( name ) || name;
  14070. }
  14071. var
  14072. // Swappable if display is none or starts with table
  14073. // except "table", "table-cell", or "table-caption"
  14074. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14075. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14076. rcustomProp = /^--/,
  14077. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14078. cssNormalTransform = {
  14079. letterSpacing: "0",
  14080. fontWeight: "400"
  14081. };
  14082. function setPositiveNumber( elem, value, subtract ) {
  14083. // Any relative (+/-) values have already been
  14084. // normalized at this point
  14085. var matches = rcssNum.exec( value );
  14086. return matches ?
  14087. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14088. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14089. value;
  14090. }
  14091. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14092. var i = dimension === "width" ? 1 : 0,
  14093. extra = 0,
  14094. delta = 0;
  14095. // Adjustment may not be necessary
  14096. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14097. return 0;
  14098. }
  14099. for ( ; i < 4; i += 2 ) {
  14100. // Both box models exclude margin
  14101. if ( box === "margin" ) {
  14102. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14103. }
  14104. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14105. if ( !isBorderBox ) {
  14106. // Add padding
  14107. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14108. // For "border" or "margin", add border
  14109. if ( box !== "padding" ) {
  14110. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14111. // But still keep track of it otherwise
  14112. } else {
  14113. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14114. }
  14115. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14116. // "padding" or "margin"
  14117. } else {
  14118. // For "content", subtract padding
  14119. if ( box === "content" ) {
  14120. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14121. }
  14122. // For "content" or "padding", subtract border
  14123. if ( box !== "margin" ) {
  14124. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14125. }
  14126. }
  14127. }
  14128. // Account for positive content-box scroll gutter when requested by providing computedVal
  14129. if ( !isBorderBox && computedVal >= 0 ) {
  14130. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14131. // Assuming integer scroll gutter, subtract the rest and round down
  14132. delta += Math.max( 0, Math.ceil(
  14133. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14134. computedVal -
  14135. delta -
  14136. extra -
  14137. 0.5
  14138. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14139. // Use an explicit zero to avoid NaN (gh-3964)
  14140. ) ) || 0;
  14141. }
  14142. return delta;
  14143. }
  14144. function getWidthOrHeight( elem, dimension, extra ) {
  14145. // Start with computed style
  14146. var styles = getStyles( elem ),
  14147. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14148. // Fake content-box until we know it's needed to know the true value.
  14149. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14150. isBorderBox = boxSizingNeeded &&
  14151. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14152. valueIsBorderBox = isBorderBox,
  14153. val = curCSS( elem, dimension, styles ),
  14154. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14155. // Support: Firefox <=54
  14156. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14157. if ( rnumnonpx.test( val ) ) {
  14158. if ( !extra ) {
  14159. return val;
  14160. }
  14161. val = "auto";
  14162. }
  14163. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14164. // This happens for inline elements with no explicit setting (gh-3571)
  14165. // Support: Android <=4.1 - 4.3 only
  14166. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14167. // Support: IE 9-11 only
  14168. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14169. // We use getClientRects() to check for hidden/disconnected.
  14170. // In those cases, the computed value can be trusted to be border-box
  14171. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14172. val === "auto" ||
  14173. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14174. elem.getClientRects().length ) {
  14175. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14176. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14177. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14178. // retrieved value as a content box dimension.
  14179. valueIsBorderBox = offsetProp in elem;
  14180. if ( valueIsBorderBox ) {
  14181. val = elem[ offsetProp ];
  14182. }
  14183. }
  14184. // Normalize "" and auto
  14185. val = parseFloat( val ) || 0;
  14186. // Adjust for the element's box model
  14187. return ( val +
  14188. boxModelAdjustment(
  14189. elem,
  14190. dimension,
  14191. extra || ( isBorderBox ? "border" : "content" ),
  14192. valueIsBorderBox,
  14193. styles,
  14194. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14195. val
  14196. )
  14197. ) + "px";
  14198. }
  14199. jQuery.extend( {
  14200. // Add in style property hooks for overriding the default
  14201. // behavior of getting and setting a style property
  14202. cssHooks: {
  14203. opacity: {
  14204. get: function( elem, computed ) {
  14205. if ( computed ) {
  14206. // We should always get a number back from opacity
  14207. var ret = curCSS( elem, "opacity" );
  14208. return ret === "" ? "1" : ret;
  14209. }
  14210. }
  14211. }
  14212. },
  14213. // Don't automatically add "px" to these possibly-unitless properties
  14214. cssNumber: {
  14215. "animationIterationCount": true,
  14216. "columnCount": true,
  14217. "fillOpacity": true,
  14218. "flexGrow": true,
  14219. "flexShrink": true,
  14220. "fontWeight": true,
  14221. "gridArea": true,
  14222. "gridColumn": true,
  14223. "gridColumnEnd": true,
  14224. "gridColumnStart": true,
  14225. "gridRow": true,
  14226. "gridRowEnd": true,
  14227. "gridRowStart": true,
  14228. "lineHeight": true,
  14229. "opacity": true,
  14230. "order": true,
  14231. "orphans": true,
  14232. "widows": true,
  14233. "zIndex": true,
  14234. "zoom": true
  14235. },
  14236. // Add in properties whose names you wish to fix before
  14237. // setting or getting the value
  14238. cssProps: {},
  14239. // Get and set the style property on a DOM Node
  14240. style: function( elem, name, value, extra ) {
  14241. // Don't set styles on text and comment nodes
  14242. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14243. return;
  14244. }
  14245. // Make sure that we're working with the right name
  14246. var ret, type, hooks,
  14247. origName = camelCase( name ),
  14248. isCustomProp = rcustomProp.test( name ),
  14249. style = elem.style;
  14250. // Make sure that we're working with the right name. We don't
  14251. // want to query the value if it is a CSS custom property
  14252. // since they are user-defined.
  14253. if ( !isCustomProp ) {
  14254. name = finalPropName( origName );
  14255. }
  14256. // Gets hook for the prefixed version, then unprefixed version
  14257. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14258. // Check if we're setting a value
  14259. if ( value !== undefined ) {
  14260. type = typeof value;
  14261. // Convert "+=" or "-=" to relative numbers (#7345)
  14262. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14263. value = adjustCSS( elem, name, ret );
  14264. // Fixes bug #9237
  14265. type = "number";
  14266. }
  14267. // Make sure that null and NaN values aren't set (#7116)
  14268. if ( value == null || value !== value ) {
  14269. return;
  14270. }
  14271. // If a number was passed in, add the unit (except for certain CSS properties)
  14272. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14273. // "px" to a few hardcoded values.
  14274. if ( type === "number" && !isCustomProp ) {
  14275. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14276. }
  14277. // background-* props affect original clone's values
  14278. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14279. style[ name ] = "inherit";
  14280. }
  14281. // If a hook was provided, use that value, otherwise just set the specified value
  14282. if ( !hooks || !( "set" in hooks ) ||
  14283. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14284. if ( isCustomProp ) {
  14285. style.setProperty( name, value );
  14286. } else {
  14287. style[ name ] = value;
  14288. }
  14289. }
  14290. } else {
  14291. // If a hook was provided get the non-computed value from there
  14292. if ( hooks && "get" in hooks &&
  14293. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14294. return ret;
  14295. }
  14296. // Otherwise just get the value from the style object
  14297. return style[ name ];
  14298. }
  14299. },
  14300. css: function( elem, name, extra, styles ) {
  14301. var val, num, hooks,
  14302. origName = camelCase( name ),
  14303. isCustomProp = rcustomProp.test( name );
  14304. // Make sure that we're working with the right name. We don't
  14305. // want to modify the value if it is a CSS custom property
  14306. // since they are user-defined.
  14307. if ( !isCustomProp ) {
  14308. name = finalPropName( origName );
  14309. }
  14310. // Try prefixed name followed by the unprefixed name
  14311. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14312. // If a hook was provided get the computed value from there
  14313. if ( hooks && "get" in hooks ) {
  14314. val = hooks.get( elem, true, extra );
  14315. }
  14316. // Otherwise, if a way to get the computed value exists, use that
  14317. if ( val === undefined ) {
  14318. val = curCSS( elem, name, styles );
  14319. }
  14320. // Convert "normal" to computed value
  14321. if ( val === "normal" && name in cssNormalTransform ) {
  14322. val = cssNormalTransform[ name ];
  14323. }
  14324. // Make numeric if forced or a qualifier was provided and val looks numeric
  14325. if ( extra === "" || extra ) {
  14326. num = parseFloat( val );
  14327. return extra === true || isFinite( num ) ? num || 0 : val;
  14328. }
  14329. return val;
  14330. }
  14331. } );
  14332. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14333. jQuery.cssHooks[ dimension ] = {
  14334. get: function( elem, computed, extra ) {
  14335. if ( computed ) {
  14336. // Certain elements can have dimension info if we invisibly show them
  14337. // but it must have a current display style that would benefit
  14338. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14339. // Support: Safari 8+
  14340. // Table columns in Safari have non-zero offsetWidth & zero
  14341. // getBoundingClientRect().width unless display is changed.
  14342. // Support: IE <=11 only
  14343. // Running getBoundingClientRect on a disconnected node
  14344. // in IE throws an error.
  14345. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14346. swap( elem, cssShow, function() {
  14347. return getWidthOrHeight( elem, dimension, extra );
  14348. } ) :
  14349. getWidthOrHeight( elem, dimension, extra );
  14350. }
  14351. },
  14352. set: function( elem, value, extra ) {
  14353. var matches,
  14354. styles = getStyles( elem ),
  14355. // Only read styles.position if the test has a chance to fail
  14356. // to avoid forcing a reflow.
  14357. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14358. styles.position === "absolute",
  14359. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14360. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14361. isBorderBox = boxSizingNeeded &&
  14362. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14363. subtract = extra ?
  14364. boxModelAdjustment(
  14365. elem,
  14366. dimension,
  14367. extra,
  14368. isBorderBox,
  14369. styles
  14370. ) :
  14371. 0;
  14372. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14373. // faking a content-box to get border and padding (gh-3699)
  14374. if ( isBorderBox && scrollboxSizeBuggy ) {
  14375. subtract -= Math.ceil(
  14376. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14377. parseFloat( styles[ dimension ] ) -
  14378. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14379. 0.5
  14380. );
  14381. }
  14382. // Convert to pixels if value adjustment is needed
  14383. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14384. ( matches[ 3 ] || "px" ) !== "px" ) {
  14385. elem.style[ dimension ] = value;
  14386. value = jQuery.css( elem, dimension );
  14387. }
  14388. return setPositiveNumber( elem, value, subtract );
  14389. }
  14390. };
  14391. } );
  14392. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14393. function( elem, computed ) {
  14394. if ( computed ) {
  14395. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14396. elem.getBoundingClientRect().left -
  14397. swap( elem, { marginLeft: 0 }, function() {
  14398. return elem.getBoundingClientRect().left;
  14399. } )
  14400. ) + "px";
  14401. }
  14402. }
  14403. );
  14404. // These hooks are used by animate to expand properties
  14405. jQuery.each( {
  14406. margin: "",
  14407. padding: "",
  14408. border: "Width"
  14409. }, function( prefix, suffix ) {
  14410. jQuery.cssHooks[ prefix + suffix ] = {
  14411. expand: function( value ) {
  14412. var i = 0,
  14413. expanded = {},
  14414. // Assumes a single number if not a string
  14415. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14416. for ( ; i < 4; i++ ) {
  14417. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14418. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14419. }
  14420. return expanded;
  14421. }
  14422. };
  14423. if ( prefix !== "margin" ) {
  14424. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14425. }
  14426. } );
  14427. jQuery.fn.extend( {
  14428. css: function( name, value ) {
  14429. return access( this, function( elem, name, value ) {
  14430. var styles, len,
  14431. map = {},
  14432. i = 0;
  14433. if ( Array.isArray( name ) ) {
  14434. styles = getStyles( elem );
  14435. len = name.length;
  14436. for ( ; i < len; i++ ) {
  14437. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14438. }
  14439. return map;
  14440. }
  14441. return value !== undefined ?
  14442. jQuery.style( elem, name, value ) :
  14443. jQuery.css( elem, name );
  14444. }, name, value, arguments.length > 1 );
  14445. }
  14446. } );
  14447. function Tween( elem, options, prop, end, easing ) {
  14448. return new Tween.prototype.init( elem, options, prop, end, easing );
  14449. }
  14450. jQuery.Tween = Tween;
  14451. Tween.prototype = {
  14452. constructor: Tween,
  14453. init: function( elem, options, prop, end, easing, unit ) {
  14454. this.elem = elem;
  14455. this.prop = prop;
  14456. this.easing = easing || jQuery.easing._default;
  14457. this.options = options;
  14458. this.start = this.now = this.cur();
  14459. this.end = end;
  14460. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14461. },
  14462. cur: function() {
  14463. var hooks = Tween.propHooks[ this.prop ];
  14464. return hooks && hooks.get ?
  14465. hooks.get( this ) :
  14466. Tween.propHooks._default.get( this );
  14467. },
  14468. run: function( percent ) {
  14469. var eased,
  14470. hooks = Tween.propHooks[ this.prop ];
  14471. if ( this.options.duration ) {
  14472. this.pos = eased = jQuery.easing[ this.easing ](
  14473. percent, this.options.duration * percent, 0, 1, this.options.duration
  14474. );
  14475. } else {
  14476. this.pos = eased = percent;
  14477. }
  14478. this.now = ( this.end - this.start ) * eased + this.start;
  14479. if ( this.options.step ) {
  14480. this.options.step.call( this.elem, this.now, this );
  14481. }
  14482. if ( hooks && hooks.set ) {
  14483. hooks.set( this );
  14484. } else {
  14485. Tween.propHooks._default.set( this );
  14486. }
  14487. return this;
  14488. }
  14489. };
  14490. Tween.prototype.init.prototype = Tween.prototype;
  14491. Tween.propHooks = {
  14492. _default: {
  14493. get: function( tween ) {
  14494. var result;
  14495. // Use a property on the element directly when it is not a DOM element,
  14496. // or when there is no matching style property that exists.
  14497. if ( tween.elem.nodeType !== 1 ||
  14498. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14499. return tween.elem[ tween.prop ];
  14500. }
  14501. // Passing an empty string as a 3rd parameter to .css will automatically
  14502. // attempt a parseFloat and fallback to a string if the parse fails.
  14503. // Simple values such as "10px" are parsed to Float;
  14504. // complex values such as "rotate(1rad)" are returned as-is.
  14505. result = jQuery.css( tween.elem, tween.prop, "" );
  14506. // Empty strings, null, undefined and "auto" are converted to 0.
  14507. return !result || result === "auto" ? 0 : result;
  14508. },
  14509. set: function( tween ) {
  14510. // Use step hook for back compat.
  14511. // Use cssHook if its there.
  14512. // Use .style if available and use plain properties where available.
  14513. if ( jQuery.fx.step[ tween.prop ] ) {
  14514. jQuery.fx.step[ tween.prop ]( tween );
  14515. } else if ( tween.elem.nodeType === 1 && (
  14516. jQuery.cssHooks[ tween.prop ] ||
  14517. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14518. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14519. } else {
  14520. tween.elem[ tween.prop ] = tween.now;
  14521. }
  14522. }
  14523. }
  14524. };
  14525. // Support: IE <=9 only
  14526. // Panic based approach to setting things on disconnected nodes
  14527. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14528. set: function( tween ) {
  14529. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14530. tween.elem[ tween.prop ] = tween.now;
  14531. }
  14532. }
  14533. };
  14534. jQuery.easing = {
  14535. linear: function( p ) {
  14536. return p;
  14537. },
  14538. swing: function( p ) {
  14539. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14540. },
  14541. _default: "swing"
  14542. };
  14543. jQuery.fx = Tween.prototype.init;
  14544. // Back compat <1.8 extension point
  14545. jQuery.fx.step = {};
  14546. var
  14547. fxNow, inProgress,
  14548. rfxtypes = /^(?:toggle|show|hide)$/,
  14549. rrun = /queueHooks$/;
  14550. function schedule() {
  14551. if ( inProgress ) {
  14552. if ( document.hidden === false && window.requestAnimationFrame ) {
  14553. window.requestAnimationFrame( schedule );
  14554. } else {
  14555. window.setTimeout( schedule, jQuery.fx.interval );
  14556. }
  14557. jQuery.fx.tick();
  14558. }
  14559. }
  14560. // Animations created synchronously will run synchronously
  14561. function createFxNow() {
  14562. window.setTimeout( function() {
  14563. fxNow = undefined;
  14564. } );
  14565. return ( fxNow = Date.now() );
  14566. }
  14567. // Generate parameters to create a standard animation
  14568. function genFx( type, includeWidth ) {
  14569. var which,
  14570. i = 0,
  14571. attrs = { height: type };
  14572. // If we include width, step value is 1 to do all cssExpand values,
  14573. // otherwise step value is 2 to skip over Left and Right
  14574. includeWidth = includeWidth ? 1 : 0;
  14575. for ( ; i < 4; i += 2 - includeWidth ) {
  14576. which = cssExpand[ i ];
  14577. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14578. }
  14579. if ( includeWidth ) {
  14580. attrs.opacity = attrs.width = type;
  14581. }
  14582. return attrs;
  14583. }
  14584. function createTween( value, prop, animation ) {
  14585. var tween,
  14586. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14587. index = 0,
  14588. length = collection.length;
  14589. for ( ; index < length; index++ ) {
  14590. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14591. // We're done with this property
  14592. return tween;
  14593. }
  14594. }
  14595. }
  14596. function defaultPrefilter( elem, props, opts ) {
  14597. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14598. isBox = "width" in props || "height" in props,
  14599. anim = this,
  14600. orig = {},
  14601. style = elem.style,
  14602. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14603. dataShow = dataPriv.get( elem, "fxshow" );
  14604. // Queue-skipping animations hijack the fx hooks
  14605. if ( !opts.queue ) {
  14606. hooks = jQuery._queueHooks( elem, "fx" );
  14607. if ( hooks.unqueued == null ) {
  14608. hooks.unqueued = 0;
  14609. oldfire = hooks.empty.fire;
  14610. hooks.empty.fire = function() {
  14611. if ( !hooks.unqueued ) {
  14612. oldfire();
  14613. }
  14614. };
  14615. }
  14616. hooks.unqueued++;
  14617. anim.always( function() {
  14618. // Ensure the complete handler is called before this completes
  14619. anim.always( function() {
  14620. hooks.unqueued--;
  14621. if ( !jQuery.queue( elem, "fx" ).length ) {
  14622. hooks.empty.fire();
  14623. }
  14624. } );
  14625. } );
  14626. }
  14627. // Detect show/hide animations
  14628. for ( prop in props ) {
  14629. value = props[ prop ];
  14630. if ( rfxtypes.test( value ) ) {
  14631. delete props[ prop ];
  14632. toggle = toggle || value === "toggle";
  14633. if ( value === ( hidden ? "hide" : "show" ) ) {
  14634. // Pretend to be hidden if this is a "show" and
  14635. // there is still data from a stopped show/hide
  14636. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14637. hidden = true;
  14638. // Ignore all other no-op show/hide data
  14639. } else {
  14640. continue;
  14641. }
  14642. }
  14643. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14644. }
  14645. }
  14646. // Bail out if this is a no-op like .hide().hide()
  14647. propTween = !jQuery.isEmptyObject( props );
  14648. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14649. return;
  14650. }
  14651. // Restrict "overflow" and "display" styles during box animations
  14652. if ( isBox && elem.nodeType === 1 ) {
  14653. // Support: IE <=9 - 11, Edge 12 - 15
  14654. // Record all 3 overflow attributes because IE does not infer the shorthand
  14655. // from identically-valued overflowX and overflowY and Edge just mirrors
  14656. // the overflowX value there.
  14657. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14658. // Identify a display type, preferring old show/hide data over the CSS cascade
  14659. restoreDisplay = dataShow && dataShow.display;
  14660. if ( restoreDisplay == null ) {
  14661. restoreDisplay = dataPriv.get( elem, "display" );
  14662. }
  14663. display = jQuery.css( elem, "display" );
  14664. if ( display === "none" ) {
  14665. if ( restoreDisplay ) {
  14666. display = restoreDisplay;
  14667. } else {
  14668. // Get nonempty value(s) by temporarily forcing visibility
  14669. showHide( [ elem ], true );
  14670. restoreDisplay = elem.style.display || restoreDisplay;
  14671. display = jQuery.css( elem, "display" );
  14672. showHide( [ elem ] );
  14673. }
  14674. }
  14675. // Animate inline elements as inline-block
  14676. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14677. if ( jQuery.css( elem, "float" ) === "none" ) {
  14678. // Restore the original display value at the end of pure show/hide animations
  14679. if ( !propTween ) {
  14680. anim.done( function() {
  14681. style.display = restoreDisplay;
  14682. } );
  14683. if ( restoreDisplay == null ) {
  14684. display = style.display;
  14685. restoreDisplay = display === "none" ? "" : display;
  14686. }
  14687. }
  14688. style.display = "inline-block";
  14689. }
  14690. }
  14691. }
  14692. if ( opts.overflow ) {
  14693. style.overflow = "hidden";
  14694. anim.always( function() {
  14695. style.overflow = opts.overflow[ 0 ];
  14696. style.overflowX = opts.overflow[ 1 ];
  14697. style.overflowY = opts.overflow[ 2 ];
  14698. } );
  14699. }
  14700. // Implement show/hide animations
  14701. propTween = false;
  14702. for ( prop in orig ) {
  14703. // General show/hide setup for this element animation
  14704. if ( !propTween ) {
  14705. if ( dataShow ) {
  14706. if ( "hidden" in dataShow ) {
  14707. hidden = dataShow.hidden;
  14708. }
  14709. } else {
  14710. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14711. }
  14712. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14713. if ( toggle ) {
  14714. dataShow.hidden = !hidden;
  14715. }
  14716. // Show elements before animating them
  14717. if ( hidden ) {
  14718. showHide( [ elem ], true );
  14719. }
  14720. /* eslint-disable no-loop-func */
  14721. anim.done( function() {
  14722. /* eslint-enable no-loop-func */
  14723. // The final step of a "hide" animation is actually hiding the element
  14724. if ( !hidden ) {
  14725. showHide( [ elem ] );
  14726. }
  14727. dataPriv.remove( elem, "fxshow" );
  14728. for ( prop in orig ) {
  14729. jQuery.style( elem, prop, orig[ prop ] );
  14730. }
  14731. } );
  14732. }
  14733. // Per-property setup
  14734. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14735. if ( !( prop in dataShow ) ) {
  14736. dataShow[ prop ] = propTween.start;
  14737. if ( hidden ) {
  14738. propTween.end = propTween.start;
  14739. propTween.start = 0;
  14740. }
  14741. }
  14742. }
  14743. }
  14744. function propFilter( props, specialEasing ) {
  14745. var index, name, easing, value, hooks;
  14746. // camelCase, specialEasing and expand cssHook pass
  14747. for ( index in props ) {
  14748. name = camelCase( index );
  14749. easing = specialEasing[ name ];
  14750. value = props[ index ];
  14751. if ( Array.isArray( value ) ) {
  14752. easing = value[ 1 ];
  14753. value = props[ index ] = value[ 0 ];
  14754. }
  14755. if ( index !== name ) {
  14756. props[ name ] = value;
  14757. delete props[ index ];
  14758. }
  14759. hooks = jQuery.cssHooks[ name ];
  14760. if ( hooks && "expand" in hooks ) {
  14761. value = hooks.expand( value );
  14762. delete props[ name ];
  14763. // Not quite $.extend, this won't overwrite existing keys.
  14764. // Reusing 'index' because we have the correct "name"
  14765. for ( index in value ) {
  14766. if ( !( index in props ) ) {
  14767. props[ index ] = value[ index ];
  14768. specialEasing[ index ] = easing;
  14769. }
  14770. }
  14771. } else {
  14772. specialEasing[ name ] = easing;
  14773. }
  14774. }
  14775. }
  14776. function Animation( elem, properties, options ) {
  14777. var result,
  14778. stopped,
  14779. index = 0,
  14780. length = Animation.prefilters.length,
  14781. deferred = jQuery.Deferred().always( function() {
  14782. // Don't match elem in the :animated selector
  14783. delete tick.elem;
  14784. } ),
  14785. tick = function() {
  14786. if ( stopped ) {
  14787. return false;
  14788. }
  14789. var currentTime = fxNow || createFxNow(),
  14790. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14791. // Support: Android 2.3 only
  14792. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14793. temp = remaining / animation.duration || 0,
  14794. percent = 1 - temp,
  14795. index = 0,
  14796. length = animation.tweens.length;
  14797. for ( ; index < length; index++ ) {
  14798. animation.tweens[ index ].run( percent );
  14799. }
  14800. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14801. // If there's more to do, yield
  14802. if ( percent < 1 && length ) {
  14803. return remaining;
  14804. }
  14805. // If this was an empty animation, synthesize a final progress notification
  14806. if ( !length ) {
  14807. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14808. }
  14809. // Resolve the animation and report its conclusion
  14810. deferred.resolveWith( elem, [ animation ] );
  14811. return false;
  14812. },
  14813. animation = deferred.promise( {
  14814. elem: elem,
  14815. props: jQuery.extend( {}, properties ),
  14816. opts: jQuery.extend( true, {
  14817. specialEasing: {},
  14818. easing: jQuery.easing._default
  14819. }, options ),
  14820. originalProperties: properties,
  14821. originalOptions: options,
  14822. startTime: fxNow || createFxNow(),
  14823. duration: options.duration,
  14824. tweens: [],
  14825. createTween: function( prop, end ) {
  14826. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14827. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14828. animation.tweens.push( tween );
  14829. return tween;
  14830. },
  14831. stop: function( gotoEnd ) {
  14832. var index = 0,
  14833. // If we are going to the end, we want to run all the tweens
  14834. // otherwise we skip this part
  14835. length = gotoEnd ? animation.tweens.length : 0;
  14836. if ( stopped ) {
  14837. return this;
  14838. }
  14839. stopped = true;
  14840. for ( ; index < length; index++ ) {
  14841. animation.tweens[ index ].run( 1 );
  14842. }
  14843. // Resolve when we played the last frame; otherwise, reject
  14844. if ( gotoEnd ) {
  14845. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14846. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14847. } else {
  14848. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14849. }
  14850. return this;
  14851. }
  14852. } ),
  14853. props = animation.props;
  14854. propFilter( props, animation.opts.specialEasing );
  14855. for ( ; index < length; index++ ) {
  14856. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14857. if ( result ) {
  14858. if ( isFunction( result.stop ) ) {
  14859. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14860. result.stop.bind( result );
  14861. }
  14862. return result;
  14863. }
  14864. }
  14865. jQuery.map( props, createTween, animation );
  14866. if ( isFunction( animation.opts.start ) ) {
  14867. animation.opts.start.call( elem, animation );
  14868. }
  14869. // Attach callbacks from options
  14870. animation
  14871. .progress( animation.opts.progress )
  14872. .done( animation.opts.done, animation.opts.complete )
  14873. .fail( animation.opts.fail )
  14874. .always( animation.opts.always );
  14875. jQuery.fx.timer(
  14876. jQuery.extend( tick, {
  14877. elem: elem,
  14878. anim: animation,
  14879. queue: animation.opts.queue
  14880. } )
  14881. );
  14882. return animation;
  14883. }
  14884. jQuery.Animation = jQuery.extend( Animation, {
  14885. tweeners: {
  14886. "*": [ function( prop, value ) {
  14887. var tween = this.createTween( prop, value );
  14888. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14889. return tween;
  14890. } ]
  14891. },
  14892. tweener: function( props, callback ) {
  14893. if ( isFunction( props ) ) {
  14894. callback = props;
  14895. props = [ "*" ];
  14896. } else {
  14897. props = props.match( rnothtmlwhite );
  14898. }
  14899. var prop,
  14900. index = 0,
  14901. length = props.length;
  14902. for ( ; index < length; index++ ) {
  14903. prop = props[ index ];
  14904. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14905. Animation.tweeners[ prop ].unshift( callback );
  14906. }
  14907. },
  14908. prefilters: [ defaultPrefilter ],
  14909. prefilter: function( callback, prepend ) {
  14910. if ( prepend ) {
  14911. Animation.prefilters.unshift( callback );
  14912. } else {
  14913. Animation.prefilters.push( callback );
  14914. }
  14915. }
  14916. } );
  14917. jQuery.speed = function( speed, easing, fn ) {
  14918. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14919. complete: fn || !fn && easing ||
  14920. isFunction( speed ) && speed,
  14921. duration: speed,
  14922. easing: fn && easing || easing && !isFunction( easing ) && easing
  14923. };
  14924. // Go to the end state if fx are off
  14925. if ( jQuery.fx.off ) {
  14926. opt.duration = 0;
  14927. } else {
  14928. if ( typeof opt.duration !== "number" ) {
  14929. if ( opt.duration in jQuery.fx.speeds ) {
  14930. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14931. } else {
  14932. opt.duration = jQuery.fx.speeds._default;
  14933. }
  14934. }
  14935. }
  14936. // Normalize opt.queue - true/undefined/null -> "fx"
  14937. if ( opt.queue == null || opt.queue === true ) {
  14938. opt.queue = "fx";
  14939. }
  14940. // Queueing
  14941. opt.old = opt.complete;
  14942. opt.complete = function() {
  14943. if ( isFunction( opt.old ) ) {
  14944. opt.old.call( this );
  14945. }
  14946. if ( opt.queue ) {
  14947. jQuery.dequeue( this, opt.queue );
  14948. }
  14949. };
  14950. return opt;
  14951. };
  14952. jQuery.fn.extend( {
  14953. fadeTo: function( speed, to, easing, callback ) {
  14954. // Show any hidden elements after setting opacity to 0
  14955. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14956. // Animate to the value specified
  14957. .end().animate( { opacity: to }, speed, easing, callback );
  14958. },
  14959. animate: function( prop, speed, easing, callback ) {
  14960. var empty = jQuery.isEmptyObject( prop ),
  14961. optall = jQuery.speed( speed, easing, callback ),
  14962. doAnimation = function() {
  14963. // Operate on a copy of prop so per-property easing won't be lost
  14964. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14965. // Empty animations, or finishing resolves immediately
  14966. if ( empty || dataPriv.get( this, "finish" ) ) {
  14967. anim.stop( true );
  14968. }
  14969. };
  14970. doAnimation.finish = doAnimation;
  14971. return empty || optall.queue === false ?
  14972. this.each( doAnimation ) :
  14973. this.queue( optall.queue, doAnimation );
  14974. },
  14975. stop: function( type, clearQueue, gotoEnd ) {
  14976. var stopQueue = function( hooks ) {
  14977. var stop = hooks.stop;
  14978. delete hooks.stop;
  14979. stop( gotoEnd );
  14980. };
  14981. if ( typeof type !== "string" ) {
  14982. gotoEnd = clearQueue;
  14983. clearQueue = type;
  14984. type = undefined;
  14985. }
  14986. if ( clearQueue && type !== false ) {
  14987. this.queue( type || "fx", [] );
  14988. }
  14989. return this.each( function() {
  14990. var dequeue = true,
  14991. index = type != null && type + "queueHooks",
  14992. timers = jQuery.timers,
  14993. data = dataPriv.get( this );
  14994. if ( index ) {
  14995. if ( data[ index ] && data[ index ].stop ) {
  14996. stopQueue( data[ index ] );
  14997. }
  14998. } else {
  14999. for ( index in data ) {
  15000. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15001. stopQueue( data[ index ] );
  15002. }
  15003. }
  15004. }
  15005. for ( index = timers.length; index--; ) {
  15006. if ( timers[ index ].elem === this &&
  15007. ( type == null || timers[ index ].queue === type ) ) {
  15008. timers[ index ].anim.stop( gotoEnd );
  15009. dequeue = false;
  15010. timers.splice( index, 1 );
  15011. }
  15012. }
  15013. // Start the next in the queue if the last step wasn't forced.
  15014. // Timers currently will call their complete callbacks, which
  15015. // will dequeue but only if they were gotoEnd.
  15016. if ( dequeue || !gotoEnd ) {
  15017. jQuery.dequeue( this, type );
  15018. }
  15019. } );
  15020. },
  15021. finish: function( type ) {
  15022. if ( type !== false ) {
  15023. type = type || "fx";
  15024. }
  15025. return this.each( function() {
  15026. var index,
  15027. data = dataPriv.get( this ),
  15028. queue = data[ type + "queue" ],
  15029. hooks = data[ type + "queueHooks" ],
  15030. timers = jQuery.timers,
  15031. length = queue ? queue.length : 0;
  15032. // Enable finishing flag on private data
  15033. data.finish = true;
  15034. // Empty the queue first
  15035. jQuery.queue( this, type, [] );
  15036. if ( hooks && hooks.stop ) {
  15037. hooks.stop.call( this, true );
  15038. }
  15039. // Look for any active animations, and finish them
  15040. for ( index = timers.length; index--; ) {
  15041. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15042. timers[ index ].anim.stop( true );
  15043. timers.splice( index, 1 );
  15044. }
  15045. }
  15046. // Look for any animations in the old queue and finish them
  15047. for ( index = 0; index < length; index++ ) {
  15048. if ( queue[ index ] && queue[ index ].finish ) {
  15049. queue[ index ].finish.call( this );
  15050. }
  15051. }
  15052. // Turn off finishing flag
  15053. delete data.finish;
  15054. } );
  15055. }
  15056. } );
  15057. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15058. var cssFn = jQuery.fn[ name ];
  15059. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15060. return speed == null || typeof speed === "boolean" ?
  15061. cssFn.apply( this, arguments ) :
  15062. this.animate( genFx( name, true ), speed, easing, callback );
  15063. };
  15064. } );
  15065. // Generate shortcuts for custom animations
  15066. jQuery.each( {
  15067. slideDown: genFx( "show" ),
  15068. slideUp: genFx( "hide" ),
  15069. slideToggle: genFx( "toggle" ),
  15070. fadeIn: { opacity: "show" },
  15071. fadeOut: { opacity: "hide" },
  15072. fadeToggle: { opacity: "toggle" }
  15073. }, function( name, props ) {
  15074. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15075. return this.animate( props, speed, easing, callback );
  15076. };
  15077. } );
  15078. jQuery.timers = [];
  15079. jQuery.fx.tick = function() {
  15080. var timer,
  15081. i = 0,
  15082. timers = jQuery.timers;
  15083. fxNow = Date.now();
  15084. for ( ; i < timers.length; i++ ) {
  15085. timer = timers[ i ];
  15086. // Run the timer and safely remove it when done (allowing for external removal)
  15087. if ( !timer() && timers[ i ] === timer ) {
  15088. timers.splice( i--, 1 );
  15089. }
  15090. }
  15091. if ( !timers.length ) {
  15092. jQuery.fx.stop();
  15093. }
  15094. fxNow = undefined;
  15095. };
  15096. jQuery.fx.timer = function( timer ) {
  15097. jQuery.timers.push( timer );
  15098. jQuery.fx.start();
  15099. };
  15100. jQuery.fx.interval = 13;
  15101. jQuery.fx.start = function() {
  15102. if ( inProgress ) {
  15103. return;
  15104. }
  15105. inProgress = true;
  15106. schedule();
  15107. };
  15108. jQuery.fx.stop = function() {
  15109. inProgress = null;
  15110. };
  15111. jQuery.fx.speeds = {
  15112. slow: 600,
  15113. fast: 200,
  15114. // Default speed
  15115. _default: 400
  15116. };
  15117. // Based off of the plugin by Clint Helfers, with permission.
  15118. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15119. jQuery.fn.delay = function( time, type ) {
  15120. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15121. type = type || "fx";
  15122. return this.queue( type, function( next, hooks ) {
  15123. var timeout = window.setTimeout( next, time );
  15124. hooks.stop = function() {
  15125. window.clearTimeout( timeout );
  15126. };
  15127. } );
  15128. };
  15129. ( function() {
  15130. var input = document.createElement( "input" ),
  15131. select = document.createElement( "select" ),
  15132. opt = select.appendChild( document.createElement( "option" ) );
  15133. input.type = "checkbox";
  15134. // Support: Android <=4.3 only
  15135. // Default value for a checkbox should be "on"
  15136. support.checkOn = input.value !== "";
  15137. // Support: IE <=11 only
  15138. // Must access selectedIndex to make default options select
  15139. support.optSelected = opt.selected;
  15140. // Support: IE <=11 only
  15141. // An input loses its value after becoming a radio
  15142. input = document.createElement( "input" );
  15143. input.value = "t";
  15144. input.type = "radio";
  15145. support.radioValue = input.value === "t";
  15146. } )();
  15147. var boolHook,
  15148. attrHandle = jQuery.expr.attrHandle;
  15149. jQuery.fn.extend( {
  15150. attr: function( name, value ) {
  15151. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15152. },
  15153. removeAttr: function( name ) {
  15154. return this.each( function() {
  15155. jQuery.removeAttr( this, name );
  15156. } );
  15157. }
  15158. } );
  15159. jQuery.extend( {
  15160. attr: function( elem, name, value ) {
  15161. var ret, hooks,
  15162. nType = elem.nodeType;
  15163. // Don't get/set attributes on text, comment and attribute nodes
  15164. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15165. return;
  15166. }
  15167. // Fallback to prop when attributes are not supported
  15168. if ( typeof elem.getAttribute === "undefined" ) {
  15169. return jQuery.prop( elem, name, value );
  15170. }
  15171. // Attribute hooks are determined by the lowercase version
  15172. // Grab necessary hook if one is defined
  15173. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15174. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15175. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15176. }
  15177. if ( value !== undefined ) {
  15178. if ( value === null ) {
  15179. jQuery.removeAttr( elem, name );
  15180. return;
  15181. }
  15182. if ( hooks && "set" in hooks &&
  15183. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15184. return ret;
  15185. }
  15186. elem.setAttribute( name, value + "" );
  15187. return value;
  15188. }
  15189. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15190. return ret;
  15191. }
  15192. ret = jQuery.find.attr( elem, name );
  15193. // Non-existent attributes return null, we normalize to undefined
  15194. return ret == null ? undefined : ret;
  15195. },
  15196. attrHooks: {
  15197. type: {
  15198. set: function( elem, value ) {
  15199. if ( !support.radioValue && value === "radio" &&
  15200. nodeName( elem, "input" ) ) {
  15201. var val = elem.value;
  15202. elem.setAttribute( "type", value );
  15203. if ( val ) {
  15204. elem.value = val;
  15205. }
  15206. return value;
  15207. }
  15208. }
  15209. }
  15210. },
  15211. removeAttr: function( elem, value ) {
  15212. var name,
  15213. i = 0,
  15214. // Attribute names can contain non-HTML whitespace characters
  15215. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15216. attrNames = value && value.match( rnothtmlwhite );
  15217. if ( attrNames && elem.nodeType === 1 ) {
  15218. while ( ( name = attrNames[ i++ ] ) ) {
  15219. elem.removeAttribute( name );
  15220. }
  15221. }
  15222. }
  15223. } );
  15224. // Hooks for boolean attributes
  15225. boolHook = {
  15226. set: function( elem, value, name ) {
  15227. if ( value === false ) {
  15228. // Remove boolean attributes when set to false
  15229. jQuery.removeAttr( elem, name );
  15230. } else {
  15231. elem.setAttribute( name, name );
  15232. }
  15233. return name;
  15234. }
  15235. };
  15236. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15237. var getter = attrHandle[ name ] || jQuery.find.attr;
  15238. attrHandle[ name ] = function( elem, name, isXML ) {
  15239. var ret, handle,
  15240. lowercaseName = name.toLowerCase();
  15241. if ( !isXML ) {
  15242. // Avoid an infinite loop by temporarily removing this function from the getter
  15243. handle = attrHandle[ lowercaseName ];
  15244. attrHandle[ lowercaseName ] = ret;
  15245. ret = getter( elem, name, isXML ) != null ?
  15246. lowercaseName :
  15247. null;
  15248. attrHandle[ lowercaseName ] = handle;
  15249. }
  15250. return ret;
  15251. };
  15252. } );
  15253. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15254. rclickable = /^(?:a|area)$/i;
  15255. jQuery.fn.extend( {
  15256. prop: function( name, value ) {
  15257. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15258. },
  15259. removeProp: function( name ) {
  15260. return this.each( function() {
  15261. delete this[ jQuery.propFix[ name ] || name ];
  15262. } );
  15263. }
  15264. } );
  15265. jQuery.extend( {
  15266. prop: function( elem, name, value ) {
  15267. var ret, hooks,
  15268. nType = elem.nodeType;
  15269. // Don't get/set properties on text, comment and attribute nodes
  15270. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15271. return;
  15272. }
  15273. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15274. // Fix name and attach hooks
  15275. name = jQuery.propFix[ name ] || name;
  15276. hooks = jQuery.propHooks[ name ];
  15277. }
  15278. if ( value !== undefined ) {
  15279. if ( hooks && "set" in hooks &&
  15280. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15281. return ret;
  15282. }
  15283. return ( elem[ name ] = value );
  15284. }
  15285. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15286. return ret;
  15287. }
  15288. return elem[ name ];
  15289. },
  15290. propHooks: {
  15291. tabIndex: {
  15292. get: function( elem ) {
  15293. // Support: IE <=9 - 11 only
  15294. // elem.tabIndex doesn't always return the
  15295. // correct value when it hasn't been explicitly set
  15296. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15297. // Use proper attribute retrieval(#12072)
  15298. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15299. if ( tabindex ) {
  15300. return parseInt( tabindex, 10 );
  15301. }
  15302. if (
  15303. rfocusable.test( elem.nodeName ) ||
  15304. rclickable.test( elem.nodeName ) &&
  15305. elem.href
  15306. ) {
  15307. return 0;
  15308. }
  15309. return -1;
  15310. }
  15311. }
  15312. },
  15313. propFix: {
  15314. "for": "htmlFor",
  15315. "class": "className"
  15316. }
  15317. } );
  15318. // Support: IE <=11 only
  15319. // Accessing the selectedIndex property
  15320. // forces the browser to respect setting selected
  15321. // on the option
  15322. // The getter ensures a default option is selected
  15323. // when in an optgroup
  15324. // eslint rule "no-unused-expressions" is disabled for this code
  15325. // since it considers such accessions noop
  15326. if ( !support.optSelected ) {
  15327. jQuery.propHooks.selected = {
  15328. get: function( elem ) {
  15329. /* eslint no-unused-expressions: "off" */
  15330. var parent = elem.parentNode;
  15331. if ( parent && parent.parentNode ) {
  15332. parent.parentNode.selectedIndex;
  15333. }
  15334. return null;
  15335. },
  15336. set: function( elem ) {
  15337. /* eslint no-unused-expressions: "off" */
  15338. var parent = elem.parentNode;
  15339. if ( parent ) {
  15340. parent.selectedIndex;
  15341. if ( parent.parentNode ) {
  15342. parent.parentNode.selectedIndex;
  15343. }
  15344. }
  15345. }
  15346. };
  15347. }
  15348. jQuery.each( [
  15349. "tabIndex",
  15350. "readOnly",
  15351. "maxLength",
  15352. "cellSpacing",
  15353. "cellPadding",
  15354. "rowSpan",
  15355. "colSpan",
  15356. "useMap",
  15357. "frameBorder",
  15358. "contentEditable"
  15359. ], function() {
  15360. jQuery.propFix[ this.toLowerCase() ] = this;
  15361. } );
  15362. // Strip and collapse whitespace according to HTML spec
  15363. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15364. function stripAndCollapse( value ) {
  15365. var tokens = value.match( rnothtmlwhite ) || [];
  15366. return tokens.join( " " );
  15367. }
  15368. function getClass( elem ) {
  15369. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15370. }
  15371. function classesToArray( value ) {
  15372. if ( Array.isArray( value ) ) {
  15373. return value;
  15374. }
  15375. if ( typeof value === "string" ) {
  15376. return value.match( rnothtmlwhite ) || [];
  15377. }
  15378. return [];
  15379. }
  15380. jQuery.fn.extend( {
  15381. addClass: function( value ) {
  15382. var classes, elem, cur, curValue, clazz, j, finalValue,
  15383. i = 0;
  15384. if ( isFunction( value ) ) {
  15385. return this.each( function( j ) {
  15386. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15387. } );
  15388. }
  15389. classes = classesToArray( value );
  15390. if ( classes.length ) {
  15391. while ( ( elem = this[ i++ ] ) ) {
  15392. curValue = getClass( elem );
  15393. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15394. if ( cur ) {
  15395. j = 0;
  15396. while ( ( clazz = classes[ j++ ] ) ) {
  15397. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15398. cur += clazz + " ";
  15399. }
  15400. }
  15401. // Only assign if different to avoid unneeded rendering.
  15402. finalValue = stripAndCollapse( cur );
  15403. if ( curValue !== finalValue ) {
  15404. elem.setAttribute( "class", finalValue );
  15405. }
  15406. }
  15407. }
  15408. }
  15409. return this;
  15410. },
  15411. removeClass: function( value ) {
  15412. var classes, elem, cur, curValue, clazz, j, finalValue,
  15413. i = 0;
  15414. if ( isFunction( value ) ) {
  15415. return this.each( function( j ) {
  15416. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15417. } );
  15418. }
  15419. if ( !arguments.length ) {
  15420. return this.attr( "class", "" );
  15421. }
  15422. classes = classesToArray( value );
  15423. if ( classes.length ) {
  15424. while ( ( elem = this[ i++ ] ) ) {
  15425. curValue = getClass( elem );
  15426. // This expression is here for better compressibility (see addClass)
  15427. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15428. if ( cur ) {
  15429. j = 0;
  15430. while ( ( clazz = classes[ j++ ] ) ) {
  15431. // Remove *all* instances
  15432. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15433. cur = cur.replace( " " + clazz + " ", " " );
  15434. }
  15435. }
  15436. // Only assign if different to avoid unneeded rendering.
  15437. finalValue = stripAndCollapse( cur );
  15438. if ( curValue !== finalValue ) {
  15439. elem.setAttribute( "class", finalValue );
  15440. }
  15441. }
  15442. }
  15443. }
  15444. return this;
  15445. },
  15446. toggleClass: function( value, stateVal ) {
  15447. var type = typeof value,
  15448. isValidValue = type === "string" || Array.isArray( value );
  15449. if ( typeof stateVal === "boolean" && isValidValue ) {
  15450. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15451. }
  15452. if ( isFunction( value ) ) {
  15453. return this.each( function( i ) {
  15454. jQuery( this ).toggleClass(
  15455. value.call( this, i, getClass( this ), stateVal ),
  15456. stateVal
  15457. );
  15458. } );
  15459. }
  15460. return this.each( function() {
  15461. var className, i, self, classNames;
  15462. if ( isValidValue ) {
  15463. // Toggle individual class names
  15464. i = 0;
  15465. self = jQuery( this );
  15466. classNames = classesToArray( value );
  15467. while ( ( className = classNames[ i++ ] ) ) {
  15468. // Check each className given, space separated list
  15469. if ( self.hasClass( className ) ) {
  15470. self.removeClass( className );
  15471. } else {
  15472. self.addClass( className );
  15473. }
  15474. }
  15475. // Toggle whole class name
  15476. } else if ( value === undefined || type === "boolean" ) {
  15477. className = getClass( this );
  15478. if ( className ) {
  15479. // Store className if set
  15480. dataPriv.set( this, "__className__", className );
  15481. }
  15482. // If the element has a class name or if we're passed `false`,
  15483. // then remove the whole classname (if there was one, the above saved it).
  15484. // Otherwise bring back whatever was previously saved (if anything),
  15485. // falling back to the empty string if nothing was stored.
  15486. if ( this.setAttribute ) {
  15487. this.setAttribute( "class",
  15488. className || value === false ?
  15489. "" :
  15490. dataPriv.get( this, "__className__" ) || ""
  15491. );
  15492. }
  15493. }
  15494. } );
  15495. },
  15496. hasClass: function( selector ) {
  15497. var className, elem,
  15498. i = 0;
  15499. className = " " + selector + " ";
  15500. while ( ( elem = this[ i++ ] ) ) {
  15501. if ( elem.nodeType === 1 &&
  15502. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15503. return true;
  15504. }
  15505. }
  15506. return false;
  15507. }
  15508. } );
  15509. var rreturn = /\r/g;
  15510. jQuery.fn.extend( {
  15511. val: function( value ) {
  15512. var hooks, ret, valueIsFunction,
  15513. elem = this[ 0 ];
  15514. if ( !arguments.length ) {
  15515. if ( elem ) {
  15516. hooks = jQuery.valHooks[ elem.type ] ||
  15517. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15518. if ( hooks &&
  15519. "get" in hooks &&
  15520. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15521. ) {
  15522. return ret;
  15523. }
  15524. ret = elem.value;
  15525. // Handle most common string cases
  15526. if ( typeof ret === "string" ) {
  15527. return ret.replace( rreturn, "" );
  15528. }
  15529. // Handle cases where value is null/undef or number
  15530. return ret == null ? "" : ret;
  15531. }
  15532. return;
  15533. }
  15534. valueIsFunction = isFunction( value );
  15535. return this.each( function( i ) {
  15536. var val;
  15537. if ( this.nodeType !== 1 ) {
  15538. return;
  15539. }
  15540. if ( valueIsFunction ) {
  15541. val = value.call( this, i, jQuery( this ).val() );
  15542. } else {
  15543. val = value;
  15544. }
  15545. // Treat null/undefined as ""; convert numbers to string
  15546. if ( val == null ) {
  15547. val = "";
  15548. } else if ( typeof val === "number" ) {
  15549. val += "";
  15550. } else if ( Array.isArray( val ) ) {
  15551. val = jQuery.map( val, function( value ) {
  15552. return value == null ? "" : value + "";
  15553. } );
  15554. }
  15555. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15556. // If set returns undefined, fall back to normal setting
  15557. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15558. this.value = val;
  15559. }
  15560. } );
  15561. }
  15562. } );
  15563. jQuery.extend( {
  15564. valHooks: {
  15565. option: {
  15566. get: function( elem ) {
  15567. var val = jQuery.find.attr( elem, "value" );
  15568. return val != null ?
  15569. val :
  15570. // Support: IE <=10 - 11 only
  15571. // option.text throws exceptions (#14686, #14858)
  15572. // Strip and collapse whitespace
  15573. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15574. stripAndCollapse( jQuery.text( elem ) );
  15575. }
  15576. },
  15577. select: {
  15578. get: function( elem ) {
  15579. var value, option, i,
  15580. options = elem.options,
  15581. index = elem.selectedIndex,
  15582. one = elem.type === "select-one",
  15583. values = one ? null : [],
  15584. max = one ? index + 1 : options.length;
  15585. if ( index < 0 ) {
  15586. i = max;
  15587. } else {
  15588. i = one ? index : 0;
  15589. }
  15590. // Loop through all the selected options
  15591. for ( ; i < max; i++ ) {
  15592. option = options[ i ];
  15593. // Support: IE <=9 only
  15594. // IE8-9 doesn't update selected after form reset (#2551)
  15595. if ( ( option.selected || i === index ) &&
  15596. // Don't return options that are disabled or in a disabled optgroup
  15597. !option.disabled &&
  15598. ( !option.parentNode.disabled ||
  15599. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15600. // Get the specific value for the option
  15601. value = jQuery( option ).val();
  15602. // We don't need an array for one selects
  15603. if ( one ) {
  15604. return value;
  15605. }
  15606. // Multi-Selects return an array
  15607. values.push( value );
  15608. }
  15609. }
  15610. return values;
  15611. },
  15612. set: function( elem, value ) {
  15613. var optionSet, option,
  15614. options = elem.options,
  15615. values = jQuery.makeArray( value ),
  15616. i = options.length;
  15617. while ( i-- ) {
  15618. option = options[ i ];
  15619. /* eslint-disable no-cond-assign */
  15620. if ( option.selected =
  15621. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15622. ) {
  15623. optionSet = true;
  15624. }
  15625. /* eslint-enable no-cond-assign */
  15626. }
  15627. // Force browsers to behave consistently when non-matching value is set
  15628. if ( !optionSet ) {
  15629. elem.selectedIndex = -1;
  15630. }
  15631. return values;
  15632. }
  15633. }
  15634. }
  15635. } );
  15636. // Radios and checkboxes getter/setter
  15637. jQuery.each( [ "radio", "checkbox" ], function() {
  15638. jQuery.valHooks[ this ] = {
  15639. set: function( elem, value ) {
  15640. if ( Array.isArray( value ) ) {
  15641. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15642. }
  15643. }
  15644. };
  15645. if ( !support.checkOn ) {
  15646. jQuery.valHooks[ this ].get = function( elem ) {
  15647. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15648. };
  15649. }
  15650. } );
  15651. // Return jQuery for attributes-only inclusion
  15652. support.focusin = "onfocusin" in window;
  15653. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15654. stopPropagationCallback = function( e ) {
  15655. e.stopPropagation();
  15656. };
  15657. jQuery.extend( jQuery.event, {
  15658. trigger: function( event, data, elem, onlyHandlers ) {
  15659. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15660. eventPath = [ elem || document ],
  15661. type = hasOwn.call( event, "type" ) ? event.type : event,
  15662. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15663. cur = lastElement = tmp = elem = elem || document;
  15664. // Don't do events on text and comment nodes
  15665. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15666. return;
  15667. }
  15668. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15669. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15670. return;
  15671. }
  15672. if ( type.indexOf( "." ) > -1 ) {
  15673. // Namespaced trigger; create a regexp to match event type in handle()
  15674. namespaces = type.split( "." );
  15675. type = namespaces.shift();
  15676. namespaces.sort();
  15677. }
  15678. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15679. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15680. event = event[ jQuery.expando ] ?
  15681. event :
  15682. new jQuery.Event( type, typeof event === "object" && event );
  15683. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15684. event.isTrigger = onlyHandlers ? 2 : 3;
  15685. event.namespace = namespaces.join( "." );
  15686. event.rnamespace = event.namespace ?
  15687. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15688. null;
  15689. // Clean up the event in case it is being reused
  15690. event.result = undefined;
  15691. if ( !event.target ) {
  15692. event.target = elem;
  15693. }
  15694. // Clone any incoming data and prepend the event, creating the handler arg list
  15695. data = data == null ?
  15696. [ event ] :
  15697. jQuery.makeArray( data, [ event ] );
  15698. // Allow special events to draw outside the lines
  15699. special = jQuery.event.special[ type ] || {};
  15700. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15701. return;
  15702. }
  15703. // Determine event propagation path in advance, per W3C events spec (#9951)
  15704. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15705. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15706. bubbleType = special.delegateType || type;
  15707. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15708. cur = cur.parentNode;
  15709. }
  15710. for ( ; cur; cur = cur.parentNode ) {
  15711. eventPath.push( cur );
  15712. tmp = cur;
  15713. }
  15714. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15715. if ( tmp === ( elem.ownerDocument || document ) ) {
  15716. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15717. }
  15718. }
  15719. // Fire handlers on the event path
  15720. i = 0;
  15721. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15722. lastElement = cur;
  15723. event.type = i > 1 ?
  15724. bubbleType :
  15725. special.bindType || type;
  15726. // jQuery handler
  15727. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15728. dataPriv.get( cur, "handle" );
  15729. if ( handle ) {
  15730. handle.apply( cur, data );
  15731. }
  15732. // Native handler
  15733. handle = ontype && cur[ ontype ];
  15734. if ( handle && handle.apply && acceptData( cur ) ) {
  15735. event.result = handle.apply( cur, data );
  15736. if ( event.result === false ) {
  15737. event.preventDefault();
  15738. }
  15739. }
  15740. }
  15741. event.type = type;
  15742. // If nobody prevented the default action, do it now
  15743. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15744. if ( ( !special._default ||
  15745. special._default.apply( eventPath.pop(), data ) === false ) &&
  15746. acceptData( elem ) ) {
  15747. // Call a native DOM method on the target with the same name as the event.
  15748. // Don't do default actions on window, that's where global variables be (#6170)
  15749. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15750. // Don't re-trigger an onFOO event when we call its FOO() method
  15751. tmp = elem[ ontype ];
  15752. if ( tmp ) {
  15753. elem[ ontype ] = null;
  15754. }
  15755. // Prevent re-triggering of the same event, since we already bubbled it above
  15756. jQuery.event.triggered = type;
  15757. if ( event.isPropagationStopped() ) {
  15758. lastElement.addEventListener( type, stopPropagationCallback );
  15759. }
  15760. elem[ type ]();
  15761. if ( event.isPropagationStopped() ) {
  15762. lastElement.removeEventListener( type, stopPropagationCallback );
  15763. }
  15764. jQuery.event.triggered = undefined;
  15765. if ( tmp ) {
  15766. elem[ ontype ] = tmp;
  15767. }
  15768. }
  15769. }
  15770. }
  15771. return event.result;
  15772. },
  15773. // Piggyback on a donor event to simulate a different one
  15774. // Used only for `focus(in | out)` events
  15775. simulate: function( type, elem, event ) {
  15776. var e = jQuery.extend(
  15777. new jQuery.Event(),
  15778. event,
  15779. {
  15780. type: type,
  15781. isSimulated: true
  15782. }
  15783. );
  15784. jQuery.event.trigger( e, null, elem );
  15785. }
  15786. } );
  15787. jQuery.fn.extend( {
  15788. trigger: function( type, data ) {
  15789. return this.each( function() {
  15790. jQuery.event.trigger( type, data, this );
  15791. } );
  15792. },
  15793. triggerHandler: function( type, data ) {
  15794. var elem = this[ 0 ];
  15795. if ( elem ) {
  15796. return jQuery.event.trigger( type, data, elem, true );
  15797. }
  15798. }
  15799. } );
  15800. // Support: Firefox <=44
  15801. // Firefox doesn't have focus(in | out) events
  15802. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15803. //
  15804. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15805. // focus(in | out) events fire after focus & blur events,
  15806. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15807. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15808. if ( !support.focusin ) {
  15809. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15810. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15811. var handler = function( event ) {
  15812. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15813. };
  15814. jQuery.event.special[ fix ] = {
  15815. setup: function() {
  15816. var doc = this.ownerDocument || this,
  15817. attaches = dataPriv.access( doc, fix );
  15818. if ( !attaches ) {
  15819. doc.addEventListener( orig, handler, true );
  15820. }
  15821. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15822. },
  15823. teardown: function() {
  15824. var doc = this.ownerDocument || this,
  15825. attaches = dataPriv.access( doc, fix ) - 1;
  15826. if ( !attaches ) {
  15827. doc.removeEventListener( orig, handler, true );
  15828. dataPriv.remove( doc, fix );
  15829. } else {
  15830. dataPriv.access( doc, fix, attaches );
  15831. }
  15832. }
  15833. };
  15834. } );
  15835. }
  15836. var location = window.location;
  15837. var nonce = Date.now();
  15838. var rquery = ( /\?/ );
  15839. // Cross-browser xml parsing
  15840. jQuery.parseXML = function( data ) {
  15841. var xml;
  15842. if ( !data || typeof data !== "string" ) {
  15843. return null;
  15844. }
  15845. // Support: IE 9 - 11 only
  15846. // IE throws on parseFromString with invalid input.
  15847. try {
  15848. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15849. } catch ( e ) {
  15850. xml = undefined;
  15851. }
  15852. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15853. jQuery.error( "Invalid XML: " + data );
  15854. }
  15855. return xml;
  15856. };
  15857. var
  15858. rbracket = /\[\]$/,
  15859. rCRLF = /\r?\n/g,
  15860. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15861. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15862. function buildParams( prefix, obj, traditional, add ) {
  15863. var name;
  15864. if ( Array.isArray( obj ) ) {
  15865. // Serialize array item.
  15866. jQuery.each( obj, function( i, v ) {
  15867. if ( traditional || rbracket.test( prefix ) ) {
  15868. // Treat each array item as a scalar.
  15869. add( prefix, v );
  15870. } else {
  15871. // Item is non-scalar (array or object), encode its numeric index.
  15872. buildParams(
  15873. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15874. v,
  15875. traditional,
  15876. add
  15877. );
  15878. }
  15879. } );
  15880. } else if ( !traditional && toType( obj ) === "object" ) {
  15881. // Serialize object item.
  15882. for ( name in obj ) {
  15883. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15884. }
  15885. } else {
  15886. // Serialize scalar item.
  15887. add( prefix, obj );
  15888. }
  15889. }
  15890. // Serialize an array of form elements or a set of
  15891. // key/values into a query string
  15892. jQuery.param = function( a, traditional ) {
  15893. var prefix,
  15894. s = [],
  15895. add = function( key, valueOrFunction ) {
  15896. // If value is a function, invoke it and use its return value
  15897. var value = isFunction( valueOrFunction ) ?
  15898. valueOrFunction() :
  15899. valueOrFunction;
  15900. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15901. encodeURIComponent( value == null ? "" : value );
  15902. };
  15903. if ( a == null ) {
  15904. return "";
  15905. }
  15906. // If an array was passed in, assume that it is an array of form elements.
  15907. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15908. // Serialize the form elements
  15909. jQuery.each( a, function() {
  15910. add( this.name, this.value );
  15911. } );
  15912. } else {
  15913. // If traditional, encode the "old" way (the way 1.3.2 or older
  15914. // did it), otherwise encode params recursively.
  15915. for ( prefix in a ) {
  15916. buildParams( prefix, a[ prefix ], traditional, add );
  15917. }
  15918. }
  15919. // Return the resulting serialization
  15920. return s.join( "&" );
  15921. };
  15922. jQuery.fn.extend( {
  15923. serialize: function() {
  15924. return jQuery.param( this.serializeArray() );
  15925. },
  15926. serializeArray: function() {
  15927. return this.map( function() {
  15928. // Can add propHook for "elements" to filter or add form elements
  15929. var elements = jQuery.prop( this, "elements" );
  15930. return elements ? jQuery.makeArray( elements ) : this;
  15931. } )
  15932. .filter( function() {
  15933. var type = this.type;
  15934. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15935. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15936. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15937. ( this.checked || !rcheckableType.test( type ) );
  15938. } )
  15939. .map( function( i, elem ) {
  15940. var val = jQuery( this ).val();
  15941. if ( val == null ) {
  15942. return null;
  15943. }
  15944. if ( Array.isArray( val ) ) {
  15945. return jQuery.map( val, function( val ) {
  15946. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15947. } );
  15948. }
  15949. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15950. } ).get();
  15951. }
  15952. } );
  15953. var
  15954. r20 = /%20/g,
  15955. rhash = /#.*$/,
  15956. rantiCache = /([?&])_=[^&]*/,
  15957. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15958. // #7653, #8125, #8152: local protocol detection
  15959. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15960. rnoContent = /^(?:GET|HEAD)$/,
  15961. rprotocol = /^\/\//,
  15962. /* Prefilters
  15963. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15964. * 2) These are called:
  15965. * - BEFORE asking for a transport
  15966. * - AFTER param serialization (s.data is a string if s.processData is true)
  15967. * 3) key is the dataType
  15968. * 4) the catchall symbol "*" can be used
  15969. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15970. */
  15971. prefilters = {},
  15972. /* Transports bindings
  15973. * 1) key is the dataType
  15974. * 2) the catchall symbol "*" can be used
  15975. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15976. */
  15977. transports = {},
  15978. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15979. allTypes = "*/".concat( "*" ),
  15980. // Anchor tag for parsing the document origin
  15981. originAnchor = document.createElement( "a" );
  15982. originAnchor.href = location.href;
  15983. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15984. function addToPrefiltersOrTransports( structure ) {
  15985. // dataTypeExpression is optional and defaults to "*"
  15986. return function( dataTypeExpression, func ) {
  15987. if ( typeof dataTypeExpression !== "string" ) {
  15988. func = dataTypeExpression;
  15989. dataTypeExpression = "*";
  15990. }
  15991. var dataType,
  15992. i = 0,
  15993. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15994. if ( isFunction( func ) ) {
  15995. // For each dataType in the dataTypeExpression
  15996. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15997. // Prepend if requested
  15998. if ( dataType[ 0 ] === "+" ) {
  15999. dataType = dataType.slice( 1 ) || "*";
  16000. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16001. // Otherwise append
  16002. } else {
  16003. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16004. }
  16005. }
  16006. }
  16007. };
  16008. }
  16009. // Base inspection function for prefilters and transports
  16010. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16011. var inspected = {},
  16012. seekingTransport = ( structure === transports );
  16013. function inspect( dataType ) {
  16014. var selected;
  16015. inspected[ dataType ] = true;
  16016. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16017. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16018. if ( typeof dataTypeOrTransport === "string" &&
  16019. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16020. options.dataTypes.unshift( dataTypeOrTransport );
  16021. inspect( dataTypeOrTransport );
  16022. return false;
  16023. } else if ( seekingTransport ) {
  16024. return !( selected = dataTypeOrTransport );
  16025. }
  16026. } );
  16027. return selected;
  16028. }
  16029. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16030. }
  16031. // A special extend for ajax options
  16032. // that takes "flat" options (not to be deep extended)
  16033. // Fixes #9887
  16034. function ajaxExtend( target, src ) {
  16035. var key, deep,
  16036. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16037. for ( key in src ) {
  16038. if ( src[ key ] !== undefined ) {
  16039. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16040. }
  16041. }
  16042. if ( deep ) {
  16043. jQuery.extend( true, target, deep );
  16044. }
  16045. return target;
  16046. }
  16047. /* Handles responses to an ajax request:
  16048. * - finds the right dataType (mediates between content-type and expected dataType)
  16049. * - returns the corresponding response
  16050. */
  16051. function ajaxHandleResponses( s, jqXHR, responses ) {
  16052. var ct, type, finalDataType, firstDataType,
  16053. contents = s.contents,
  16054. dataTypes = s.dataTypes;
  16055. // Remove auto dataType and get content-type in the process
  16056. while ( dataTypes[ 0 ] === "*" ) {
  16057. dataTypes.shift();
  16058. if ( ct === undefined ) {
  16059. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16060. }
  16061. }
  16062. // Check if we're dealing with a known content-type
  16063. if ( ct ) {
  16064. for ( type in contents ) {
  16065. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16066. dataTypes.unshift( type );
  16067. break;
  16068. }
  16069. }
  16070. }
  16071. // Check to see if we have a response for the expected dataType
  16072. if ( dataTypes[ 0 ] in responses ) {
  16073. finalDataType = dataTypes[ 0 ];
  16074. } else {
  16075. // Try convertible dataTypes
  16076. for ( type in responses ) {
  16077. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16078. finalDataType = type;
  16079. break;
  16080. }
  16081. if ( !firstDataType ) {
  16082. firstDataType = type;
  16083. }
  16084. }
  16085. // Or just use first one
  16086. finalDataType = finalDataType || firstDataType;
  16087. }
  16088. // If we found a dataType
  16089. // We add the dataType to the list if needed
  16090. // and return the corresponding response
  16091. if ( finalDataType ) {
  16092. if ( finalDataType !== dataTypes[ 0 ] ) {
  16093. dataTypes.unshift( finalDataType );
  16094. }
  16095. return responses[ finalDataType ];
  16096. }
  16097. }
  16098. /* Chain conversions given the request and the original response
  16099. * Also sets the responseXXX fields on the jqXHR instance
  16100. */
  16101. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16102. var conv2, current, conv, tmp, prev,
  16103. converters = {},
  16104. // Work with a copy of dataTypes in case we need to modify it for conversion
  16105. dataTypes = s.dataTypes.slice();
  16106. // Create converters map with lowercased keys
  16107. if ( dataTypes[ 1 ] ) {
  16108. for ( conv in s.converters ) {
  16109. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16110. }
  16111. }
  16112. current = dataTypes.shift();
  16113. // Convert to each sequential dataType
  16114. while ( current ) {
  16115. if ( s.responseFields[ current ] ) {
  16116. jqXHR[ s.responseFields[ current ] ] = response;
  16117. }
  16118. // Apply the dataFilter if provided
  16119. if ( !prev && isSuccess && s.dataFilter ) {
  16120. response = s.dataFilter( response, s.dataType );
  16121. }
  16122. prev = current;
  16123. current = dataTypes.shift();
  16124. if ( current ) {
  16125. // There's only work to do if current dataType is non-auto
  16126. if ( current === "*" ) {
  16127. current = prev;
  16128. // Convert response if prev dataType is non-auto and differs from current
  16129. } else if ( prev !== "*" && prev !== current ) {
  16130. // Seek a direct converter
  16131. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16132. // If none found, seek a pair
  16133. if ( !conv ) {
  16134. for ( conv2 in converters ) {
  16135. // If conv2 outputs current
  16136. tmp = conv2.split( " " );
  16137. if ( tmp[ 1 ] === current ) {
  16138. // If prev can be converted to accepted input
  16139. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16140. converters[ "* " + tmp[ 0 ] ];
  16141. if ( conv ) {
  16142. // Condense equivalence converters
  16143. if ( conv === true ) {
  16144. conv = converters[ conv2 ];
  16145. // Otherwise, insert the intermediate dataType
  16146. } else if ( converters[ conv2 ] !== true ) {
  16147. current = tmp[ 0 ];
  16148. dataTypes.unshift( tmp[ 1 ] );
  16149. }
  16150. break;
  16151. }
  16152. }
  16153. }
  16154. }
  16155. // Apply converter (if not an equivalence)
  16156. if ( conv !== true ) {
  16157. // Unless errors are allowed to bubble, catch and return them
  16158. if ( conv && s.throws ) {
  16159. response = conv( response );
  16160. } else {
  16161. try {
  16162. response = conv( response );
  16163. } catch ( e ) {
  16164. return {
  16165. state: "parsererror",
  16166. error: conv ? e : "No conversion from " + prev + " to " + current
  16167. };
  16168. }
  16169. }
  16170. }
  16171. }
  16172. }
  16173. }
  16174. return { state: "success", data: response };
  16175. }
  16176. jQuery.extend( {
  16177. // Counter for holding the number of active queries
  16178. active: 0,
  16179. // Last-Modified header cache for next request
  16180. lastModified: {},
  16181. etag: {},
  16182. ajaxSettings: {
  16183. url: location.href,
  16184. type: "GET",
  16185. isLocal: rlocalProtocol.test( location.protocol ),
  16186. global: true,
  16187. processData: true,
  16188. async: true,
  16189. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16190. /*
  16191. timeout: 0,
  16192. data: null,
  16193. dataType: null,
  16194. username: null,
  16195. password: null,
  16196. cache: null,
  16197. throws: false,
  16198. traditional: false,
  16199. headers: {},
  16200. */
  16201. accepts: {
  16202. "*": allTypes,
  16203. text: "text/plain",
  16204. html: "text/html",
  16205. xml: "application/xml, text/xml",
  16206. json: "application/json, text/javascript"
  16207. },
  16208. contents: {
  16209. xml: /\bxml\b/,
  16210. html: /\bhtml/,
  16211. json: /\bjson\b/
  16212. },
  16213. responseFields: {
  16214. xml: "responseXML",
  16215. text: "responseText",
  16216. json: "responseJSON"
  16217. },
  16218. // Data converters
  16219. // Keys separate source (or catchall "*") and destination types with a single space
  16220. converters: {
  16221. // Convert anything to text
  16222. "* text": String,
  16223. // Text to html (true = no transformation)
  16224. "text html": true,
  16225. // Evaluate text as a json expression
  16226. "text json": JSON.parse,
  16227. // Parse text as xml
  16228. "text xml": jQuery.parseXML
  16229. },
  16230. // For options that shouldn't be deep extended:
  16231. // you can add your own custom options here if
  16232. // and when you create one that shouldn't be
  16233. // deep extended (see ajaxExtend)
  16234. flatOptions: {
  16235. url: true,
  16236. context: true
  16237. }
  16238. },
  16239. // Creates a full fledged settings object into target
  16240. // with both ajaxSettings and settings fields.
  16241. // If target is omitted, writes into ajaxSettings.
  16242. ajaxSetup: function( target, settings ) {
  16243. return settings ?
  16244. // Building a settings object
  16245. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16246. // Extending ajaxSettings
  16247. ajaxExtend( jQuery.ajaxSettings, target );
  16248. },
  16249. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16250. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16251. // Main method
  16252. ajax: function( url, options ) {
  16253. // If url is an object, simulate pre-1.5 signature
  16254. if ( typeof url === "object" ) {
  16255. options = url;
  16256. url = undefined;
  16257. }
  16258. // Force options to be an object
  16259. options = options || {};
  16260. var transport,
  16261. // URL without anti-cache param
  16262. cacheURL,
  16263. // Response headers
  16264. responseHeadersString,
  16265. responseHeaders,
  16266. // timeout handle
  16267. timeoutTimer,
  16268. // Url cleanup var
  16269. urlAnchor,
  16270. // Request state (becomes false upon send and true upon completion)
  16271. completed,
  16272. // To know if global events are to be dispatched
  16273. fireGlobals,
  16274. // Loop variable
  16275. i,
  16276. // uncached part of the url
  16277. uncached,
  16278. // Create the final options object
  16279. s = jQuery.ajaxSetup( {}, options ),
  16280. // Callbacks context
  16281. callbackContext = s.context || s,
  16282. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16283. globalEventContext = s.context &&
  16284. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16285. jQuery( callbackContext ) :
  16286. jQuery.event,
  16287. // Deferreds
  16288. deferred = jQuery.Deferred(),
  16289. completeDeferred = jQuery.Callbacks( "once memory" ),
  16290. // Status-dependent callbacks
  16291. statusCode = s.statusCode || {},
  16292. // Headers (they are sent all at once)
  16293. requestHeaders = {},
  16294. requestHeadersNames = {},
  16295. // Default abort message
  16296. strAbort = "canceled",
  16297. // Fake xhr
  16298. jqXHR = {
  16299. readyState: 0,
  16300. // Builds headers hashtable if needed
  16301. getResponseHeader: function( key ) {
  16302. var match;
  16303. if ( completed ) {
  16304. if ( !responseHeaders ) {
  16305. responseHeaders = {};
  16306. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16307. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16308. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16309. .concat( match[ 2 ] );
  16310. }
  16311. }
  16312. match = responseHeaders[ key.toLowerCase() + " " ];
  16313. }
  16314. return match == null ? null : match.join( ", " );
  16315. },
  16316. // Raw string
  16317. getAllResponseHeaders: function() {
  16318. return completed ? responseHeadersString : null;
  16319. },
  16320. // Caches the header
  16321. setRequestHeader: function( name, value ) {
  16322. if ( completed == null ) {
  16323. name = requestHeadersNames[ name.toLowerCase() ] =
  16324. requestHeadersNames[ name.toLowerCase() ] || name;
  16325. requestHeaders[ name ] = value;
  16326. }
  16327. return this;
  16328. },
  16329. // Overrides response content-type header
  16330. overrideMimeType: function( type ) {
  16331. if ( completed == null ) {
  16332. s.mimeType = type;
  16333. }
  16334. return this;
  16335. },
  16336. // Status-dependent callbacks
  16337. statusCode: function( map ) {
  16338. var code;
  16339. if ( map ) {
  16340. if ( completed ) {
  16341. // Execute the appropriate callbacks
  16342. jqXHR.always( map[ jqXHR.status ] );
  16343. } else {
  16344. // Lazy-add the new callbacks in a way that preserves old ones
  16345. for ( code in map ) {
  16346. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16347. }
  16348. }
  16349. }
  16350. return this;
  16351. },
  16352. // Cancel the request
  16353. abort: function( statusText ) {
  16354. var finalText = statusText || strAbort;
  16355. if ( transport ) {
  16356. transport.abort( finalText );
  16357. }
  16358. done( 0, finalText );
  16359. return this;
  16360. }
  16361. };
  16362. // Attach deferreds
  16363. deferred.promise( jqXHR );
  16364. // Add protocol if not provided (prefilters might expect it)
  16365. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16366. // We also use the url parameter if available
  16367. s.url = ( ( url || s.url || location.href ) + "" )
  16368. .replace( rprotocol, location.protocol + "//" );
  16369. // Alias method option to type as per ticket #12004
  16370. s.type = options.method || options.type || s.method || s.type;
  16371. // Extract dataTypes list
  16372. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16373. // A cross-domain request is in order when the origin doesn't match the current origin.
  16374. if ( s.crossDomain == null ) {
  16375. urlAnchor = document.createElement( "a" );
  16376. // Support: IE <=8 - 11, Edge 12 - 15
  16377. // IE throws exception on accessing the href property if url is malformed,
  16378. // e.g. http://example.com:80x/
  16379. try {
  16380. urlAnchor.href = s.url;
  16381. // Support: IE <=8 - 11 only
  16382. // Anchor's host property isn't correctly set when s.url is relative
  16383. urlAnchor.href = urlAnchor.href;
  16384. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16385. urlAnchor.protocol + "//" + urlAnchor.host;
  16386. } catch ( e ) {
  16387. // If there is an error parsing the URL, assume it is crossDomain,
  16388. // it can be rejected by the transport if it is invalid
  16389. s.crossDomain = true;
  16390. }
  16391. }
  16392. // Convert data if not already a string
  16393. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16394. s.data = jQuery.param( s.data, s.traditional );
  16395. }
  16396. // Apply prefilters
  16397. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16398. // If request was aborted inside a prefilter, stop there
  16399. if ( completed ) {
  16400. return jqXHR;
  16401. }
  16402. // We can fire global events as of now if asked to
  16403. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16404. fireGlobals = jQuery.event && s.global;
  16405. // Watch for a new set of requests
  16406. if ( fireGlobals && jQuery.active++ === 0 ) {
  16407. jQuery.event.trigger( "ajaxStart" );
  16408. }
  16409. // Uppercase the type
  16410. s.type = s.type.toUpperCase();
  16411. // Determine if request has content
  16412. s.hasContent = !rnoContent.test( s.type );
  16413. // Save the URL in case we're toying with the If-Modified-Since
  16414. // and/or If-None-Match header later on
  16415. // Remove hash to simplify url manipulation
  16416. cacheURL = s.url.replace( rhash, "" );
  16417. // More options handling for requests with no content
  16418. if ( !s.hasContent ) {
  16419. // Remember the hash so we can put it back
  16420. uncached = s.url.slice( cacheURL.length );
  16421. // If data is available and should be processed, append data to url
  16422. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16423. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16424. // #9682: remove data so that it's not used in an eventual retry
  16425. delete s.data;
  16426. }
  16427. // Add or update anti-cache param if needed
  16428. if ( s.cache === false ) {
  16429. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16430. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16431. }
  16432. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16433. s.url = cacheURL + uncached;
  16434. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16435. } else if ( s.data && s.processData &&
  16436. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16437. s.data = s.data.replace( r20, "+" );
  16438. }
  16439. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16440. if ( s.ifModified ) {
  16441. if ( jQuery.lastModified[ cacheURL ] ) {
  16442. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16443. }
  16444. if ( jQuery.etag[ cacheURL ] ) {
  16445. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16446. }
  16447. }
  16448. // Set the correct header, if data is being sent
  16449. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16450. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16451. }
  16452. // Set the Accepts header for the server, depending on the dataType
  16453. jqXHR.setRequestHeader(
  16454. "Accept",
  16455. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16456. s.accepts[ s.dataTypes[ 0 ] ] +
  16457. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16458. s.accepts[ "*" ]
  16459. );
  16460. // Check for headers option
  16461. for ( i in s.headers ) {
  16462. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16463. }
  16464. // Allow custom headers/mimetypes and early abort
  16465. if ( s.beforeSend &&
  16466. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16467. // Abort if not done already and return
  16468. return jqXHR.abort();
  16469. }
  16470. // Aborting is no longer a cancellation
  16471. strAbort = "abort";
  16472. // Install callbacks on deferreds
  16473. completeDeferred.add( s.complete );
  16474. jqXHR.done( s.success );
  16475. jqXHR.fail( s.error );
  16476. // Get transport
  16477. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16478. // If no transport, we auto-abort
  16479. if ( !transport ) {
  16480. done( -1, "No Transport" );
  16481. } else {
  16482. jqXHR.readyState = 1;
  16483. // Send global event
  16484. if ( fireGlobals ) {
  16485. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16486. }
  16487. // If request was aborted inside ajaxSend, stop there
  16488. if ( completed ) {
  16489. return jqXHR;
  16490. }
  16491. // Timeout
  16492. if ( s.async && s.timeout > 0 ) {
  16493. timeoutTimer = window.setTimeout( function() {
  16494. jqXHR.abort( "timeout" );
  16495. }, s.timeout );
  16496. }
  16497. try {
  16498. completed = false;
  16499. transport.send( requestHeaders, done );
  16500. } catch ( e ) {
  16501. // Rethrow post-completion exceptions
  16502. if ( completed ) {
  16503. throw e;
  16504. }
  16505. // Propagate others as results
  16506. done( -1, e );
  16507. }
  16508. }
  16509. // Callback for when everything is done
  16510. function done( status, nativeStatusText, responses, headers ) {
  16511. var isSuccess, success, error, response, modified,
  16512. statusText = nativeStatusText;
  16513. // Ignore repeat invocations
  16514. if ( completed ) {
  16515. return;
  16516. }
  16517. completed = true;
  16518. // Clear timeout if it exists
  16519. if ( timeoutTimer ) {
  16520. window.clearTimeout( timeoutTimer );
  16521. }
  16522. // Dereference transport for early garbage collection
  16523. // (no matter how long the jqXHR object will be used)
  16524. transport = undefined;
  16525. // Cache response headers
  16526. responseHeadersString = headers || "";
  16527. // Set readyState
  16528. jqXHR.readyState = status > 0 ? 4 : 0;
  16529. // Determine if successful
  16530. isSuccess = status >= 200 && status < 300 || status === 304;
  16531. // Get response data
  16532. if ( responses ) {
  16533. response = ajaxHandleResponses( s, jqXHR, responses );
  16534. }
  16535. // Convert no matter what (that way responseXXX fields are always set)
  16536. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16537. // If successful, handle type chaining
  16538. if ( isSuccess ) {
  16539. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16540. if ( s.ifModified ) {
  16541. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16542. if ( modified ) {
  16543. jQuery.lastModified[ cacheURL ] = modified;
  16544. }
  16545. modified = jqXHR.getResponseHeader( "etag" );
  16546. if ( modified ) {
  16547. jQuery.etag[ cacheURL ] = modified;
  16548. }
  16549. }
  16550. // if no content
  16551. if ( status === 204 || s.type === "HEAD" ) {
  16552. statusText = "nocontent";
  16553. // if not modified
  16554. } else if ( status === 304 ) {
  16555. statusText = "notmodified";
  16556. // If we have data, let's convert it
  16557. } else {
  16558. statusText = response.state;
  16559. success = response.data;
  16560. error = response.error;
  16561. isSuccess = !error;
  16562. }
  16563. } else {
  16564. // Extract error from statusText and normalize for non-aborts
  16565. error = statusText;
  16566. if ( status || !statusText ) {
  16567. statusText = "error";
  16568. if ( status < 0 ) {
  16569. status = 0;
  16570. }
  16571. }
  16572. }
  16573. // Set data for the fake xhr object
  16574. jqXHR.status = status;
  16575. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16576. // Success/Error
  16577. if ( isSuccess ) {
  16578. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16579. } else {
  16580. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16581. }
  16582. // Status-dependent callbacks
  16583. jqXHR.statusCode( statusCode );
  16584. statusCode = undefined;
  16585. if ( fireGlobals ) {
  16586. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16587. [ jqXHR, s, isSuccess ? success : error ] );
  16588. }
  16589. // Complete
  16590. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16591. if ( fireGlobals ) {
  16592. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16593. // Handle the global AJAX counter
  16594. if ( !( --jQuery.active ) ) {
  16595. jQuery.event.trigger( "ajaxStop" );
  16596. }
  16597. }
  16598. }
  16599. return jqXHR;
  16600. },
  16601. getJSON: function( url, data, callback ) {
  16602. return jQuery.get( url, data, callback, "json" );
  16603. },
  16604. getScript: function( url, callback ) {
  16605. return jQuery.get( url, undefined, callback, "script" );
  16606. }
  16607. } );
  16608. jQuery.each( [ "get", "post" ], function( i, method ) {
  16609. jQuery[ method ] = function( url, data, callback, type ) {
  16610. // Shift arguments if data argument was omitted
  16611. if ( isFunction( data ) ) {
  16612. type = type || callback;
  16613. callback = data;
  16614. data = undefined;
  16615. }
  16616. // The url can be an options object (which then must have .url)
  16617. return jQuery.ajax( jQuery.extend( {
  16618. url: url,
  16619. type: method,
  16620. dataType: type,
  16621. data: data,
  16622. success: callback
  16623. }, jQuery.isPlainObject( url ) && url ) );
  16624. };
  16625. } );
  16626. jQuery._evalUrl = function( url, options ) {
  16627. return jQuery.ajax( {
  16628. url: url,
  16629. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16630. type: "GET",
  16631. dataType: "script",
  16632. cache: true,
  16633. async: false,
  16634. global: false,
  16635. // Only evaluate the response if it is successful (gh-4126)
  16636. // dataFilter is not invoked for failure responses, so using it instead
  16637. // of the default converter is kludgy but it works.
  16638. converters: {
  16639. "text script": function() {}
  16640. },
  16641. dataFilter: function( response ) {
  16642. jQuery.globalEval( response, options );
  16643. }
  16644. } );
  16645. };
  16646. jQuery.fn.extend( {
  16647. wrapAll: function( html ) {
  16648. var wrap;
  16649. if ( this[ 0 ] ) {
  16650. if ( isFunction( html ) ) {
  16651. html = html.call( this[ 0 ] );
  16652. }
  16653. // The elements to wrap the target around
  16654. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16655. if ( this[ 0 ].parentNode ) {
  16656. wrap.insertBefore( this[ 0 ] );
  16657. }
  16658. wrap.map( function() {
  16659. var elem = this;
  16660. while ( elem.firstElementChild ) {
  16661. elem = elem.firstElementChild;
  16662. }
  16663. return elem;
  16664. } ).append( this );
  16665. }
  16666. return this;
  16667. },
  16668. wrapInner: function( html ) {
  16669. if ( isFunction( html ) ) {
  16670. return this.each( function( i ) {
  16671. jQuery( this ).wrapInner( html.call( this, i ) );
  16672. } );
  16673. }
  16674. return this.each( function() {
  16675. var self = jQuery( this ),
  16676. contents = self.contents();
  16677. if ( contents.length ) {
  16678. contents.wrapAll( html );
  16679. } else {
  16680. self.append( html );
  16681. }
  16682. } );
  16683. },
  16684. wrap: function( html ) {
  16685. var htmlIsFunction = isFunction( html );
  16686. return this.each( function( i ) {
  16687. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16688. } );
  16689. },
  16690. unwrap: function( selector ) {
  16691. this.parent( selector ).not( "body" ).each( function() {
  16692. jQuery( this ).replaceWith( this.childNodes );
  16693. } );
  16694. return this;
  16695. }
  16696. } );
  16697. jQuery.expr.pseudos.hidden = function( elem ) {
  16698. return !jQuery.expr.pseudos.visible( elem );
  16699. };
  16700. jQuery.expr.pseudos.visible = function( elem ) {
  16701. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16702. };
  16703. jQuery.ajaxSettings.xhr = function() {
  16704. try {
  16705. return new window.XMLHttpRequest();
  16706. } catch ( e ) {}
  16707. };
  16708. var xhrSuccessStatus = {
  16709. // File protocol always yields status code 0, assume 200
  16710. 0: 200,
  16711. // Support: IE <=9 only
  16712. // #1450: sometimes IE returns 1223 when it should be 204
  16713. 1223: 204
  16714. },
  16715. xhrSupported = jQuery.ajaxSettings.xhr();
  16716. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16717. support.ajax = xhrSupported = !!xhrSupported;
  16718. jQuery.ajaxTransport( function( options ) {
  16719. var callback, errorCallback;
  16720. // Cross domain only allowed if supported through XMLHttpRequest
  16721. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16722. return {
  16723. send: function( headers, complete ) {
  16724. var i,
  16725. xhr = options.xhr();
  16726. xhr.open(
  16727. options.type,
  16728. options.url,
  16729. options.async,
  16730. options.username,
  16731. options.password
  16732. );
  16733. // Apply custom fields if provided
  16734. if ( options.xhrFields ) {
  16735. for ( i in options.xhrFields ) {
  16736. xhr[ i ] = options.xhrFields[ i ];
  16737. }
  16738. }
  16739. // Override mime type if needed
  16740. if ( options.mimeType && xhr.overrideMimeType ) {
  16741. xhr.overrideMimeType( options.mimeType );
  16742. }
  16743. // X-Requested-With header
  16744. // For cross-domain requests, seeing as conditions for a preflight are
  16745. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16746. // (it can always be set on a per-request basis or even using ajaxSetup)
  16747. // For same-domain requests, won't change header if already provided.
  16748. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16749. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16750. }
  16751. // Set headers
  16752. for ( i in headers ) {
  16753. xhr.setRequestHeader( i, headers[ i ] );
  16754. }
  16755. // Callback
  16756. callback = function( type ) {
  16757. return function() {
  16758. if ( callback ) {
  16759. callback = errorCallback = xhr.onload =
  16760. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16761. xhr.onreadystatechange = null;
  16762. if ( type === "abort" ) {
  16763. xhr.abort();
  16764. } else if ( type === "error" ) {
  16765. // Support: IE <=9 only
  16766. // On a manual native abort, IE9 throws
  16767. // errors on any property access that is not readyState
  16768. if ( typeof xhr.status !== "number" ) {
  16769. complete( 0, "error" );
  16770. } else {
  16771. complete(
  16772. // File: protocol always yields status 0; see #8605, #14207
  16773. xhr.status,
  16774. xhr.statusText
  16775. );
  16776. }
  16777. } else {
  16778. complete(
  16779. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16780. xhr.statusText,
  16781. // Support: IE <=9 only
  16782. // IE9 has no XHR2 but throws on binary (trac-11426)
  16783. // For XHR2 non-text, let the caller handle it (gh-2498)
  16784. ( xhr.responseType || "text" ) !== "text" ||
  16785. typeof xhr.responseText !== "string" ?
  16786. { binary: xhr.response } :
  16787. { text: xhr.responseText },
  16788. xhr.getAllResponseHeaders()
  16789. );
  16790. }
  16791. }
  16792. };
  16793. };
  16794. // Listen to events
  16795. xhr.onload = callback();
  16796. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16797. // Support: IE 9 only
  16798. // Use onreadystatechange to replace onabort
  16799. // to handle uncaught aborts
  16800. if ( xhr.onabort !== undefined ) {
  16801. xhr.onabort = errorCallback;
  16802. } else {
  16803. xhr.onreadystatechange = function() {
  16804. // Check readyState before timeout as it changes
  16805. if ( xhr.readyState === 4 ) {
  16806. // Allow onerror to be called first,
  16807. // but that will not handle a native abort
  16808. // Also, save errorCallback to a variable
  16809. // as xhr.onerror cannot be accessed
  16810. window.setTimeout( function() {
  16811. if ( callback ) {
  16812. errorCallback();
  16813. }
  16814. } );
  16815. }
  16816. };
  16817. }
  16818. // Create the abort callback
  16819. callback = callback( "abort" );
  16820. try {
  16821. // Do send the request (this may raise an exception)
  16822. xhr.send( options.hasContent && options.data || null );
  16823. } catch ( e ) {
  16824. // #14683: Only rethrow if this hasn't been notified as an error yet
  16825. if ( callback ) {
  16826. throw e;
  16827. }
  16828. }
  16829. },
  16830. abort: function() {
  16831. if ( callback ) {
  16832. callback();
  16833. }
  16834. }
  16835. };
  16836. }
  16837. } );
  16838. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16839. jQuery.ajaxPrefilter( function( s ) {
  16840. if ( s.crossDomain ) {
  16841. s.contents.script = false;
  16842. }
  16843. } );
  16844. // Install script dataType
  16845. jQuery.ajaxSetup( {
  16846. accepts: {
  16847. script: "text/javascript, application/javascript, " +
  16848. "application/ecmascript, application/x-ecmascript"
  16849. },
  16850. contents: {
  16851. script: /\b(?:java|ecma)script\b/
  16852. },
  16853. converters: {
  16854. "text script": function( text ) {
  16855. jQuery.globalEval( text );
  16856. return text;
  16857. }
  16858. }
  16859. } );
  16860. // Handle cache's special case and crossDomain
  16861. jQuery.ajaxPrefilter( "script", function( s ) {
  16862. if ( s.cache === undefined ) {
  16863. s.cache = false;
  16864. }
  16865. if ( s.crossDomain ) {
  16866. s.type = "GET";
  16867. }
  16868. } );
  16869. // Bind script tag hack transport
  16870. jQuery.ajaxTransport( "script", function( s ) {
  16871. // This transport only deals with cross domain or forced-by-attrs requests
  16872. if ( s.crossDomain || s.scriptAttrs ) {
  16873. var script, callback;
  16874. return {
  16875. send: function( _, complete ) {
  16876. script = jQuery( "<script>" )
  16877. .attr( s.scriptAttrs || {} )
  16878. .prop( { charset: s.scriptCharset, src: s.url } )
  16879. .on( "load error", callback = function( evt ) {
  16880. script.remove();
  16881. callback = null;
  16882. if ( evt ) {
  16883. complete( evt.type === "error" ? 404 : 200, evt.type );
  16884. }
  16885. } );
  16886. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16887. document.head.appendChild( script[ 0 ] );
  16888. },
  16889. abort: function() {
  16890. if ( callback ) {
  16891. callback();
  16892. }
  16893. }
  16894. };
  16895. }
  16896. } );
  16897. var oldCallbacks = [],
  16898. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16899. // Default jsonp settings
  16900. jQuery.ajaxSetup( {
  16901. jsonp: "callback",
  16902. jsonpCallback: function() {
  16903. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16904. this[ callback ] = true;
  16905. return callback;
  16906. }
  16907. } );
  16908. // Detect, normalize options and install callbacks for jsonp requests
  16909. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16910. var callbackName, overwritten, responseContainer,
  16911. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16912. "url" :
  16913. typeof s.data === "string" &&
  16914. ( s.contentType || "" )
  16915. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16916. rjsonp.test( s.data ) && "data"
  16917. );
  16918. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16919. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16920. // Get callback name, remembering preexisting value associated with it
  16921. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16922. s.jsonpCallback() :
  16923. s.jsonpCallback;
  16924. // Insert callback into url or form data
  16925. if ( jsonProp ) {
  16926. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16927. } else if ( s.jsonp !== false ) {
  16928. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16929. }
  16930. // Use data converter to retrieve json after script execution
  16931. s.converters[ "script json" ] = function() {
  16932. if ( !responseContainer ) {
  16933. jQuery.error( callbackName + " was not called" );
  16934. }
  16935. return responseContainer[ 0 ];
  16936. };
  16937. // Force json dataType
  16938. s.dataTypes[ 0 ] = "json";
  16939. // Install callback
  16940. overwritten = window[ callbackName ];
  16941. window[ callbackName ] = function() {
  16942. responseContainer = arguments;
  16943. };
  16944. // Clean-up function (fires after converters)
  16945. jqXHR.always( function() {
  16946. // If previous value didn't exist - remove it
  16947. if ( overwritten === undefined ) {
  16948. jQuery( window ).removeProp( callbackName );
  16949. // Otherwise restore preexisting value
  16950. } else {
  16951. window[ callbackName ] = overwritten;
  16952. }
  16953. // Save back as free
  16954. if ( s[ callbackName ] ) {
  16955. // Make sure that re-using the options doesn't screw things around
  16956. s.jsonpCallback = originalSettings.jsonpCallback;
  16957. // Save the callback name for future use
  16958. oldCallbacks.push( callbackName );
  16959. }
  16960. // Call if it was a function and we have a response
  16961. if ( responseContainer && isFunction( overwritten ) ) {
  16962. overwritten( responseContainer[ 0 ] );
  16963. }
  16964. responseContainer = overwritten = undefined;
  16965. } );
  16966. // Delegate to script
  16967. return "script";
  16968. }
  16969. } );
  16970. // Support: Safari 8 only
  16971. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16972. // collapse sibling forms: the second one becomes a child of the first one.
  16973. // Because of that, this security measure has to be disabled in Safari 8.
  16974. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16975. support.createHTMLDocument = ( function() {
  16976. var body = document.implementation.createHTMLDocument( "" ).body;
  16977. body.innerHTML = "<form></form><form></form>";
  16978. return body.childNodes.length === 2;
  16979. } )();
  16980. // Argument "data" should be string of html
  16981. // context (optional): If specified, the fragment will be created in this context,
  16982. // defaults to document
  16983. // keepScripts (optional): If true, will include scripts passed in the html string
  16984. jQuery.parseHTML = function( data, context, keepScripts ) {
  16985. if ( typeof data !== "string" ) {
  16986. return [];
  16987. }
  16988. if ( typeof context === "boolean" ) {
  16989. keepScripts = context;
  16990. context = false;
  16991. }
  16992. var base, parsed, scripts;
  16993. if ( !context ) {
  16994. // Stop scripts or inline event handlers from being executed immediately
  16995. // by using document.implementation
  16996. if ( support.createHTMLDocument ) {
  16997. context = document.implementation.createHTMLDocument( "" );
  16998. // Set the base href for the created document
  16999. // so any parsed elements with URLs
  17000. // are based on the document's URL (gh-2965)
  17001. base = context.createElement( "base" );
  17002. base.href = document.location.href;
  17003. context.head.appendChild( base );
  17004. } else {
  17005. context = document;
  17006. }
  17007. }
  17008. parsed = rsingleTag.exec( data );
  17009. scripts = !keepScripts && [];
  17010. // Single tag
  17011. if ( parsed ) {
  17012. return [ context.createElement( parsed[ 1 ] ) ];
  17013. }
  17014. parsed = buildFragment( [ data ], context, scripts );
  17015. if ( scripts && scripts.length ) {
  17016. jQuery( scripts ).remove();
  17017. }
  17018. return jQuery.merge( [], parsed.childNodes );
  17019. };
  17020. /**
  17021. * Load a url into a page
  17022. */
  17023. jQuery.fn.load = function( url, params, callback ) {
  17024. var selector, type, response,
  17025. self = this,
  17026. off = url.indexOf( " " );
  17027. if ( off > -1 ) {
  17028. selector = stripAndCollapse( url.slice( off ) );
  17029. url = url.slice( 0, off );
  17030. }
  17031. // If it's a function
  17032. if ( isFunction( params ) ) {
  17033. // We assume that it's the callback
  17034. callback = params;
  17035. params = undefined;
  17036. // Otherwise, build a param string
  17037. } else if ( params && typeof params === "object" ) {
  17038. type = "POST";
  17039. }
  17040. // If we have elements to modify, make the request
  17041. if ( self.length > 0 ) {
  17042. jQuery.ajax( {
  17043. url: url,
  17044. // If "type" variable is undefined, then "GET" method will be used.
  17045. // Make value of this field explicit since
  17046. // user can override it through ajaxSetup method
  17047. type: type || "GET",
  17048. dataType: "html",
  17049. data: params
  17050. } ).done( function( responseText ) {
  17051. // Save response for use in complete callback
  17052. response = arguments;
  17053. self.html( selector ?
  17054. // If a selector was specified, locate the right elements in a dummy div
  17055. // Exclude scripts to avoid IE 'Permission Denied' errors
  17056. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17057. // Otherwise use the full result
  17058. responseText );
  17059. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17060. // but they are ignored because response was set above.
  17061. // If it fails, this function gets "jqXHR", "status", "error"
  17062. } ).always( callback && function( jqXHR, status ) {
  17063. self.each( function() {
  17064. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17065. } );
  17066. } );
  17067. }
  17068. return this;
  17069. };
  17070. // Attach a bunch of functions for handling common AJAX events
  17071. jQuery.each( [
  17072. "ajaxStart",
  17073. "ajaxStop",
  17074. "ajaxComplete",
  17075. "ajaxError",
  17076. "ajaxSuccess",
  17077. "ajaxSend"
  17078. ], function( i, type ) {
  17079. jQuery.fn[ type ] = function( fn ) {
  17080. return this.on( type, fn );
  17081. };
  17082. } );
  17083. jQuery.expr.pseudos.animated = function( elem ) {
  17084. return jQuery.grep( jQuery.timers, function( fn ) {
  17085. return elem === fn.elem;
  17086. } ).length;
  17087. };
  17088. jQuery.offset = {
  17089. setOffset: function( elem, options, i ) {
  17090. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17091. position = jQuery.css( elem, "position" ),
  17092. curElem = jQuery( elem ),
  17093. props = {};
  17094. // Set position first, in-case top/left are set even on static elem
  17095. if ( position === "static" ) {
  17096. elem.style.position = "relative";
  17097. }
  17098. curOffset = curElem.offset();
  17099. curCSSTop = jQuery.css( elem, "top" );
  17100. curCSSLeft = jQuery.css( elem, "left" );
  17101. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17102. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17103. // Need to be able to calculate position if either
  17104. // top or left is auto and position is either absolute or fixed
  17105. if ( calculatePosition ) {
  17106. curPosition = curElem.position();
  17107. curTop = curPosition.top;
  17108. curLeft = curPosition.left;
  17109. } else {
  17110. curTop = parseFloat( curCSSTop ) || 0;
  17111. curLeft = parseFloat( curCSSLeft ) || 0;
  17112. }
  17113. if ( isFunction( options ) ) {
  17114. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17115. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17116. }
  17117. if ( options.top != null ) {
  17118. props.top = ( options.top - curOffset.top ) + curTop;
  17119. }
  17120. if ( options.left != null ) {
  17121. props.left = ( options.left - curOffset.left ) + curLeft;
  17122. }
  17123. if ( "using" in options ) {
  17124. options.using.call( elem, props );
  17125. } else {
  17126. curElem.css( props );
  17127. }
  17128. }
  17129. };
  17130. jQuery.fn.extend( {
  17131. // offset() relates an element's border box to the document origin
  17132. offset: function( options ) {
  17133. // Preserve chaining for setter
  17134. if ( arguments.length ) {
  17135. return options === undefined ?
  17136. this :
  17137. this.each( function( i ) {
  17138. jQuery.offset.setOffset( this, options, i );
  17139. } );
  17140. }
  17141. var rect, win,
  17142. elem = this[ 0 ];
  17143. if ( !elem ) {
  17144. return;
  17145. }
  17146. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17147. // Support: IE <=11 only
  17148. // Running getBoundingClientRect on a
  17149. // disconnected node in IE throws an error
  17150. if ( !elem.getClientRects().length ) {
  17151. return { top: 0, left: 0 };
  17152. }
  17153. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17154. rect = elem.getBoundingClientRect();
  17155. win = elem.ownerDocument.defaultView;
  17156. return {
  17157. top: rect.top + win.pageYOffset,
  17158. left: rect.left + win.pageXOffset
  17159. };
  17160. },
  17161. // position() relates an element's margin box to its offset parent's padding box
  17162. // This corresponds to the behavior of CSS absolute positioning
  17163. position: function() {
  17164. if ( !this[ 0 ] ) {
  17165. return;
  17166. }
  17167. var offsetParent, offset, doc,
  17168. elem = this[ 0 ],
  17169. parentOffset = { top: 0, left: 0 };
  17170. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17171. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17172. // Assume position:fixed implies availability of getBoundingClientRect
  17173. offset = elem.getBoundingClientRect();
  17174. } else {
  17175. offset = this.offset();
  17176. // Account for the *real* offset parent, which can be the document or its root element
  17177. // when a statically positioned element is identified
  17178. doc = elem.ownerDocument;
  17179. offsetParent = elem.offsetParent || doc.documentElement;
  17180. while ( offsetParent &&
  17181. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17182. jQuery.css( offsetParent, "position" ) === "static" ) {
  17183. offsetParent = offsetParent.parentNode;
  17184. }
  17185. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17186. // Incorporate borders into its offset, since they are outside its content origin
  17187. parentOffset = jQuery( offsetParent ).offset();
  17188. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17189. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17190. }
  17191. }
  17192. // Subtract parent offsets and element margins
  17193. return {
  17194. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17195. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17196. };
  17197. },
  17198. // This method will return documentElement in the following cases:
  17199. // 1) For the element inside the iframe without offsetParent, this method will return
  17200. // documentElement of the parent window
  17201. // 2) For the hidden or detached element
  17202. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17203. //
  17204. // but those exceptions were never presented as a real life use-cases
  17205. // and might be considered as more preferable results.
  17206. //
  17207. // This logic, however, is not guaranteed and can change at any point in the future
  17208. offsetParent: function() {
  17209. return this.map( function() {
  17210. var offsetParent = this.offsetParent;
  17211. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17212. offsetParent = offsetParent.offsetParent;
  17213. }
  17214. return offsetParent || documentElement;
  17215. } );
  17216. }
  17217. } );
  17218. // Create scrollLeft and scrollTop methods
  17219. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17220. var top = "pageYOffset" === prop;
  17221. jQuery.fn[ method ] = function( val ) {
  17222. return access( this, function( elem, method, val ) {
  17223. // Coalesce documents and windows
  17224. var win;
  17225. if ( isWindow( elem ) ) {
  17226. win = elem;
  17227. } else if ( elem.nodeType === 9 ) {
  17228. win = elem.defaultView;
  17229. }
  17230. if ( val === undefined ) {
  17231. return win ? win[ prop ] : elem[ method ];
  17232. }
  17233. if ( win ) {
  17234. win.scrollTo(
  17235. !top ? val : win.pageXOffset,
  17236. top ? val : win.pageYOffset
  17237. );
  17238. } else {
  17239. elem[ method ] = val;
  17240. }
  17241. }, method, val, arguments.length );
  17242. };
  17243. } );
  17244. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17245. // Add the top/left cssHooks using jQuery.fn.position
  17246. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17247. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17248. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17249. // rather than make the css module depend on the offset module, just check for it here
  17250. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17251. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17252. function( elem, computed ) {
  17253. if ( computed ) {
  17254. computed = curCSS( elem, prop );
  17255. // If curCSS returns percentage, fallback to offset
  17256. return rnumnonpx.test( computed ) ?
  17257. jQuery( elem ).position()[ prop ] + "px" :
  17258. computed;
  17259. }
  17260. }
  17261. );
  17262. } );
  17263. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17264. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17265. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17266. function( defaultExtra, funcName ) {
  17267. // Margin is only for outerHeight, outerWidth
  17268. jQuery.fn[ funcName ] = function( margin, value ) {
  17269. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17270. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17271. return access( this, function( elem, type, value ) {
  17272. var doc;
  17273. if ( isWindow( elem ) ) {
  17274. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17275. return funcName.indexOf( "outer" ) === 0 ?
  17276. elem[ "inner" + name ] :
  17277. elem.document.documentElement[ "client" + name ];
  17278. }
  17279. // Get document width or height
  17280. if ( elem.nodeType === 9 ) {
  17281. doc = elem.documentElement;
  17282. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17283. // whichever is greatest
  17284. return Math.max(
  17285. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17286. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17287. doc[ "client" + name ]
  17288. );
  17289. }
  17290. return value === undefined ?
  17291. // Get width or height on the element, requesting but not forcing parseFloat
  17292. jQuery.css( elem, type, extra ) :
  17293. // Set width or height on the element
  17294. jQuery.style( elem, type, value, extra );
  17295. }, type, chainable ? margin : undefined, chainable );
  17296. };
  17297. } );
  17298. } );
  17299. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17300. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17301. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17302. function( i, name ) {
  17303. // Handle event binding
  17304. jQuery.fn[ name ] = function( data, fn ) {
  17305. return arguments.length > 0 ?
  17306. this.on( name, null, data, fn ) :
  17307. this.trigger( name );
  17308. };
  17309. } );
  17310. jQuery.fn.extend( {
  17311. hover: function( fnOver, fnOut ) {
  17312. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17313. }
  17314. } );
  17315. jQuery.fn.extend( {
  17316. bind: function( types, data, fn ) {
  17317. return this.on( types, null, data, fn );
  17318. },
  17319. unbind: function( types, fn ) {
  17320. return this.off( types, null, fn );
  17321. },
  17322. delegate: function( selector, types, data, fn ) {
  17323. return this.on( types, selector, data, fn );
  17324. },
  17325. undelegate: function( selector, types, fn ) {
  17326. // ( namespace ) or ( selector, types [, fn] )
  17327. return arguments.length === 1 ?
  17328. this.off( selector, "**" ) :
  17329. this.off( types, selector || "**", fn );
  17330. }
  17331. } );
  17332. // Bind a function to a context, optionally partially applying any
  17333. // arguments.
  17334. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17335. // However, it is not slated for removal any time soon
  17336. jQuery.proxy = function( fn, context ) {
  17337. var tmp, args, proxy;
  17338. if ( typeof context === "string" ) {
  17339. tmp = fn[ context ];
  17340. context = fn;
  17341. fn = tmp;
  17342. }
  17343. // Quick check to determine if target is callable, in the spec
  17344. // this throws a TypeError, but we will just return undefined.
  17345. if ( !isFunction( fn ) ) {
  17346. return undefined;
  17347. }
  17348. // Simulated bind
  17349. args = slice.call( arguments, 2 );
  17350. proxy = function() {
  17351. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17352. };
  17353. // Set the guid of unique handler to the same of original handler, so it can be removed
  17354. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17355. return proxy;
  17356. };
  17357. jQuery.holdReady = function( hold ) {
  17358. if ( hold ) {
  17359. jQuery.readyWait++;
  17360. } else {
  17361. jQuery.ready( true );
  17362. }
  17363. };
  17364. jQuery.isArray = Array.isArray;
  17365. jQuery.parseJSON = JSON.parse;
  17366. jQuery.nodeName = nodeName;
  17367. jQuery.isFunction = isFunction;
  17368. jQuery.isWindow = isWindow;
  17369. jQuery.camelCase = camelCase;
  17370. jQuery.type = toType;
  17371. jQuery.now = Date.now;
  17372. jQuery.isNumeric = function( obj ) {
  17373. // As of jQuery 3.0, isNumeric is limited to
  17374. // strings and numbers (primitives or objects)
  17375. // that can be coerced to finite numbers (gh-2662)
  17376. var type = jQuery.type( obj );
  17377. return ( type === "number" || type === "string" ) &&
  17378. // parseFloat NaNs numeric-cast false positives ("")
  17379. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17380. // subtraction forces infinities to NaN
  17381. !isNaN( obj - parseFloat( obj ) );
  17382. };
  17383. // Register as a named AMD module, since jQuery can be concatenated with other
  17384. // files that may use define, but not via a proper concatenation script that
  17385. // understands anonymous AMD modules. A named AMD is safest and most robust
  17386. // way to register. Lowercase jquery is used because AMD module names are
  17387. // derived from file names, and jQuery is normally delivered in a lowercase
  17388. // file name. Do this after creating the global so that if an AMD module wants
  17389. // to call noConflict to hide this version of jQuery, it will work.
  17390. // Note that for maximum portability, libraries that are not jQuery should
  17391. // declare themselves as anonymous modules, and avoid setting a global if an
  17392. // AMD loader is present. jQuery is a special case. For more information, see
  17393. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17394. if ( true ) {
  17395. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17396. return jQuery;
  17397. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17398. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17399. }
  17400. var
  17401. // Map over jQuery in case of overwrite
  17402. _jQuery = window.jQuery,
  17403. // Map over the $ in case of overwrite
  17404. _$ = window.$;
  17405. jQuery.noConflict = function( deep ) {
  17406. if ( window.$ === jQuery ) {
  17407. window.$ = _$;
  17408. }
  17409. if ( deep && window.jQuery === jQuery ) {
  17410. window.jQuery = _jQuery;
  17411. }
  17412. return jQuery;
  17413. };
  17414. // Expose jQuery and $ identifiers, even in AMD
  17415. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17416. // and CommonJS for browser emulators (#13566)
  17417. if ( !noGlobal ) {
  17418. window.jQuery = window.$ = jQuery;
  17419. }
  17420. return jQuery;
  17421. } );
  17422. /***/ }),
  17423. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17424. /*!************************************************!*\
  17425. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17426. \************************************************/
  17427. /*! exports provided: default */
  17428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17429. "use strict";
  17430. __webpack_require__.r(__webpack_exports__);
  17431. var classCallCheck = function (instance, Constructor) {
  17432. if (!(instance instanceof Constructor)) {
  17433. throw new TypeError("Cannot call a class as a function");
  17434. }
  17435. };
  17436. var createClass = function () {
  17437. function defineProperties(target, props) {
  17438. for (var i = 0; i < props.length; i++) {
  17439. var descriptor = props[i];
  17440. descriptor.enumerable = descriptor.enumerable || false;
  17441. descriptor.configurable = true;
  17442. if ("value" in descriptor) descriptor.writable = true;
  17443. Object.defineProperty(target, descriptor.key, descriptor);
  17444. }
  17445. }
  17446. return function (Constructor, protoProps, staticProps) {
  17447. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17448. if (staticProps) defineProperties(Constructor, staticProps);
  17449. return Constructor;
  17450. };
  17451. }();
  17452. var _extends = Object.assign || function (target) {
  17453. for (var i = 1; i < arguments.length; i++) {
  17454. var source = arguments[i];
  17455. for (var key in source) {
  17456. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17457. target[key] = source[key];
  17458. }
  17459. }
  17460. }
  17461. return target;
  17462. };
  17463. var inherits = function (subClass, superClass) {
  17464. if (typeof superClass !== "function" && superClass !== null) {
  17465. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17466. }
  17467. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17468. constructor: {
  17469. value: subClass,
  17470. enumerable: false,
  17471. writable: true,
  17472. configurable: true
  17473. }
  17474. });
  17475. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17476. };
  17477. var possibleConstructorReturn = function (self, call) {
  17478. if (!self) {
  17479. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17480. }
  17481. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17482. };
  17483. var Connector = function () {
  17484. /**
  17485. * Create a new class instance.
  17486. */
  17487. function Connector(options) {
  17488. classCallCheck(this, Connector);
  17489. /**
  17490. * Default connector options.
  17491. */
  17492. this._defaultOptions = {
  17493. auth: {
  17494. headers: {}
  17495. },
  17496. authEndpoint: '/broadcasting/auth',
  17497. broadcaster: 'pusher',
  17498. csrfToken: null,
  17499. host: null,
  17500. key: null,
  17501. namespace: 'App.Events'
  17502. };
  17503. this.setOptions(options);
  17504. this.connect();
  17505. }
  17506. /**
  17507. * Merge the custom options with the defaults.
  17508. */
  17509. createClass(Connector, [{
  17510. key: 'setOptions',
  17511. value: function setOptions(options) {
  17512. this.options = _extends(this._defaultOptions, options);
  17513. if (this.csrfToken()) {
  17514. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17515. }
  17516. return options;
  17517. }
  17518. /**
  17519. * Extract the CSRF token from the page.
  17520. */
  17521. }, {
  17522. key: 'csrfToken',
  17523. value: function csrfToken() {
  17524. var selector = void 0;
  17525. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17526. return window['Laravel'].csrfToken;
  17527. } else if (this.options.csrfToken) {
  17528. return this.options.csrfToken;
  17529. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17530. return selector.getAttribute('content');
  17531. }
  17532. return null;
  17533. }
  17534. }]);
  17535. return Connector;
  17536. }();
  17537. /**
  17538. * This class represents a basic channel.
  17539. */
  17540. var Channel = function () {
  17541. function Channel() {
  17542. classCallCheck(this, Channel);
  17543. }
  17544. createClass(Channel, [{
  17545. key: 'listenForWhisper',
  17546. /**
  17547. * Listen for a whisper event on the channel instance.
  17548. */
  17549. value: function listenForWhisper(event, callback) {
  17550. return this.listen('.client-' + event, callback);
  17551. }
  17552. /**
  17553. * Listen for an event on the channel instance.
  17554. */
  17555. }, {
  17556. key: 'notification',
  17557. value: function notification(callback) {
  17558. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17559. }
  17560. /**
  17561. * Stop listening for a whispser event on the channel instance.
  17562. */
  17563. }, {
  17564. key: 'stopListeningForWhisper',
  17565. value: function stopListeningForWhisper(event) {
  17566. return this.stopListening('.client-' + event);
  17567. }
  17568. }]);
  17569. return Channel;
  17570. }();
  17571. /**
  17572. * Event name formatter
  17573. */
  17574. var EventFormatter = function () {
  17575. /**
  17576. * Create a new class instance.
  17577. */
  17578. function EventFormatter(namespace) {
  17579. classCallCheck(this, EventFormatter);
  17580. this.setNamespace(namespace);
  17581. }
  17582. /**
  17583. * Format the given event name.
  17584. */
  17585. createClass(EventFormatter, [{
  17586. key: 'format',
  17587. value: function format(event) {
  17588. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17589. return event.substr(1);
  17590. } else if (this.namespace) {
  17591. event = this.namespace + '.' + event;
  17592. }
  17593. return event.replace(/\./g, '\\');
  17594. }
  17595. /**
  17596. * Set the event namespace.
  17597. */
  17598. }, {
  17599. key: 'setNamespace',
  17600. value: function setNamespace(value) {
  17601. this.namespace = value;
  17602. }
  17603. }]);
  17604. return EventFormatter;
  17605. }();
  17606. /**
  17607. * This class represents a Pusher channel.
  17608. */
  17609. var PusherChannel = function (_Channel) {
  17610. inherits(PusherChannel, _Channel);
  17611. /**
  17612. * Create a new class instance.
  17613. */
  17614. function PusherChannel(pusher, name, options) {
  17615. classCallCheck(this, PusherChannel);
  17616. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17617. _this.name = name;
  17618. _this.pusher = pusher;
  17619. _this.options = options;
  17620. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17621. _this.subscribe();
  17622. return _this;
  17623. }
  17624. /**
  17625. * Subscribe to a Pusher channel.
  17626. */
  17627. createClass(PusherChannel, [{
  17628. key: 'subscribe',
  17629. value: function subscribe() {
  17630. this.subscription = this.pusher.subscribe(this.name);
  17631. }
  17632. /**
  17633. * Unsubscribe from a Pusher channel.
  17634. */
  17635. }, {
  17636. key: 'unsubscribe',
  17637. value: function unsubscribe() {
  17638. this.pusher.unsubscribe(this.name);
  17639. }
  17640. /**
  17641. * Listen for an event on the channel instance.
  17642. */
  17643. }, {
  17644. key: 'listen',
  17645. value: function listen(event, callback) {
  17646. this.on(this.eventFormatter.format(event), callback);
  17647. return this;
  17648. }
  17649. /**
  17650. * Stop listening for an event on the channel instance.
  17651. */
  17652. }, {
  17653. key: 'stopListening',
  17654. value: function stopListening(event) {
  17655. this.subscription.unbind(this.eventFormatter.format(event));
  17656. return this;
  17657. }
  17658. /**
  17659. * Bind a channel to an event.
  17660. */
  17661. }, {
  17662. key: 'on',
  17663. value: function on(event, callback) {
  17664. this.subscription.bind(event, callback);
  17665. return this;
  17666. }
  17667. }]);
  17668. return PusherChannel;
  17669. }(Channel);
  17670. /**
  17671. * This class represents a Pusher private channel.
  17672. */
  17673. var PusherPrivateChannel = function (_PusherChannel) {
  17674. inherits(PusherPrivateChannel, _PusherChannel);
  17675. function PusherPrivateChannel() {
  17676. classCallCheck(this, PusherPrivateChannel);
  17677. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17678. }
  17679. createClass(PusherPrivateChannel, [{
  17680. key: 'whisper',
  17681. /**
  17682. * Trigger client event on the channel.
  17683. */
  17684. value: function whisper(eventName, data) {
  17685. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17686. return this;
  17687. }
  17688. }]);
  17689. return PusherPrivateChannel;
  17690. }(PusherChannel);
  17691. /**
  17692. * This class represents a Pusher presence channel.
  17693. */
  17694. var PusherPresenceChannel = function (_PusherChannel) {
  17695. inherits(PusherPresenceChannel, _PusherChannel);
  17696. function PusherPresenceChannel() {
  17697. classCallCheck(this, PusherPresenceChannel);
  17698. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17699. }
  17700. createClass(PusherPresenceChannel, [{
  17701. key: 'here',
  17702. /**
  17703. * Register a callback to be called anytime the member list changes.
  17704. */
  17705. value: function here(callback) {
  17706. this.on('pusher:subscription_succeeded', function (data) {
  17707. callback(Object.keys(data.members).map(function (k) {
  17708. return data.members[k];
  17709. }));
  17710. });
  17711. return this;
  17712. }
  17713. /**
  17714. * Listen for someone joining the channel.
  17715. */
  17716. }, {
  17717. key: 'joining',
  17718. value: function joining(callback) {
  17719. this.on('pusher:member_added', function (member) {
  17720. callback(member.info);
  17721. });
  17722. return this;
  17723. }
  17724. /**
  17725. * Listen for someone leaving the channel.
  17726. */
  17727. }, {
  17728. key: 'leaving',
  17729. value: function leaving(callback) {
  17730. this.on('pusher:member_removed', function (member) {
  17731. callback(member.info);
  17732. });
  17733. return this;
  17734. }
  17735. /**
  17736. * Trigger client event on the channel.
  17737. */
  17738. }, {
  17739. key: 'whisper',
  17740. value: function whisper(eventName, data) {
  17741. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17742. return this;
  17743. }
  17744. }]);
  17745. return PusherPresenceChannel;
  17746. }(PusherChannel);
  17747. /**
  17748. * This class represents a Socket.io channel.
  17749. */
  17750. var SocketIoChannel = function (_Channel) {
  17751. inherits(SocketIoChannel, _Channel);
  17752. /**
  17753. * Create a new class instance.
  17754. */
  17755. function SocketIoChannel(socket, name, options) {
  17756. classCallCheck(this, SocketIoChannel);
  17757. /**
  17758. * The event callbacks applied to the channel.
  17759. */
  17760. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17761. _this.events = {};
  17762. _this.name = name;
  17763. _this.socket = socket;
  17764. _this.options = options;
  17765. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17766. _this.subscribe();
  17767. _this.configureReconnector();
  17768. return _this;
  17769. }
  17770. /**
  17771. * Subscribe to a Socket.io channel.
  17772. */
  17773. createClass(SocketIoChannel, [{
  17774. key: 'subscribe',
  17775. value: function subscribe() {
  17776. this.socket.emit('subscribe', {
  17777. channel: this.name,
  17778. auth: this.options.auth || {}
  17779. });
  17780. }
  17781. /**
  17782. * Unsubscribe from channel and ubind event callbacks.
  17783. */
  17784. }, {
  17785. key: 'unsubscribe',
  17786. value: function unsubscribe() {
  17787. this.unbind();
  17788. this.socket.emit('unsubscribe', {
  17789. channel: this.name,
  17790. auth: this.options.auth || {}
  17791. });
  17792. }
  17793. /**
  17794. * Listen for an event on the channel instance.
  17795. */
  17796. }, {
  17797. key: 'listen',
  17798. value: function listen(event, callback) {
  17799. this.on(this.eventFormatter.format(event), callback);
  17800. return this;
  17801. }
  17802. /**
  17803. * Stop listening for an event on the channel instance.
  17804. */
  17805. }, {
  17806. key: 'stopListening',
  17807. value: function stopListening(event) {
  17808. var name = this.eventFormatter.format(event);
  17809. this.socket.removeListener(name);
  17810. delete this.events[name];
  17811. return this;
  17812. }
  17813. /**
  17814. * Bind the channel's socket to an event and store the callback.
  17815. */
  17816. }, {
  17817. key: 'on',
  17818. value: function on(event, callback) {
  17819. var _this2 = this;
  17820. var listener = function listener(channel, data) {
  17821. if (_this2.name == channel) {
  17822. callback(data);
  17823. }
  17824. };
  17825. this.socket.on(event, listener);
  17826. this.bind(event, listener);
  17827. }
  17828. /**
  17829. * Attach a 'reconnect' listener and bind the event.
  17830. */
  17831. }, {
  17832. key: 'configureReconnector',
  17833. value: function configureReconnector() {
  17834. var _this3 = this;
  17835. var listener = function listener() {
  17836. _this3.subscribe();
  17837. };
  17838. this.socket.on('reconnect', listener);
  17839. this.bind('reconnect', listener);
  17840. }
  17841. /**
  17842. * Bind the channel's socket to an event and store the callback.
  17843. */
  17844. }, {
  17845. key: 'bind',
  17846. value: function bind(event, callback) {
  17847. this.events[event] = this.events[event] || [];
  17848. this.events[event].push(callback);
  17849. }
  17850. /**
  17851. * Unbind the channel's socket from all stored event callbacks.
  17852. */
  17853. }, {
  17854. key: 'unbind',
  17855. value: function unbind() {
  17856. var _this4 = this;
  17857. Object.keys(this.events).forEach(function (event) {
  17858. _this4.events[event].forEach(function (callback) {
  17859. _this4.socket.removeListener(event, callback);
  17860. });
  17861. delete _this4.events[event];
  17862. });
  17863. }
  17864. }]);
  17865. return SocketIoChannel;
  17866. }(Channel);
  17867. /**
  17868. * This class represents a Socket.io presence channel.
  17869. */
  17870. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17871. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17872. function SocketIoPrivateChannel() {
  17873. classCallCheck(this, SocketIoPrivateChannel);
  17874. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17875. }
  17876. createClass(SocketIoPrivateChannel, [{
  17877. key: 'whisper',
  17878. /**
  17879. * Trigger client event on the channel.
  17880. */
  17881. value: function whisper(eventName, data) {
  17882. this.socket.emit('client event', {
  17883. channel: this.name,
  17884. event: 'client-' + eventName,
  17885. data: data
  17886. });
  17887. return this;
  17888. }
  17889. }]);
  17890. return SocketIoPrivateChannel;
  17891. }(SocketIoChannel);
  17892. /**
  17893. * This class represents a Socket.io presence channel.
  17894. */
  17895. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17896. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17897. function SocketIoPresenceChannel() {
  17898. classCallCheck(this, SocketIoPresenceChannel);
  17899. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17900. }
  17901. createClass(SocketIoPresenceChannel, [{
  17902. key: 'here',
  17903. /**
  17904. * Register a callback to be called anytime the member list changes.
  17905. */
  17906. value: function here(callback) {
  17907. this.on('presence:subscribed', function (members) {
  17908. callback(members.map(function (m) {
  17909. return m.user_info;
  17910. }));
  17911. });
  17912. return this;
  17913. }
  17914. /**
  17915. * Listen for someone joining the channel.
  17916. */
  17917. }, {
  17918. key: 'joining',
  17919. value: function joining(callback) {
  17920. this.on('presence:joining', function (member) {
  17921. return callback(member.user_info);
  17922. });
  17923. return this;
  17924. }
  17925. /**
  17926. * Listen for someone leaving the channel.
  17927. */
  17928. }, {
  17929. key: 'leaving',
  17930. value: function leaving(callback) {
  17931. this.on('presence:leaving', function (member) {
  17932. return callback(member.user_info);
  17933. });
  17934. return this;
  17935. }
  17936. }]);
  17937. return SocketIoPresenceChannel;
  17938. }(SocketIoPrivateChannel);
  17939. /**
  17940. * This class represents a null channel.
  17941. */
  17942. var NullChannel = function (_Channel) {
  17943. inherits(NullChannel, _Channel);
  17944. function NullChannel() {
  17945. classCallCheck(this, NullChannel);
  17946. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17947. }
  17948. createClass(NullChannel, [{
  17949. key: 'subscribe',
  17950. /**
  17951. * Subscribe to a channel.
  17952. */
  17953. value: function subscribe() {}
  17954. //
  17955. /**
  17956. * Unsubscribe from a channel.
  17957. */
  17958. }, {
  17959. key: 'unsubscribe',
  17960. value: function unsubscribe() {}
  17961. //
  17962. /**
  17963. * Listen for an event on the channel instance.
  17964. */
  17965. }, {
  17966. key: 'listen',
  17967. value: function listen(event, callback) {
  17968. return this;
  17969. }
  17970. /**
  17971. * Stop listening for an event on the channel instance.
  17972. */
  17973. }, {
  17974. key: 'stopListening',
  17975. value: function stopListening(event) {
  17976. return this;
  17977. }
  17978. /**
  17979. * Bind a channel to an event.
  17980. */
  17981. }, {
  17982. key: 'on',
  17983. value: function on(event, callback) {
  17984. return this;
  17985. }
  17986. }]);
  17987. return NullChannel;
  17988. }(Channel);
  17989. /**
  17990. * This class represents a null private channel.
  17991. */
  17992. var NullPrivateChannel = function (_NullChannel) {
  17993. inherits(NullPrivateChannel, _NullChannel);
  17994. function NullPrivateChannel() {
  17995. classCallCheck(this, NullPrivateChannel);
  17996. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17997. }
  17998. createClass(NullPrivateChannel, [{
  17999. key: 'whisper',
  18000. /**
  18001. * Trigger client event on the channel.
  18002. */
  18003. value: function whisper(eventName, data) {
  18004. return this;
  18005. }
  18006. }]);
  18007. return NullPrivateChannel;
  18008. }(NullChannel);
  18009. /**
  18010. * This class represents a null presence channel.
  18011. */
  18012. var NullPresenceChannel = function (_NullChannel) {
  18013. inherits(NullPresenceChannel, _NullChannel);
  18014. function NullPresenceChannel() {
  18015. classCallCheck(this, NullPresenceChannel);
  18016. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18017. }
  18018. createClass(NullPresenceChannel, [{
  18019. key: 'here',
  18020. /**
  18021. * Register a callback to be called anytime the member list changes.
  18022. */
  18023. value: function here(callback) {
  18024. return this;
  18025. }
  18026. /**
  18027. * Listen for someone joining the channel.
  18028. */
  18029. }, {
  18030. key: 'joining',
  18031. value: function joining(callback) {
  18032. return this;
  18033. }
  18034. /**
  18035. * Listen for someone leaving the channel.
  18036. */
  18037. }, {
  18038. key: 'leaving',
  18039. value: function leaving(callback) {
  18040. return this;
  18041. }
  18042. /**
  18043. * Trigger client event on the channel.
  18044. */
  18045. }, {
  18046. key: 'whisper',
  18047. value: function whisper(eventName, data) {
  18048. return this;
  18049. }
  18050. }]);
  18051. return NullPresenceChannel;
  18052. }(NullChannel);
  18053. /**
  18054. * This class creates a connector to Pusher.
  18055. */
  18056. var PusherConnector = function (_Connector) {
  18057. inherits(PusherConnector, _Connector);
  18058. function PusherConnector() {
  18059. classCallCheck(this, PusherConnector);
  18060. /**
  18061. * All of the subscribed channel names.
  18062. */
  18063. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18064. _this.channels = {};
  18065. return _this;
  18066. }
  18067. /**
  18068. * Create a fresh Pusher connection.
  18069. */
  18070. createClass(PusherConnector, [{
  18071. key: 'connect',
  18072. value: function connect() {
  18073. if (typeof this.options.client !== 'undefined') {
  18074. this.pusher = this.options.client;
  18075. } else {
  18076. this.pusher = new Pusher(this.options.key, this.options);
  18077. }
  18078. }
  18079. /**
  18080. * Listen for an event on a channel instance.
  18081. */
  18082. }, {
  18083. key: 'listen',
  18084. value: function listen(name, event, callback) {
  18085. return this.channel(name).listen(event, callback);
  18086. }
  18087. /**
  18088. * Get a channel instance by name.
  18089. */
  18090. }, {
  18091. key: 'channel',
  18092. value: function channel(name) {
  18093. if (!this.channels[name]) {
  18094. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18095. }
  18096. return this.channels[name];
  18097. }
  18098. /**
  18099. * Get a private channel instance by name.
  18100. */
  18101. }, {
  18102. key: 'privateChannel',
  18103. value: function privateChannel(name) {
  18104. if (!this.channels['private-' + name]) {
  18105. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18106. }
  18107. return this.channels['private-' + name];
  18108. }
  18109. /**
  18110. * Get a presence channel instance by name.
  18111. */
  18112. }, {
  18113. key: 'presenceChannel',
  18114. value: function presenceChannel(name) {
  18115. if (!this.channels['presence-' + name]) {
  18116. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18117. }
  18118. return this.channels['presence-' + name];
  18119. }
  18120. /**
  18121. * Leave the given channel, as well as its private and presence variants.
  18122. */
  18123. }, {
  18124. key: 'leave',
  18125. value: function leave(name) {
  18126. var _this2 = this;
  18127. var channels = [name, 'private-' + name, 'presence-' + name];
  18128. channels.forEach(function (name, index) {
  18129. _this2.leaveChannel(name);
  18130. });
  18131. }
  18132. /**
  18133. * Leave the given channel.
  18134. */
  18135. }, {
  18136. key: 'leaveChannel',
  18137. value: function leaveChannel(name) {
  18138. if (this.channels[name]) {
  18139. this.channels[name].unsubscribe();
  18140. delete this.channels[name];
  18141. }
  18142. }
  18143. /**
  18144. * Get the socket ID for the connection.
  18145. */
  18146. }, {
  18147. key: 'socketId',
  18148. value: function socketId() {
  18149. return this.pusher.connection.socket_id;
  18150. }
  18151. /**
  18152. * Disconnect Pusher connection.
  18153. */
  18154. }, {
  18155. key: 'disconnect',
  18156. value: function disconnect() {
  18157. this.pusher.disconnect();
  18158. }
  18159. }]);
  18160. return PusherConnector;
  18161. }(Connector);
  18162. /**
  18163. * This class creates a connnector to a Socket.io server.
  18164. */
  18165. var SocketIoConnector = function (_Connector) {
  18166. inherits(SocketIoConnector, _Connector);
  18167. function SocketIoConnector() {
  18168. classCallCheck(this, SocketIoConnector);
  18169. /**
  18170. * All of the subscribed channel names.
  18171. */
  18172. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18173. _this.channels = {};
  18174. return _this;
  18175. }
  18176. /**
  18177. * Create a fresh Socket.io connection.
  18178. */
  18179. createClass(SocketIoConnector, [{
  18180. key: 'connect',
  18181. value: function connect() {
  18182. var io = this.getSocketIO();
  18183. this.socket = io(this.options.host, this.options);
  18184. return this.socket;
  18185. }
  18186. /**
  18187. * Get socket.io module from global scope or options.
  18188. */
  18189. }, {
  18190. key: 'getSocketIO',
  18191. value: function getSocketIO() {
  18192. if (typeof this.options.client !== 'undefined') {
  18193. return this.options.client;
  18194. }
  18195. if (typeof io !== 'undefined') {
  18196. return io;
  18197. }
  18198. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18199. }
  18200. /**
  18201. * Listen for an event on a channel instance.
  18202. */
  18203. }, {
  18204. key: 'listen',
  18205. value: function listen(name, event, callback) {
  18206. return this.channel(name).listen(event, callback);
  18207. }
  18208. /**
  18209. * Get a channel instance by name.
  18210. */
  18211. }, {
  18212. key: 'channel',
  18213. value: function channel(name) {
  18214. if (!this.channels[name]) {
  18215. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18216. }
  18217. return this.channels[name];
  18218. }
  18219. /**
  18220. * Get a private channel instance by name.
  18221. */
  18222. }, {
  18223. key: 'privateChannel',
  18224. value: function privateChannel(name) {
  18225. if (!this.channels['private-' + name]) {
  18226. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18227. }
  18228. return this.channels['private-' + name];
  18229. }
  18230. /**
  18231. * Get a presence channel instance by name.
  18232. */
  18233. }, {
  18234. key: 'presenceChannel',
  18235. value: function presenceChannel(name) {
  18236. if (!this.channels['presence-' + name]) {
  18237. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18238. }
  18239. return this.channels['presence-' + name];
  18240. }
  18241. /**
  18242. * Leave the given channel, as well as its private and presence variants.
  18243. */
  18244. }, {
  18245. key: 'leave',
  18246. value: function leave(name) {
  18247. var _this2 = this;
  18248. var channels = [name, 'private-' + name, 'presence-' + name];
  18249. channels.forEach(function (name) {
  18250. _this2.leaveChannel(name);
  18251. });
  18252. }
  18253. /**
  18254. * Leave the given channel.
  18255. */
  18256. }, {
  18257. key: 'leaveChannel',
  18258. value: function leaveChannel(name) {
  18259. if (this.channels[name]) {
  18260. this.channels[name].unsubscribe();
  18261. delete this.channels[name];
  18262. }
  18263. }
  18264. /**
  18265. * Get the socket ID for the connection.
  18266. */
  18267. }, {
  18268. key: 'socketId',
  18269. value: function socketId() {
  18270. return this.socket.id;
  18271. }
  18272. /**
  18273. * Disconnect Socketio connection.
  18274. */
  18275. }, {
  18276. key: 'disconnect',
  18277. value: function disconnect() {
  18278. this.socket.disconnect();
  18279. }
  18280. }]);
  18281. return SocketIoConnector;
  18282. }(Connector);
  18283. /**
  18284. * This class creates a null connector.
  18285. */
  18286. var NullConnector = function (_Connector) {
  18287. inherits(NullConnector, _Connector);
  18288. function NullConnector() {
  18289. classCallCheck(this, NullConnector);
  18290. /**
  18291. * All of the subscribed channel names.
  18292. */
  18293. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18294. _this.channels = {};
  18295. return _this;
  18296. }
  18297. /**
  18298. * Create a fresh connection.
  18299. */
  18300. createClass(NullConnector, [{
  18301. key: 'connect',
  18302. value: function connect() {}
  18303. //
  18304. /**
  18305. * Listen for an event on a channel instance.
  18306. */
  18307. }, {
  18308. key: 'listen',
  18309. value: function listen(name, event, callback) {
  18310. return new NullChannel();
  18311. }
  18312. /**
  18313. * Get a channel instance by name.
  18314. */
  18315. }, {
  18316. key: 'channel',
  18317. value: function channel(name) {
  18318. return new NullChannel();
  18319. }
  18320. /**
  18321. * Get a private channel instance by name.
  18322. */
  18323. }, {
  18324. key: 'privateChannel',
  18325. value: function privateChannel(name) {
  18326. return new NullPrivateChannel();
  18327. }
  18328. /**
  18329. * Get a presence channel instance by name.
  18330. */
  18331. }, {
  18332. key: 'presenceChannel',
  18333. value: function presenceChannel(name) {
  18334. return new NullPresenceChannel();
  18335. }
  18336. /**
  18337. * Leave the given channel, as well as its private and presence variants.
  18338. */
  18339. }, {
  18340. key: 'leave',
  18341. value: function leave(name) {}
  18342. //
  18343. /**
  18344. * Leave the given channel.
  18345. */
  18346. }, {
  18347. key: 'leaveChannel',
  18348. value: function leaveChannel(name) {}
  18349. //
  18350. /**
  18351. * Get the socket ID for the connection.
  18352. */
  18353. }, {
  18354. key: 'socketId',
  18355. value: function socketId() {
  18356. return 'fake-socket-id';
  18357. }
  18358. /**
  18359. * Disconnect the connection.
  18360. */
  18361. }, {
  18362. key: 'disconnect',
  18363. value: function disconnect() {
  18364. //
  18365. }
  18366. }]);
  18367. return NullConnector;
  18368. }(Connector);
  18369. /**
  18370. * This class is the primary API for interacting with broadcasting.
  18371. */
  18372. var Echo = function () {
  18373. /**
  18374. * Create a new class instance.
  18375. */
  18376. function Echo(options) {
  18377. classCallCheck(this, Echo);
  18378. this.options = options;
  18379. this.connect();
  18380. if (!this.options.withoutInterceptors) {
  18381. this.registerInterceptors();
  18382. }
  18383. }
  18384. /**
  18385. * Get a channel instance by name.
  18386. */
  18387. createClass(Echo, [{
  18388. key: 'channel',
  18389. value: function channel(_channel) {
  18390. return this.connector.channel(_channel);
  18391. }
  18392. /**
  18393. * Create a new connection.
  18394. */
  18395. }, {
  18396. key: 'connect',
  18397. value: function connect() {
  18398. if (this.options.broadcaster == 'pusher') {
  18399. this.connector = new PusherConnector(this.options);
  18400. } else if (this.options.broadcaster == 'socket.io') {
  18401. this.connector = new SocketIoConnector(this.options);
  18402. } else if (this.options.broadcaster == 'null') {
  18403. this.connector = new NullConnector(this.options);
  18404. } else if (typeof this.options.broadcaster == 'function') {
  18405. this.connector = new this.options.broadcaster(this.options);
  18406. }
  18407. }
  18408. /**
  18409. * Disconnect from the Echo server.
  18410. */
  18411. }, {
  18412. key: 'disconnect',
  18413. value: function disconnect() {
  18414. this.connector.disconnect();
  18415. }
  18416. /**
  18417. * Get a presence channel instance by name.
  18418. */
  18419. }, {
  18420. key: 'join',
  18421. value: function join(channel) {
  18422. return this.connector.presenceChannel(channel);
  18423. }
  18424. /**
  18425. * Leave the given channel, as well as its private and presence variants.
  18426. */
  18427. }, {
  18428. key: 'leave',
  18429. value: function leave(channel) {
  18430. this.connector.leave(channel);
  18431. }
  18432. /**
  18433. * Leave the given channel.
  18434. */
  18435. }, {
  18436. key: 'leaveChannel',
  18437. value: function leaveChannel(channel) {
  18438. this.connector.leaveChannel(channel);
  18439. }
  18440. /**
  18441. * Listen for an event on a channel instance.
  18442. */
  18443. }, {
  18444. key: 'listen',
  18445. value: function listen(channel, event, callback) {
  18446. return this.connector.listen(channel, event, callback);
  18447. }
  18448. /**
  18449. * Get a private channel instance by name.
  18450. */
  18451. }, {
  18452. key: 'private',
  18453. value: function _private(channel) {
  18454. return this.connector.privateChannel(channel);
  18455. }
  18456. /**
  18457. * Get the Socket ID for the connection.
  18458. */
  18459. }, {
  18460. key: 'socketId',
  18461. value: function socketId() {
  18462. return this.connector.socketId();
  18463. }
  18464. /**
  18465. * Register 3rd party request interceptiors. These are used to automatically
  18466. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18467. */
  18468. }, {
  18469. key: 'registerInterceptors',
  18470. value: function registerInterceptors() {
  18471. if (typeof Vue === 'function' && Vue.http) {
  18472. this.registerVueRequestInterceptor();
  18473. }
  18474. if (typeof axios === 'function') {
  18475. this.registerAxiosRequestInterceptor();
  18476. }
  18477. if (typeof jQuery === 'function') {
  18478. this.registerjQueryAjaxSetup();
  18479. }
  18480. }
  18481. /**
  18482. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18483. */
  18484. }, {
  18485. key: 'registerVueRequestInterceptor',
  18486. value: function registerVueRequestInterceptor() {
  18487. var _this = this;
  18488. Vue.http.interceptors.push(function (request, next) {
  18489. if (_this.socketId()) {
  18490. request.headers.set('X-Socket-ID', _this.socketId());
  18491. }
  18492. next();
  18493. });
  18494. }
  18495. /**
  18496. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18497. */
  18498. }, {
  18499. key: 'registerAxiosRequestInterceptor',
  18500. value: function registerAxiosRequestInterceptor() {
  18501. var _this2 = this;
  18502. axios.interceptors.request.use(function (config) {
  18503. if (_this2.socketId()) {
  18504. config.headers['X-Socket-Id'] = _this2.socketId();
  18505. }
  18506. return config;
  18507. });
  18508. }
  18509. /**
  18510. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18511. */
  18512. }, {
  18513. key: 'registerjQueryAjaxSetup',
  18514. value: function registerjQueryAjaxSetup() {
  18515. var _this3 = this;
  18516. if (typeof jQuery.ajax != 'undefined') {
  18517. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18518. if (_this3.socketId()) {
  18519. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18520. }
  18521. });
  18522. }
  18523. }
  18524. }]);
  18525. return Echo;
  18526. }();
  18527. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18528. /***/ }),
  18529. /***/ "./node_modules/lodash/lodash.js":
  18530. /*!***************************************!*\
  18531. !*** ./node_modules/lodash/lodash.js ***!
  18532. \***************************************/
  18533. /*! no static exports found */
  18534. /***/ (function(module, exports, __webpack_require__) {
  18535. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18536. * @license
  18537. * Lodash <https://lodash.com/>
  18538. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18539. * Released under MIT license <https://lodash.com/license>
  18540. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18541. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18542. */
  18543. ;(function() {
  18544. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18545. var undefined;
  18546. /** Used as the semantic version number. */
  18547. var VERSION = '4.17.15';
  18548. /** Used as the size to enable large array optimizations. */
  18549. var LARGE_ARRAY_SIZE = 200;
  18550. /** Error message constants. */
  18551. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18552. FUNC_ERROR_TEXT = 'Expected a function';
  18553. /** Used to stand-in for `undefined` hash values. */
  18554. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18555. /** Used as the maximum memoize cache size. */
  18556. var MAX_MEMOIZE_SIZE = 500;
  18557. /** Used as the internal argument placeholder. */
  18558. var PLACEHOLDER = '__lodash_placeholder__';
  18559. /** Used to compose bitmasks for cloning. */
  18560. var CLONE_DEEP_FLAG = 1,
  18561. CLONE_FLAT_FLAG = 2,
  18562. CLONE_SYMBOLS_FLAG = 4;
  18563. /** Used to compose bitmasks for value comparisons. */
  18564. var COMPARE_PARTIAL_FLAG = 1,
  18565. COMPARE_UNORDERED_FLAG = 2;
  18566. /** Used to compose bitmasks for function metadata. */
  18567. var WRAP_BIND_FLAG = 1,
  18568. WRAP_BIND_KEY_FLAG = 2,
  18569. WRAP_CURRY_BOUND_FLAG = 4,
  18570. WRAP_CURRY_FLAG = 8,
  18571. WRAP_CURRY_RIGHT_FLAG = 16,
  18572. WRAP_PARTIAL_FLAG = 32,
  18573. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18574. WRAP_ARY_FLAG = 128,
  18575. WRAP_REARG_FLAG = 256,
  18576. WRAP_FLIP_FLAG = 512;
  18577. /** Used as default options for `_.truncate`. */
  18578. var DEFAULT_TRUNC_LENGTH = 30,
  18579. DEFAULT_TRUNC_OMISSION = '...';
  18580. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18581. var HOT_COUNT = 800,
  18582. HOT_SPAN = 16;
  18583. /** Used to indicate the type of lazy iteratees. */
  18584. var LAZY_FILTER_FLAG = 1,
  18585. LAZY_MAP_FLAG = 2,
  18586. LAZY_WHILE_FLAG = 3;
  18587. /** Used as references for various `Number` constants. */
  18588. var INFINITY = 1 / 0,
  18589. MAX_SAFE_INTEGER = 9007199254740991,
  18590. MAX_INTEGER = 1.7976931348623157e+308,
  18591. NAN = 0 / 0;
  18592. /** Used as references for the maximum length and index of an array. */
  18593. var MAX_ARRAY_LENGTH = 4294967295,
  18594. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18595. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18596. /** Used to associate wrap methods with their bit flags. */
  18597. var wrapFlags = [
  18598. ['ary', WRAP_ARY_FLAG],
  18599. ['bind', WRAP_BIND_FLAG],
  18600. ['bindKey', WRAP_BIND_KEY_FLAG],
  18601. ['curry', WRAP_CURRY_FLAG],
  18602. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18603. ['flip', WRAP_FLIP_FLAG],
  18604. ['partial', WRAP_PARTIAL_FLAG],
  18605. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18606. ['rearg', WRAP_REARG_FLAG]
  18607. ];
  18608. /** `Object#toString` result references. */
  18609. var argsTag = '[object Arguments]',
  18610. arrayTag = '[object Array]',
  18611. asyncTag = '[object AsyncFunction]',
  18612. boolTag = '[object Boolean]',
  18613. dateTag = '[object Date]',
  18614. domExcTag = '[object DOMException]',
  18615. errorTag = '[object Error]',
  18616. funcTag = '[object Function]',
  18617. genTag = '[object GeneratorFunction]',
  18618. mapTag = '[object Map]',
  18619. numberTag = '[object Number]',
  18620. nullTag = '[object Null]',
  18621. objectTag = '[object Object]',
  18622. promiseTag = '[object Promise]',
  18623. proxyTag = '[object Proxy]',
  18624. regexpTag = '[object RegExp]',
  18625. setTag = '[object Set]',
  18626. stringTag = '[object String]',
  18627. symbolTag = '[object Symbol]',
  18628. undefinedTag = '[object Undefined]',
  18629. weakMapTag = '[object WeakMap]',
  18630. weakSetTag = '[object WeakSet]';
  18631. var arrayBufferTag = '[object ArrayBuffer]',
  18632. dataViewTag = '[object DataView]',
  18633. float32Tag = '[object Float32Array]',
  18634. float64Tag = '[object Float64Array]',
  18635. int8Tag = '[object Int8Array]',
  18636. int16Tag = '[object Int16Array]',
  18637. int32Tag = '[object Int32Array]',
  18638. uint8Tag = '[object Uint8Array]',
  18639. uint8ClampedTag = '[object Uint8ClampedArray]',
  18640. uint16Tag = '[object Uint16Array]',
  18641. uint32Tag = '[object Uint32Array]';
  18642. /** Used to match empty string literals in compiled template source. */
  18643. var reEmptyStringLeading = /\b__p \+= '';/g,
  18644. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18645. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18646. /** Used to match HTML entities and HTML characters. */
  18647. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18648. reUnescapedHtml = /[&<>"']/g,
  18649. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18650. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18651. /** Used to match template delimiters. */
  18652. var reEscape = /<%-([\s\S]+?)%>/g,
  18653. reEvaluate = /<%([\s\S]+?)%>/g,
  18654. reInterpolate = /<%=([\s\S]+?)%>/g;
  18655. /** Used to match property names within property paths. */
  18656. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18657. reIsPlainProp = /^\w*$/,
  18658. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18659. /**
  18660. * Used to match `RegExp`
  18661. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18662. */
  18663. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18664. reHasRegExpChar = RegExp(reRegExpChar.source);
  18665. /** Used to match leading and trailing whitespace. */
  18666. var reTrim = /^\s+|\s+$/g,
  18667. reTrimStart = /^\s+/,
  18668. reTrimEnd = /\s+$/;
  18669. /** Used to match wrap detail comments. */
  18670. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18671. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18672. reSplitDetails = /,? & /;
  18673. /** Used to match words composed of alphanumeric characters. */
  18674. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18675. /** Used to match backslashes in property paths. */
  18676. var reEscapeChar = /\\(\\)?/g;
  18677. /**
  18678. * Used to match
  18679. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18680. */
  18681. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18682. /** Used to match `RegExp` flags from their coerced string values. */
  18683. var reFlags = /\w*$/;
  18684. /** Used to detect bad signed hexadecimal string values. */
  18685. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18686. /** Used to detect binary string values. */
  18687. var reIsBinary = /^0b[01]+$/i;
  18688. /** Used to detect host constructors (Safari). */
  18689. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18690. /** Used to detect octal string values. */
  18691. var reIsOctal = /^0o[0-7]+$/i;
  18692. /** Used to detect unsigned integer values. */
  18693. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18694. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18695. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18696. /** Used to ensure capturing order of template delimiters. */
  18697. var reNoMatch = /($^)/;
  18698. /** Used to match unescaped characters in compiled string literals. */
  18699. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18700. /** Used to compose unicode character classes. */
  18701. var rsAstralRange = '\\ud800-\\udfff',
  18702. rsComboMarksRange = '\\u0300-\\u036f',
  18703. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18704. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18705. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18706. rsDingbatRange = '\\u2700-\\u27bf',
  18707. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18708. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18709. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18710. rsPunctuationRange = '\\u2000-\\u206f',
  18711. 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',
  18712. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18713. rsVarRange = '\\ufe0e\\ufe0f',
  18714. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18715. /** Used to compose unicode capture groups. */
  18716. var rsApos = "['\u2019]",
  18717. rsAstral = '[' + rsAstralRange + ']',
  18718. rsBreak = '[' + rsBreakRange + ']',
  18719. rsCombo = '[' + rsComboRange + ']',
  18720. rsDigits = '\\d+',
  18721. rsDingbat = '[' + rsDingbatRange + ']',
  18722. rsLower = '[' + rsLowerRange + ']',
  18723. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18724. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18725. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18726. rsNonAstral = '[^' + rsAstralRange + ']',
  18727. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18728. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18729. rsUpper = '[' + rsUpperRange + ']',
  18730. rsZWJ = '\\u200d';
  18731. /** Used to compose unicode regexes. */
  18732. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18733. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18734. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18735. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18736. reOptMod = rsModifier + '?',
  18737. rsOptVar = '[' + rsVarRange + ']?',
  18738. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18739. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18740. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18741. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18742. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18743. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18744. /** Used to match apostrophes. */
  18745. var reApos = RegExp(rsApos, 'g');
  18746. /**
  18747. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18748. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18749. */
  18750. var reComboMark = RegExp(rsCombo, 'g');
  18751. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18752. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18753. /** Used to match complex or compound words. */
  18754. var reUnicodeWord = RegExp([
  18755. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18756. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18757. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18758. rsUpper + '+' + rsOptContrUpper,
  18759. rsOrdUpper,
  18760. rsOrdLower,
  18761. rsDigits,
  18762. rsEmoji
  18763. ].join('|'), 'g');
  18764. /** 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/). */
  18765. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18766. /** Used to detect strings that need a more robust regexp to match words. */
  18767. 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 ]/;
  18768. /** Used to assign default `context` object properties. */
  18769. var contextProps = [
  18770. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18771. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18772. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18773. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18774. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18775. ];
  18776. /** Used to make template sourceURLs easier to identify. */
  18777. var templateCounter = -1;
  18778. /** Used to identify `toStringTag` values of typed arrays. */
  18779. var typedArrayTags = {};
  18780. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18781. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18782. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18783. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18784. typedArrayTags[uint32Tag] = true;
  18785. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18786. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18787. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18788. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18789. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18790. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18791. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18792. typedArrayTags[weakMapTag] = false;
  18793. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18794. var cloneableTags = {};
  18795. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18796. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18797. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18798. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18799. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18800. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18801. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18802. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18803. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18804. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18805. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18806. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18807. cloneableTags[weakMapTag] = false;
  18808. /** Used to map Latin Unicode letters to basic Latin letters. */
  18809. var deburredLetters = {
  18810. // Latin-1 Supplement block.
  18811. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18812. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18813. '\xc7': 'C', '\xe7': 'c',
  18814. '\xd0': 'D', '\xf0': 'd',
  18815. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18816. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18817. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18818. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18819. '\xd1': 'N', '\xf1': 'n',
  18820. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18821. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18822. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18823. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18824. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18825. '\xc6': 'Ae', '\xe6': 'ae',
  18826. '\xde': 'Th', '\xfe': 'th',
  18827. '\xdf': 'ss',
  18828. // Latin Extended-A block.
  18829. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18830. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18831. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18832. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18833. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18834. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18835. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18836. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18837. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18838. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18839. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18840. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18841. '\u0134': 'J', '\u0135': 'j',
  18842. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18843. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18844. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18845. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18846. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18847. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18848. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18849. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18850. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18851. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18852. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18853. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18854. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18855. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18856. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18857. '\u0174': 'W', '\u0175': 'w',
  18858. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18859. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18860. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18861. '\u0132': 'IJ', '\u0133': 'ij',
  18862. '\u0152': 'Oe', '\u0153': 'oe',
  18863. '\u0149': "'n", '\u017f': 's'
  18864. };
  18865. /** Used to map characters to HTML entities. */
  18866. var htmlEscapes = {
  18867. '&': '&amp;',
  18868. '<': '&lt;',
  18869. '>': '&gt;',
  18870. '"': '&quot;',
  18871. "'": '&#39;'
  18872. };
  18873. /** Used to map HTML entities to characters. */
  18874. var htmlUnescapes = {
  18875. '&amp;': '&',
  18876. '&lt;': '<',
  18877. '&gt;': '>',
  18878. '&quot;': '"',
  18879. '&#39;': "'"
  18880. };
  18881. /** Used to escape characters for inclusion in compiled string literals. */
  18882. var stringEscapes = {
  18883. '\\': '\\',
  18884. "'": "'",
  18885. '\n': 'n',
  18886. '\r': 'r',
  18887. '\u2028': 'u2028',
  18888. '\u2029': 'u2029'
  18889. };
  18890. /** Built-in method references without a dependency on `root`. */
  18891. var freeParseFloat = parseFloat,
  18892. freeParseInt = parseInt;
  18893. /** Detect free variable `global` from Node.js. */
  18894. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18895. /** Detect free variable `self`. */
  18896. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18897. /** Used as a reference to the global object. */
  18898. var root = freeGlobal || freeSelf || Function('return this')();
  18899. /** Detect free variable `exports`. */
  18900. var freeExports = true && exports && !exports.nodeType && exports;
  18901. /** Detect free variable `module`. */
  18902. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18903. /** Detect the popular CommonJS extension `module.exports`. */
  18904. var moduleExports = freeModule && freeModule.exports === freeExports;
  18905. /** Detect free variable `process` from Node.js. */
  18906. var freeProcess = moduleExports && freeGlobal.process;
  18907. /** Used to access faster Node.js helpers. */
  18908. var nodeUtil = (function() {
  18909. try {
  18910. // Use `util.types` for Node.js 10+.
  18911. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18912. if (types) {
  18913. return types;
  18914. }
  18915. // Legacy `process.binding('util')` for Node.js < 10.
  18916. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18917. } catch (e) {}
  18918. }());
  18919. /* Node.js helper references. */
  18920. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18921. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18922. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18923. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18924. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18925. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18926. /*--------------------------------------------------------------------------*/
  18927. /**
  18928. * A faster alternative to `Function#apply`, this function invokes `func`
  18929. * with the `this` binding of `thisArg` and the arguments of `args`.
  18930. *
  18931. * @private
  18932. * @param {Function} func The function to invoke.
  18933. * @param {*} thisArg The `this` binding of `func`.
  18934. * @param {Array} args The arguments to invoke `func` with.
  18935. * @returns {*} Returns the result of `func`.
  18936. */
  18937. function apply(func, thisArg, args) {
  18938. switch (args.length) {
  18939. case 0: return func.call(thisArg);
  18940. case 1: return func.call(thisArg, args[0]);
  18941. case 2: return func.call(thisArg, args[0], args[1]);
  18942. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18943. }
  18944. return func.apply(thisArg, args);
  18945. }
  18946. /**
  18947. * A specialized version of `baseAggregator` for arrays.
  18948. *
  18949. * @private
  18950. * @param {Array} [array] The array to iterate over.
  18951. * @param {Function} setter The function to set `accumulator` values.
  18952. * @param {Function} iteratee The iteratee to transform keys.
  18953. * @param {Object} accumulator The initial aggregated object.
  18954. * @returns {Function} Returns `accumulator`.
  18955. */
  18956. function arrayAggregator(array, setter, iteratee, accumulator) {
  18957. var index = -1,
  18958. length = array == null ? 0 : array.length;
  18959. while (++index < length) {
  18960. var value = array[index];
  18961. setter(accumulator, value, iteratee(value), array);
  18962. }
  18963. return accumulator;
  18964. }
  18965. /**
  18966. * A specialized version of `_.forEach` for arrays without support for
  18967. * iteratee shorthands.
  18968. *
  18969. * @private
  18970. * @param {Array} [array] The array to iterate over.
  18971. * @param {Function} iteratee The function invoked per iteration.
  18972. * @returns {Array} Returns `array`.
  18973. */
  18974. function arrayEach(array, iteratee) {
  18975. var index = -1,
  18976. length = array == null ? 0 : array.length;
  18977. while (++index < length) {
  18978. if (iteratee(array[index], index, array) === false) {
  18979. break;
  18980. }
  18981. }
  18982. return array;
  18983. }
  18984. /**
  18985. * A specialized version of `_.forEachRight` for arrays without support for
  18986. * iteratee shorthands.
  18987. *
  18988. * @private
  18989. * @param {Array} [array] The array to iterate over.
  18990. * @param {Function} iteratee The function invoked per iteration.
  18991. * @returns {Array} Returns `array`.
  18992. */
  18993. function arrayEachRight(array, iteratee) {
  18994. var length = array == null ? 0 : array.length;
  18995. while (length--) {
  18996. if (iteratee(array[length], length, array) === false) {
  18997. break;
  18998. }
  18999. }
  19000. return array;
  19001. }
  19002. /**
  19003. * A specialized version of `_.every` for arrays without support for
  19004. * iteratee shorthands.
  19005. *
  19006. * @private
  19007. * @param {Array} [array] The array to iterate over.
  19008. * @param {Function} predicate The function invoked per iteration.
  19009. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19010. * else `false`.
  19011. */
  19012. function arrayEvery(array, predicate) {
  19013. var index = -1,
  19014. length = array == null ? 0 : array.length;
  19015. while (++index < length) {
  19016. if (!predicate(array[index], index, array)) {
  19017. return false;
  19018. }
  19019. }
  19020. return true;
  19021. }
  19022. /**
  19023. * A specialized version of `_.filter` for arrays without support for
  19024. * iteratee shorthands.
  19025. *
  19026. * @private
  19027. * @param {Array} [array] The array to iterate over.
  19028. * @param {Function} predicate The function invoked per iteration.
  19029. * @returns {Array} Returns the new filtered array.
  19030. */
  19031. function arrayFilter(array, predicate) {
  19032. var index = -1,
  19033. length = array == null ? 0 : array.length,
  19034. resIndex = 0,
  19035. result = [];
  19036. while (++index < length) {
  19037. var value = array[index];
  19038. if (predicate(value, index, array)) {
  19039. result[resIndex++] = value;
  19040. }
  19041. }
  19042. return result;
  19043. }
  19044. /**
  19045. * A specialized version of `_.includes` for arrays without support for
  19046. * specifying an index to search from.
  19047. *
  19048. * @private
  19049. * @param {Array} [array] The array to inspect.
  19050. * @param {*} target The value to search for.
  19051. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19052. */
  19053. function arrayIncludes(array, value) {
  19054. var length = array == null ? 0 : array.length;
  19055. return !!length && baseIndexOf(array, value, 0) > -1;
  19056. }
  19057. /**
  19058. * This function is like `arrayIncludes` except that it accepts a comparator.
  19059. *
  19060. * @private
  19061. * @param {Array} [array] The array to inspect.
  19062. * @param {*} target The value to search for.
  19063. * @param {Function} comparator The comparator invoked per element.
  19064. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19065. */
  19066. function arrayIncludesWith(array, value, comparator) {
  19067. var index = -1,
  19068. length = array == null ? 0 : array.length;
  19069. while (++index < length) {
  19070. if (comparator(value, array[index])) {
  19071. return true;
  19072. }
  19073. }
  19074. return false;
  19075. }
  19076. /**
  19077. * A specialized version of `_.map` for arrays without support for iteratee
  19078. * shorthands.
  19079. *
  19080. * @private
  19081. * @param {Array} [array] The array to iterate over.
  19082. * @param {Function} iteratee The function invoked per iteration.
  19083. * @returns {Array} Returns the new mapped array.
  19084. */
  19085. function arrayMap(array, iteratee) {
  19086. var index = -1,
  19087. length = array == null ? 0 : array.length,
  19088. result = Array(length);
  19089. while (++index < length) {
  19090. result[index] = iteratee(array[index], index, array);
  19091. }
  19092. return result;
  19093. }
  19094. /**
  19095. * Appends the elements of `values` to `array`.
  19096. *
  19097. * @private
  19098. * @param {Array} array The array to modify.
  19099. * @param {Array} values The values to append.
  19100. * @returns {Array} Returns `array`.
  19101. */
  19102. function arrayPush(array, values) {
  19103. var index = -1,
  19104. length = values.length,
  19105. offset = array.length;
  19106. while (++index < length) {
  19107. array[offset + index] = values[index];
  19108. }
  19109. return array;
  19110. }
  19111. /**
  19112. * A specialized version of `_.reduce` for arrays without support for
  19113. * iteratee shorthands.
  19114. *
  19115. * @private
  19116. * @param {Array} [array] The array to iterate over.
  19117. * @param {Function} iteratee The function invoked per iteration.
  19118. * @param {*} [accumulator] The initial value.
  19119. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19120. * the initial value.
  19121. * @returns {*} Returns the accumulated value.
  19122. */
  19123. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19124. var index = -1,
  19125. length = array == null ? 0 : array.length;
  19126. if (initAccum && length) {
  19127. accumulator = array[++index];
  19128. }
  19129. while (++index < length) {
  19130. accumulator = iteratee(accumulator, array[index], index, array);
  19131. }
  19132. return accumulator;
  19133. }
  19134. /**
  19135. * A specialized version of `_.reduceRight` for arrays without support for
  19136. * iteratee shorthands.
  19137. *
  19138. * @private
  19139. * @param {Array} [array] The array to iterate over.
  19140. * @param {Function} iteratee The function invoked per iteration.
  19141. * @param {*} [accumulator] The initial value.
  19142. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19143. * the initial value.
  19144. * @returns {*} Returns the accumulated value.
  19145. */
  19146. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19147. var length = array == null ? 0 : array.length;
  19148. if (initAccum && length) {
  19149. accumulator = array[--length];
  19150. }
  19151. while (length--) {
  19152. accumulator = iteratee(accumulator, array[length], length, array);
  19153. }
  19154. return accumulator;
  19155. }
  19156. /**
  19157. * A specialized version of `_.some` for arrays without support for iteratee
  19158. * shorthands.
  19159. *
  19160. * @private
  19161. * @param {Array} [array] The array to iterate over.
  19162. * @param {Function} predicate The function invoked per iteration.
  19163. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19164. * else `false`.
  19165. */
  19166. function arraySome(array, predicate) {
  19167. var index = -1,
  19168. length = array == null ? 0 : array.length;
  19169. while (++index < length) {
  19170. if (predicate(array[index], index, array)) {
  19171. return true;
  19172. }
  19173. }
  19174. return false;
  19175. }
  19176. /**
  19177. * Gets the size of an ASCII `string`.
  19178. *
  19179. * @private
  19180. * @param {string} string The string inspect.
  19181. * @returns {number} Returns the string size.
  19182. */
  19183. var asciiSize = baseProperty('length');
  19184. /**
  19185. * Converts an ASCII `string` to an array.
  19186. *
  19187. * @private
  19188. * @param {string} string The string to convert.
  19189. * @returns {Array} Returns the converted array.
  19190. */
  19191. function asciiToArray(string) {
  19192. return string.split('');
  19193. }
  19194. /**
  19195. * Splits an ASCII `string` into an array of its words.
  19196. *
  19197. * @private
  19198. * @param {string} The string to inspect.
  19199. * @returns {Array} Returns the words of `string`.
  19200. */
  19201. function asciiWords(string) {
  19202. return string.match(reAsciiWord) || [];
  19203. }
  19204. /**
  19205. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19206. * without support for iteratee shorthands, which iterates over `collection`
  19207. * using `eachFunc`.
  19208. *
  19209. * @private
  19210. * @param {Array|Object} collection The collection to inspect.
  19211. * @param {Function} predicate The function invoked per iteration.
  19212. * @param {Function} eachFunc The function to iterate over `collection`.
  19213. * @returns {*} Returns the found element or its key, else `undefined`.
  19214. */
  19215. function baseFindKey(collection, predicate, eachFunc) {
  19216. var result;
  19217. eachFunc(collection, function(value, key, collection) {
  19218. if (predicate(value, key, collection)) {
  19219. result = key;
  19220. return false;
  19221. }
  19222. });
  19223. return result;
  19224. }
  19225. /**
  19226. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19227. * support for iteratee shorthands.
  19228. *
  19229. * @private
  19230. * @param {Array} array The array to inspect.
  19231. * @param {Function} predicate The function invoked per iteration.
  19232. * @param {number} fromIndex The index to search from.
  19233. * @param {boolean} [fromRight] Specify iterating from right to left.
  19234. * @returns {number} Returns the index of the matched value, else `-1`.
  19235. */
  19236. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19237. var length = array.length,
  19238. index = fromIndex + (fromRight ? 1 : -1);
  19239. while ((fromRight ? index-- : ++index < length)) {
  19240. if (predicate(array[index], index, array)) {
  19241. return index;
  19242. }
  19243. }
  19244. return -1;
  19245. }
  19246. /**
  19247. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19248. *
  19249. * @private
  19250. * @param {Array} array The array to inspect.
  19251. * @param {*} value The value to search for.
  19252. * @param {number} fromIndex The index to search from.
  19253. * @returns {number} Returns the index of the matched value, else `-1`.
  19254. */
  19255. function baseIndexOf(array, value, fromIndex) {
  19256. return value === value
  19257. ? strictIndexOf(array, value, fromIndex)
  19258. : baseFindIndex(array, baseIsNaN, fromIndex);
  19259. }
  19260. /**
  19261. * This function is like `baseIndexOf` except that it accepts a comparator.
  19262. *
  19263. * @private
  19264. * @param {Array} array The array to inspect.
  19265. * @param {*} value The value to search for.
  19266. * @param {number} fromIndex The index to search from.
  19267. * @param {Function} comparator The comparator invoked per element.
  19268. * @returns {number} Returns the index of the matched value, else `-1`.
  19269. */
  19270. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19271. var index = fromIndex - 1,
  19272. length = array.length;
  19273. while (++index < length) {
  19274. if (comparator(array[index], value)) {
  19275. return index;
  19276. }
  19277. }
  19278. return -1;
  19279. }
  19280. /**
  19281. * The base implementation of `_.isNaN` without support for number objects.
  19282. *
  19283. * @private
  19284. * @param {*} value The value to check.
  19285. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19286. */
  19287. function baseIsNaN(value) {
  19288. return value !== value;
  19289. }
  19290. /**
  19291. * The base implementation of `_.mean` and `_.meanBy` without support for
  19292. * iteratee shorthands.
  19293. *
  19294. * @private
  19295. * @param {Array} array The array to iterate over.
  19296. * @param {Function} iteratee The function invoked per iteration.
  19297. * @returns {number} Returns the mean.
  19298. */
  19299. function baseMean(array, iteratee) {
  19300. var length = array == null ? 0 : array.length;
  19301. return length ? (baseSum(array, iteratee) / length) : NAN;
  19302. }
  19303. /**
  19304. * The base implementation of `_.property` without support for deep paths.
  19305. *
  19306. * @private
  19307. * @param {string} key The key of the property to get.
  19308. * @returns {Function} Returns the new accessor function.
  19309. */
  19310. function baseProperty(key) {
  19311. return function(object) {
  19312. return object == null ? undefined : object[key];
  19313. };
  19314. }
  19315. /**
  19316. * The base implementation of `_.propertyOf` without support for deep paths.
  19317. *
  19318. * @private
  19319. * @param {Object} object The object to query.
  19320. * @returns {Function} Returns the new accessor function.
  19321. */
  19322. function basePropertyOf(object) {
  19323. return function(key) {
  19324. return object == null ? undefined : object[key];
  19325. };
  19326. }
  19327. /**
  19328. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19329. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19330. *
  19331. * @private
  19332. * @param {Array|Object} collection The collection to iterate over.
  19333. * @param {Function} iteratee The function invoked per iteration.
  19334. * @param {*} accumulator The initial value.
  19335. * @param {boolean} initAccum Specify using the first or last element of
  19336. * `collection` as the initial value.
  19337. * @param {Function} eachFunc The function to iterate over `collection`.
  19338. * @returns {*} Returns the accumulated value.
  19339. */
  19340. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19341. eachFunc(collection, function(value, index, collection) {
  19342. accumulator = initAccum
  19343. ? (initAccum = false, value)
  19344. : iteratee(accumulator, value, index, collection);
  19345. });
  19346. return accumulator;
  19347. }
  19348. /**
  19349. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19350. * sort order of `array` and replaces criteria objects with their corresponding
  19351. * values.
  19352. *
  19353. * @private
  19354. * @param {Array} array The array to sort.
  19355. * @param {Function} comparer The function to define sort order.
  19356. * @returns {Array} Returns `array`.
  19357. */
  19358. function baseSortBy(array, comparer) {
  19359. var length = array.length;
  19360. array.sort(comparer);
  19361. while (length--) {
  19362. array[length] = array[length].value;
  19363. }
  19364. return array;
  19365. }
  19366. /**
  19367. * The base implementation of `_.sum` and `_.sumBy` without support for
  19368. * iteratee shorthands.
  19369. *
  19370. * @private
  19371. * @param {Array} array The array to iterate over.
  19372. * @param {Function} iteratee The function invoked per iteration.
  19373. * @returns {number} Returns the sum.
  19374. */
  19375. function baseSum(array, iteratee) {
  19376. var result,
  19377. index = -1,
  19378. length = array.length;
  19379. while (++index < length) {
  19380. var current = iteratee(array[index]);
  19381. if (current !== undefined) {
  19382. result = result === undefined ? current : (result + current);
  19383. }
  19384. }
  19385. return result;
  19386. }
  19387. /**
  19388. * The base implementation of `_.times` without support for iteratee shorthands
  19389. * or max array length checks.
  19390. *
  19391. * @private
  19392. * @param {number} n The number of times to invoke `iteratee`.
  19393. * @param {Function} iteratee The function invoked per iteration.
  19394. * @returns {Array} Returns the array of results.
  19395. */
  19396. function baseTimes(n, iteratee) {
  19397. var index = -1,
  19398. result = Array(n);
  19399. while (++index < n) {
  19400. result[index] = iteratee(index);
  19401. }
  19402. return result;
  19403. }
  19404. /**
  19405. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19406. * of key-value pairs for `object` corresponding to the property names of `props`.
  19407. *
  19408. * @private
  19409. * @param {Object} object The object to query.
  19410. * @param {Array} props The property names to get values for.
  19411. * @returns {Object} Returns the key-value pairs.
  19412. */
  19413. function baseToPairs(object, props) {
  19414. return arrayMap(props, function(key) {
  19415. return [key, object[key]];
  19416. });
  19417. }
  19418. /**
  19419. * The base implementation of `_.unary` without support for storing metadata.
  19420. *
  19421. * @private
  19422. * @param {Function} func The function to cap arguments for.
  19423. * @returns {Function} Returns the new capped function.
  19424. */
  19425. function baseUnary(func) {
  19426. return function(value) {
  19427. return func(value);
  19428. };
  19429. }
  19430. /**
  19431. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19432. * array of `object` property values corresponding to the property names
  19433. * of `props`.
  19434. *
  19435. * @private
  19436. * @param {Object} object The object to query.
  19437. * @param {Array} props The property names to get values for.
  19438. * @returns {Object} Returns the array of property values.
  19439. */
  19440. function baseValues(object, props) {
  19441. return arrayMap(props, function(key) {
  19442. return object[key];
  19443. });
  19444. }
  19445. /**
  19446. * Checks if a `cache` value for `key` exists.
  19447. *
  19448. * @private
  19449. * @param {Object} cache The cache to query.
  19450. * @param {string} key The key of the entry to check.
  19451. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19452. */
  19453. function cacheHas(cache, key) {
  19454. return cache.has(key);
  19455. }
  19456. /**
  19457. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19458. * that is not found in the character symbols.
  19459. *
  19460. * @private
  19461. * @param {Array} strSymbols The string symbols to inspect.
  19462. * @param {Array} chrSymbols The character symbols to find.
  19463. * @returns {number} Returns the index of the first unmatched string symbol.
  19464. */
  19465. function charsStartIndex(strSymbols, chrSymbols) {
  19466. var index = -1,
  19467. length = strSymbols.length;
  19468. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19469. return index;
  19470. }
  19471. /**
  19472. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19473. * that is not found in the character symbols.
  19474. *
  19475. * @private
  19476. * @param {Array} strSymbols The string symbols to inspect.
  19477. * @param {Array} chrSymbols The character symbols to find.
  19478. * @returns {number} Returns the index of the last unmatched string symbol.
  19479. */
  19480. function charsEndIndex(strSymbols, chrSymbols) {
  19481. var index = strSymbols.length;
  19482. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19483. return index;
  19484. }
  19485. /**
  19486. * Gets the number of `placeholder` occurrences in `array`.
  19487. *
  19488. * @private
  19489. * @param {Array} array The array to inspect.
  19490. * @param {*} placeholder The placeholder to search for.
  19491. * @returns {number} Returns the placeholder count.
  19492. */
  19493. function countHolders(array, placeholder) {
  19494. var length = array.length,
  19495. result = 0;
  19496. while (length--) {
  19497. if (array[length] === placeholder) {
  19498. ++result;
  19499. }
  19500. }
  19501. return result;
  19502. }
  19503. /**
  19504. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19505. * letters to basic Latin letters.
  19506. *
  19507. * @private
  19508. * @param {string} letter The matched letter to deburr.
  19509. * @returns {string} Returns the deburred letter.
  19510. */
  19511. var deburrLetter = basePropertyOf(deburredLetters);
  19512. /**
  19513. * Used by `_.escape` to convert characters to HTML entities.
  19514. *
  19515. * @private
  19516. * @param {string} chr The matched character to escape.
  19517. * @returns {string} Returns the escaped character.
  19518. */
  19519. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19520. /**
  19521. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19522. *
  19523. * @private
  19524. * @param {string} chr The matched character to escape.
  19525. * @returns {string} Returns the escaped character.
  19526. */
  19527. function escapeStringChar(chr) {
  19528. return '\\' + stringEscapes[chr];
  19529. }
  19530. /**
  19531. * Gets the value at `key` of `object`.
  19532. *
  19533. * @private
  19534. * @param {Object} [object] The object to query.
  19535. * @param {string} key The key of the property to get.
  19536. * @returns {*} Returns the property value.
  19537. */
  19538. function getValue(object, key) {
  19539. return object == null ? undefined : object[key];
  19540. }
  19541. /**
  19542. * Checks if `string` contains Unicode symbols.
  19543. *
  19544. * @private
  19545. * @param {string} string The string to inspect.
  19546. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19547. */
  19548. function hasUnicode(string) {
  19549. return reHasUnicode.test(string);
  19550. }
  19551. /**
  19552. * Checks if `string` contains a word composed of Unicode symbols.
  19553. *
  19554. * @private
  19555. * @param {string} string The string to inspect.
  19556. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19557. */
  19558. function hasUnicodeWord(string) {
  19559. return reHasUnicodeWord.test(string);
  19560. }
  19561. /**
  19562. * Converts `iterator` to an array.
  19563. *
  19564. * @private
  19565. * @param {Object} iterator The iterator to convert.
  19566. * @returns {Array} Returns the converted array.
  19567. */
  19568. function iteratorToArray(iterator) {
  19569. var data,
  19570. result = [];
  19571. while (!(data = iterator.next()).done) {
  19572. result.push(data.value);
  19573. }
  19574. return result;
  19575. }
  19576. /**
  19577. * Converts `map` to its key-value pairs.
  19578. *
  19579. * @private
  19580. * @param {Object} map The map to convert.
  19581. * @returns {Array} Returns the key-value pairs.
  19582. */
  19583. function mapToArray(map) {
  19584. var index = -1,
  19585. result = Array(map.size);
  19586. map.forEach(function(value, key) {
  19587. result[++index] = [key, value];
  19588. });
  19589. return result;
  19590. }
  19591. /**
  19592. * Creates a unary function that invokes `func` with its argument transformed.
  19593. *
  19594. * @private
  19595. * @param {Function} func The function to wrap.
  19596. * @param {Function} transform The argument transform.
  19597. * @returns {Function} Returns the new function.
  19598. */
  19599. function overArg(func, transform) {
  19600. return function(arg) {
  19601. return func(transform(arg));
  19602. };
  19603. }
  19604. /**
  19605. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19606. * and returns an array of their indexes.
  19607. *
  19608. * @private
  19609. * @param {Array} array The array to modify.
  19610. * @param {*} placeholder The placeholder to replace.
  19611. * @returns {Array} Returns the new array of placeholder indexes.
  19612. */
  19613. function replaceHolders(array, placeholder) {
  19614. var index = -1,
  19615. length = array.length,
  19616. resIndex = 0,
  19617. result = [];
  19618. while (++index < length) {
  19619. var value = array[index];
  19620. if (value === placeholder || value === PLACEHOLDER) {
  19621. array[index] = PLACEHOLDER;
  19622. result[resIndex++] = index;
  19623. }
  19624. }
  19625. return result;
  19626. }
  19627. /**
  19628. * Converts `set` to an array of its values.
  19629. *
  19630. * @private
  19631. * @param {Object} set The set to convert.
  19632. * @returns {Array} Returns the values.
  19633. */
  19634. function setToArray(set) {
  19635. var index = -1,
  19636. result = Array(set.size);
  19637. set.forEach(function(value) {
  19638. result[++index] = value;
  19639. });
  19640. return result;
  19641. }
  19642. /**
  19643. * Converts `set` to its value-value pairs.
  19644. *
  19645. * @private
  19646. * @param {Object} set The set to convert.
  19647. * @returns {Array} Returns the value-value pairs.
  19648. */
  19649. function setToPairs(set) {
  19650. var index = -1,
  19651. result = Array(set.size);
  19652. set.forEach(function(value) {
  19653. result[++index] = [value, value];
  19654. });
  19655. return result;
  19656. }
  19657. /**
  19658. * A specialized version of `_.indexOf` which performs strict equality
  19659. * comparisons of values, i.e. `===`.
  19660. *
  19661. * @private
  19662. * @param {Array} array The array to inspect.
  19663. * @param {*} value The value to search for.
  19664. * @param {number} fromIndex The index to search from.
  19665. * @returns {number} Returns the index of the matched value, else `-1`.
  19666. */
  19667. function strictIndexOf(array, value, fromIndex) {
  19668. var index = fromIndex - 1,
  19669. length = array.length;
  19670. while (++index < length) {
  19671. if (array[index] === value) {
  19672. return index;
  19673. }
  19674. }
  19675. return -1;
  19676. }
  19677. /**
  19678. * A specialized version of `_.lastIndexOf` which performs strict equality
  19679. * comparisons of values, i.e. `===`.
  19680. *
  19681. * @private
  19682. * @param {Array} array The array to inspect.
  19683. * @param {*} value The value to search for.
  19684. * @param {number} fromIndex The index to search from.
  19685. * @returns {number} Returns the index of the matched value, else `-1`.
  19686. */
  19687. function strictLastIndexOf(array, value, fromIndex) {
  19688. var index = fromIndex + 1;
  19689. while (index--) {
  19690. if (array[index] === value) {
  19691. return index;
  19692. }
  19693. }
  19694. return index;
  19695. }
  19696. /**
  19697. * Gets the number of symbols in `string`.
  19698. *
  19699. * @private
  19700. * @param {string} string The string to inspect.
  19701. * @returns {number} Returns the string size.
  19702. */
  19703. function stringSize(string) {
  19704. return hasUnicode(string)
  19705. ? unicodeSize(string)
  19706. : asciiSize(string);
  19707. }
  19708. /**
  19709. * Converts `string` to an array.
  19710. *
  19711. * @private
  19712. * @param {string} string The string to convert.
  19713. * @returns {Array} Returns the converted array.
  19714. */
  19715. function stringToArray(string) {
  19716. return hasUnicode(string)
  19717. ? unicodeToArray(string)
  19718. : asciiToArray(string);
  19719. }
  19720. /**
  19721. * Used by `_.unescape` to convert HTML entities to characters.
  19722. *
  19723. * @private
  19724. * @param {string} chr The matched character to unescape.
  19725. * @returns {string} Returns the unescaped character.
  19726. */
  19727. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19728. /**
  19729. * Gets the size of a Unicode `string`.
  19730. *
  19731. * @private
  19732. * @param {string} string The string inspect.
  19733. * @returns {number} Returns the string size.
  19734. */
  19735. function unicodeSize(string) {
  19736. var result = reUnicode.lastIndex = 0;
  19737. while (reUnicode.test(string)) {
  19738. ++result;
  19739. }
  19740. return result;
  19741. }
  19742. /**
  19743. * Converts a Unicode `string` to an array.
  19744. *
  19745. * @private
  19746. * @param {string} string The string to convert.
  19747. * @returns {Array} Returns the converted array.
  19748. */
  19749. function unicodeToArray(string) {
  19750. return string.match(reUnicode) || [];
  19751. }
  19752. /**
  19753. * Splits a Unicode `string` into an array of its words.
  19754. *
  19755. * @private
  19756. * @param {string} The string to inspect.
  19757. * @returns {Array} Returns the words of `string`.
  19758. */
  19759. function unicodeWords(string) {
  19760. return string.match(reUnicodeWord) || [];
  19761. }
  19762. /*--------------------------------------------------------------------------*/
  19763. /**
  19764. * Create a new pristine `lodash` function using the `context` object.
  19765. *
  19766. * @static
  19767. * @memberOf _
  19768. * @since 1.1.0
  19769. * @category Util
  19770. * @param {Object} [context=root] The context object.
  19771. * @returns {Function} Returns a new `lodash` function.
  19772. * @example
  19773. *
  19774. * _.mixin({ 'foo': _.constant('foo') });
  19775. *
  19776. * var lodash = _.runInContext();
  19777. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19778. *
  19779. * _.isFunction(_.foo);
  19780. * // => true
  19781. * _.isFunction(_.bar);
  19782. * // => false
  19783. *
  19784. * lodash.isFunction(lodash.foo);
  19785. * // => false
  19786. * lodash.isFunction(lodash.bar);
  19787. * // => true
  19788. *
  19789. * // Create a suped-up `defer` in Node.js.
  19790. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19791. */
  19792. var runInContext = (function runInContext(context) {
  19793. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19794. /** Built-in constructor references. */
  19795. var Array = context.Array,
  19796. Date = context.Date,
  19797. Error = context.Error,
  19798. Function = context.Function,
  19799. Math = context.Math,
  19800. Object = context.Object,
  19801. RegExp = context.RegExp,
  19802. String = context.String,
  19803. TypeError = context.TypeError;
  19804. /** Used for built-in method references. */
  19805. var arrayProto = Array.prototype,
  19806. funcProto = Function.prototype,
  19807. objectProto = Object.prototype;
  19808. /** Used to detect overreaching core-js shims. */
  19809. var coreJsData = context['__core-js_shared__'];
  19810. /** Used to resolve the decompiled source of functions. */
  19811. var funcToString = funcProto.toString;
  19812. /** Used to check objects for own properties. */
  19813. var hasOwnProperty = objectProto.hasOwnProperty;
  19814. /** Used to generate unique IDs. */
  19815. var idCounter = 0;
  19816. /** Used to detect methods masquerading as native. */
  19817. var maskSrcKey = (function() {
  19818. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19819. return uid ? ('Symbol(src)_1.' + uid) : '';
  19820. }());
  19821. /**
  19822. * Used to resolve the
  19823. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19824. * of values.
  19825. */
  19826. var nativeObjectToString = objectProto.toString;
  19827. /** Used to infer the `Object` constructor. */
  19828. var objectCtorString = funcToString.call(Object);
  19829. /** Used to restore the original `_` reference in `_.noConflict`. */
  19830. var oldDash = root._;
  19831. /** Used to detect if a method is native. */
  19832. var reIsNative = RegExp('^' +
  19833. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19834. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19835. );
  19836. /** Built-in value references. */
  19837. var Buffer = moduleExports ? context.Buffer : undefined,
  19838. Symbol = context.Symbol,
  19839. Uint8Array = context.Uint8Array,
  19840. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19841. getPrototype = overArg(Object.getPrototypeOf, Object),
  19842. objectCreate = Object.create,
  19843. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19844. splice = arrayProto.splice,
  19845. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19846. symIterator = Symbol ? Symbol.iterator : undefined,
  19847. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19848. var defineProperty = (function() {
  19849. try {
  19850. var func = getNative(Object, 'defineProperty');
  19851. func({}, '', {});
  19852. return func;
  19853. } catch (e) {}
  19854. }());
  19855. /** Mocked built-ins. */
  19856. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19857. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19858. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19859. /* Built-in method references for those with the same name as other `lodash` methods. */
  19860. var nativeCeil = Math.ceil,
  19861. nativeFloor = Math.floor,
  19862. nativeGetSymbols = Object.getOwnPropertySymbols,
  19863. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19864. nativeIsFinite = context.isFinite,
  19865. nativeJoin = arrayProto.join,
  19866. nativeKeys = overArg(Object.keys, Object),
  19867. nativeMax = Math.max,
  19868. nativeMin = Math.min,
  19869. nativeNow = Date.now,
  19870. nativeParseInt = context.parseInt,
  19871. nativeRandom = Math.random,
  19872. nativeReverse = arrayProto.reverse;
  19873. /* Built-in method references that are verified to be native. */
  19874. var DataView = getNative(context, 'DataView'),
  19875. Map = getNative(context, 'Map'),
  19876. Promise = getNative(context, 'Promise'),
  19877. Set = getNative(context, 'Set'),
  19878. WeakMap = getNative(context, 'WeakMap'),
  19879. nativeCreate = getNative(Object, 'create');
  19880. /** Used to store function metadata. */
  19881. var metaMap = WeakMap && new WeakMap;
  19882. /** Used to lookup unminified function names. */
  19883. var realNames = {};
  19884. /** Used to detect maps, sets, and weakmaps. */
  19885. var dataViewCtorString = toSource(DataView),
  19886. mapCtorString = toSource(Map),
  19887. promiseCtorString = toSource(Promise),
  19888. setCtorString = toSource(Set),
  19889. weakMapCtorString = toSource(WeakMap);
  19890. /** Used to convert symbols to primitives and strings. */
  19891. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19892. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19893. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19894. /*------------------------------------------------------------------------*/
  19895. /**
  19896. * Creates a `lodash` object which wraps `value` to enable implicit method
  19897. * chain sequences. Methods that operate on and return arrays, collections,
  19898. * and functions can be chained together. Methods that retrieve a single value
  19899. * or may return a primitive value will automatically end the chain sequence
  19900. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19901. * with `_#value`.
  19902. *
  19903. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19904. * enabled using `_.chain`.
  19905. *
  19906. * The execution of chained methods is lazy, that is, it's deferred until
  19907. * `_#value` is implicitly or explicitly called.
  19908. *
  19909. * Lazy evaluation allows several methods to support shortcut fusion.
  19910. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19911. * the creation of intermediate arrays and can greatly reduce the number of
  19912. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19913. * fusion if the section is applied to an array and iteratees accept only
  19914. * one argument. The heuristic for whether a section qualifies for shortcut
  19915. * fusion is subject to change.
  19916. *
  19917. * Chaining is supported in custom builds as long as the `_#value` method is
  19918. * directly or indirectly included in the build.
  19919. *
  19920. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19921. *
  19922. * The wrapper `Array` methods are:
  19923. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19924. *
  19925. * The wrapper `String` methods are:
  19926. * `replace` and `split`
  19927. *
  19928. * The wrapper methods that support shortcut fusion are:
  19929. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19930. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19931. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19932. *
  19933. * The chainable wrapper methods are:
  19934. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19935. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19936. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19937. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19938. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19939. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19940. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19941. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19942. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19943. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19944. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19945. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19946. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19947. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19948. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19949. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19950. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19951. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19952. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19953. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19954. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19955. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19956. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19957. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19958. *
  19959. * The wrapper methods that are **not** chainable by default are:
  19960. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19961. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19962. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19963. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19964. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19965. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19966. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19967. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19968. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19969. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19970. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19971. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19972. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19973. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19974. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19975. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19976. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19977. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19978. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19979. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19980. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19981. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19982. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19983. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19984. * `upperFirst`, `value`, and `words`
  19985. *
  19986. * @name _
  19987. * @constructor
  19988. * @category Seq
  19989. * @param {*} value The value to wrap in a `lodash` instance.
  19990. * @returns {Object} Returns the new `lodash` wrapper instance.
  19991. * @example
  19992. *
  19993. * function square(n) {
  19994. * return n * n;
  19995. * }
  19996. *
  19997. * var wrapped = _([1, 2, 3]);
  19998. *
  19999. * // Returns an unwrapped value.
  20000. * wrapped.reduce(_.add);
  20001. * // => 6
  20002. *
  20003. * // Returns a wrapped value.
  20004. * var squares = wrapped.map(square);
  20005. *
  20006. * _.isArray(squares);
  20007. * // => false
  20008. *
  20009. * _.isArray(squares.value());
  20010. * // => true
  20011. */
  20012. function lodash(value) {
  20013. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20014. if (value instanceof LodashWrapper) {
  20015. return value;
  20016. }
  20017. if (hasOwnProperty.call(value, '__wrapped__')) {
  20018. return wrapperClone(value);
  20019. }
  20020. }
  20021. return new LodashWrapper(value);
  20022. }
  20023. /**
  20024. * The base implementation of `_.create` without support for assigning
  20025. * properties to the created object.
  20026. *
  20027. * @private
  20028. * @param {Object} proto The object to inherit from.
  20029. * @returns {Object} Returns the new object.
  20030. */
  20031. var baseCreate = (function() {
  20032. function object() {}
  20033. return function(proto) {
  20034. if (!isObject(proto)) {
  20035. return {};
  20036. }
  20037. if (objectCreate) {
  20038. return objectCreate(proto);
  20039. }
  20040. object.prototype = proto;
  20041. var result = new object;
  20042. object.prototype = undefined;
  20043. return result;
  20044. };
  20045. }());
  20046. /**
  20047. * The function whose prototype chain sequence wrappers inherit from.
  20048. *
  20049. * @private
  20050. */
  20051. function baseLodash() {
  20052. // No operation performed.
  20053. }
  20054. /**
  20055. * The base constructor for creating `lodash` wrapper objects.
  20056. *
  20057. * @private
  20058. * @param {*} value The value to wrap.
  20059. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20060. */
  20061. function LodashWrapper(value, chainAll) {
  20062. this.__wrapped__ = value;
  20063. this.__actions__ = [];
  20064. this.__chain__ = !!chainAll;
  20065. this.__index__ = 0;
  20066. this.__values__ = undefined;
  20067. }
  20068. /**
  20069. * By default, the template delimiters used by lodash are like those in
  20070. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20071. * following template settings to use alternative delimiters.
  20072. *
  20073. * @static
  20074. * @memberOf _
  20075. * @type {Object}
  20076. */
  20077. lodash.templateSettings = {
  20078. /**
  20079. * Used to detect `data` property values to be HTML-escaped.
  20080. *
  20081. * @memberOf _.templateSettings
  20082. * @type {RegExp}
  20083. */
  20084. 'escape': reEscape,
  20085. /**
  20086. * Used to detect code to be evaluated.
  20087. *
  20088. * @memberOf _.templateSettings
  20089. * @type {RegExp}
  20090. */
  20091. 'evaluate': reEvaluate,
  20092. /**
  20093. * Used to detect `data` property values to inject.
  20094. *
  20095. * @memberOf _.templateSettings
  20096. * @type {RegExp}
  20097. */
  20098. 'interpolate': reInterpolate,
  20099. /**
  20100. * Used to reference the data object in the template text.
  20101. *
  20102. * @memberOf _.templateSettings
  20103. * @type {string}
  20104. */
  20105. 'variable': '',
  20106. /**
  20107. * Used to import variables into the compiled template.
  20108. *
  20109. * @memberOf _.templateSettings
  20110. * @type {Object}
  20111. */
  20112. 'imports': {
  20113. /**
  20114. * A reference to the `lodash` function.
  20115. *
  20116. * @memberOf _.templateSettings.imports
  20117. * @type {Function}
  20118. */
  20119. '_': lodash
  20120. }
  20121. };
  20122. // Ensure wrappers are instances of `baseLodash`.
  20123. lodash.prototype = baseLodash.prototype;
  20124. lodash.prototype.constructor = lodash;
  20125. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20126. LodashWrapper.prototype.constructor = LodashWrapper;
  20127. /*------------------------------------------------------------------------*/
  20128. /**
  20129. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20130. *
  20131. * @private
  20132. * @constructor
  20133. * @param {*} value The value to wrap.
  20134. */
  20135. function LazyWrapper(value) {
  20136. this.__wrapped__ = value;
  20137. this.__actions__ = [];
  20138. this.__dir__ = 1;
  20139. this.__filtered__ = false;
  20140. this.__iteratees__ = [];
  20141. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20142. this.__views__ = [];
  20143. }
  20144. /**
  20145. * Creates a clone of the lazy wrapper object.
  20146. *
  20147. * @private
  20148. * @name clone
  20149. * @memberOf LazyWrapper
  20150. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20151. */
  20152. function lazyClone() {
  20153. var result = new LazyWrapper(this.__wrapped__);
  20154. result.__actions__ = copyArray(this.__actions__);
  20155. result.__dir__ = this.__dir__;
  20156. result.__filtered__ = this.__filtered__;
  20157. result.__iteratees__ = copyArray(this.__iteratees__);
  20158. result.__takeCount__ = this.__takeCount__;
  20159. result.__views__ = copyArray(this.__views__);
  20160. return result;
  20161. }
  20162. /**
  20163. * Reverses the direction of lazy iteration.
  20164. *
  20165. * @private
  20166. * @name reverse
  20167. * @memberOf LazyWrapper
  20168. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20169. */
  20170. function lazyReverse() {
  20171. if (this.__filtered__) {
  20172. var result = new LazyWrapper(this);
  20173. result.__dir__ = -1;
  20174. result.__filtered__ = true;
  20175. } else {
  20176. result = this.clone();
  20177. result.__dir__ *= -1;
  20178. }
  20179. return result;
  20180. }
  20181. /**
  20182. * Extracts the unwrapped value from its lazy wrapper.
  20183. *
  20184. * @private
  20185. * @name value
  20186. * @memberOf LazyWrapper
  20187. * @returns {*} Returns the unwrapped value.
  20188. */
  20189. function lazyValue() {
  20190. var array = this.__wrapped__.value(),
  20191. dir = this.__dir__,
  20192. isArr = isArray(array),
  20193. isRight = dir < 0,
  20194. arrLength = isArr ? array.length : 0,
  20195. view = getView(0, arrLength, this.__views__),
  20196. start = view.start,
  20197. end = view.end,
  20198. length = end - start,
  20199. index = isRight ? end : (start - 1),
  20200. iteratees = this.__iteratees__,
  20201. iterLength = iteratees.length,
  20202. resIndex = 0,
  20203. takeCount = nativeMin(length, this.__takeCount__);
  20204. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20205. return baseWrapperValue(array, this.__actions__);
  20206. }
  20207. var result = [];
  20208. outer:
  20209. while (length-- && resIndex < takeCount) {
  20210. index += dir;
  20211. var iterIndex = -1,
  20212. value = array[index];
  20213. while (++iterIndex < iterLength) {
  20214. var data = iteratees[iterIndex],
  20215. iteratee = data.iteratee,
  20216. type = data.type,
  20217. computed = iteratee(value);
  20218. if (type == LAZY_MAP_FLAG) {
  20219. value = computed;
  20220. } else if (!computed) {
  20221. if (type == LAZY_FILTER_FLAG) {
  20222. continue outer;
  20223. } else {
  20224. break outer;
  20225. }
  20226. }
  20227. }
  20228. result[resIndex++] = value;
  20229. }
  20230. return result;
  20231. }
  20232. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20233. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20234. LazyWrapper.prototype.constructor = LazyWrapper;
  20235. /*------------------------------------------------------------------------*/
  20236. /**
  20237. * Creates a hash object.
  20238. *
  20239. * @private
  20240. * @constructor
  20241. * @param {Array} [entries] The key-value pairs to cache.
  20242. */
  20243. function Hash(entries) {
  20244. var index = -1,
  20245. length = entries == null ? 0 : entries.length;
  20246. this.clear();
  20247. while (++index < length) {
  20248. var entry = entries[index];
  20249. this.set(entry[0], entry[1]);
  20250. }
  20251. }
  20252. /**
  20253. * Removes all key-value entries from the hash.
  20254. *
  20255. * @private
  20256. * @name clear
  20257. * @memberOf Hash
  20258. */
  20259. function hashClear() {
  20260. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20261. this.size = 0;
  20262. }
  20263. /**
  20264. * Removes `key` and its value from the hash.
  20265. *
  20266. * @private
  20267. * @name delete
  20268. * @memberOf Hash
  20269. * @param {Object} hash The hash to modify.
  20270. * @param {string} key The key of the value to remove.
  20271. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20272. */
  20273. function hashDelete(key) {
  20274. var result = this.has(key) && delete this.__data__[key];
  20275. this.size -= result ? 1 : 0;
  20276. return result;
  20277. }
  20278. /**
  20279. * Gets the hash value for `key`.
  20280. *
  20281. * @private
  20282. * @name get
  20283. * @memberOf Hash
  20284. * @param {string} key The key of the value to get.
  20285. * @returns {*} Returns the entry value.
  20286. */
  20287. function hashGet(key) {
  20288. var data = this.__data__;
  20289. if (nativeCreate) {
  20290. var result = data[key];
  20291. return result === HASH_UNDEFINED ? undefined : result;
  20292. }
  20293. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20294. }
  20295. /**
  20296. * Checks if a hash value for `key` exists.
  20297. *
  20298. * @private
  20299. * @name has
  20300. * @memberOf Hash
  20301. * @param {string} key The key of the entry to check.
  20302. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20303. */
  20304. function hashHas(key) {
  20305. var data = this.__data__;
  20306. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20307. }
  20308. /**
  20309. * Sets the hash `key` to `value`.
  20310. *
  20311. * @private
  20312. * @name set
  20313. * @memberOf Hash
  20314. * @param {string} key The key of the value to set.
  20315. * @param {*} value The value to set.
  20316. * @returns {Object} Returns the hash instance.
  20317. */
  20318. function hashSet(key, value) {
  20319. var data = this.__data__;
  20320. this.size += this.has(key) ? 0 : 1;
  20321. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20322. return this;
  20323. }
  20324. // Add methods to `Hash`.
  20325. Hash.prototype.clear = hashClear;
  20326. Hash.prototype['delete'] = hashDelete;
  20327. Hash.prototype.get = hashGet;
  20328. Hash.prototype.has = hashHas;
  20329. Hash.prototype.set = hashSet;
  20330. /*------------------------------------------------------------------------*/
  20331. /**
  20332. * Creates an list cache object.
  20333. *
  20334. * @private
  20335. * @constructor
  20336. * @param {Array} [entries] The key-value pairs to cache.
  20337. */
  20338. function ListCache(entries) {
  20339. var index = -1,
  20340. length = entries == null ? 0 : entries.length;
  20341. this.clear();
  20342. while (++index < length) {
  20343. var entry = entries[index];
  20344. this.set(entry[0], entry[1]);
  20345. }
  20346. }
  20347. /**
  20348. * Removes all key-value entries from the list cache.
  20349. *
  20350. * @private
  20351. * @name clear
  20352. * @memberOf ListCache
  20353. */
  20354. function listCacheClear() {
  20355. this.__data__ = [];
  20356. this.size = 0;
  20357. }
  20358. /**
  20359. * Removes `key` and its value from the list cache.
  20360. *
  20361. * @private
  20362. * @name delete
  20363. * @memberOf ListCache
  20364. * @param {string} key The key of the value to remove.
  20365. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20366. */
  20367. function listCacheDelete(key) {
  20368. var data = this.__data__,
  20369. index = assocIndexOf(data, key);
  20370. if (index < 0) {
  20371. return false;
  20372. }
  20373. var lastIndex = data.length - 1;
  20374. if (index == lastIndex) {
  20375. data.pop();
  20376. } else {
  20377. splice.call(data, index, 1);
  20378. }
  20379. --this.size;
  20380. return true;
  20381. }
  20382. /**
  20383. * Gets the list cache value for `key`.
  20384. *
  20385. * @private
  20386. * @name get
  20387. * @memberOf ListCache
  20388. * @param {string} key The key of the value to get.
  20389. * @returns {*} Returns the entry value.
  20390. */
  20391. function listCacheGet(key) {
  20392. var data = this.__data__,
  20393. index = assocIndexOf(data, key);
  20394. return index < 0 ? undefined : data[index][1];
  20395. }
  20396. /**
  20397. * Checks if a list cache value for `key` exists.
  20398. *
  20399. * @private
  20400. * @name has
  20401. * @memberOf ListCache
  20402. * @param {string} key The key of the entry to check.
  20403. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20404. */
  20405. function listCacheHas(key) {
  20406. return assocIndexOf(this.__data__, key) > -1;
  20407. }
  20408. /**
  20409. * Sets the list cache `key` to `value`.
  20410. *
  20411. * @private
  20412. * @name set
  20413. * @memberOf ListCache
  20414. * @param {string} key The key of the value to set.
  20415. * @param {*} value The value to set.
  20416. * @returns {Object} Returns the list cache instance.
  20417. */
  20418. function listCacheSet(key, value) {
  20419. var data = this.__data__,
  20420. index = assocIndexOf(data, key);
  20421. if (index < 0) {
  20422. ++this.size;
  20423. data.push([key, value]);
  20424. } else {
  20425. data[index][1] = value;
  20426. }
  20427. return this;
  20428. }
  20429. // Add methods to `ListCache`.
  20430. ListCache.prototype.clear = listCacheClear;
  20431. ListCache.prototype['delete'] = listCacheDelete;
  20432. ListCache.prototype.get = listCacheGet;
  20433. ListCache.prototype.has = listCacheHas;
  20434. ListCache.prototype.set = listCacheSet;
  20435. /*------------------------------------------------------------------------*/
  20436. /**
  20437. * Creates a map cache object to store key-value pairs.
  20438. *
  20439. * @private
  20440. * @constructor
  20441. * @param {Array} [entries] The key-value pairs to cache.
  20442. */
  20443. function MapCache(entries) {
  20444. var index = -1,
  20445. length = entries == null ? 0 : entries.length;
  20446. this.clear();
  20447. while (++index < length) {
  20448. var entry = entries[index];
  20449. this.set(entry[0], entry[1]);
  20450. }
  20451. }
  20452. /**
  20453. * Removes all key-value entries from the map.
  20454. *
  20455. * @private
  20456. * @name clear
  20457. * @memberOf MapCache
  20458. */
  20459. function mapCacheClear() {
  20460. this.size = 0;
  20461. this.__data__ = {
  20462. 'hash': new Hash,
  20463. 'map': new (Map || ListCache),
  20464. 'string': new Hash
  20465. };
  20466. }
  20467. /**
  20468. * Removes `key` and its value from the map.
  20469. *
  20470. * @private
  20471. * @name delete
  20472. * @memberOf MapCache
  20473. * @param {string} key The key of the value to remove.
  20474. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20475. */
  20476. function mapCacheDelete(key) {
  20477. var result = getMapData(this, key)['delete'](key);
  20478. this.size -= result ? 1 : 0;
  20479. return result;
  20480. }
  20481. /**
  20482. * Gets the map value for `key`.
  20483. *
  20484. * @private
  20485. * @name get
  20486. * @memberOf MapCache
  20487. * @param {string} key The key of the value to get.
  20488. * @returns {*} Returns the entry value.
  20489. */
  20490. function mapCacheGet(key) {
  20491. return getMapData(this, key).get(key);
  20492. }
  20493. /**
  20494. * Checks if a map value for `key` exists.
  20495. *
  20496. * @private
  20497. * @name has
  20498. * @memberOf MapCache
  20499. * @param {string} key The key of the entry to check.
  20500. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20501. */
  20502. function mapCacheHas(key) {
  20503. return getMapData(this, key).has(key);
  20504. }
  20505. /**
  20506. * Sets the map `key` to `value`.
  20507. *
  20508. * @private
  20509. * @name set
  20510. * @memberOf MapCache
  20511. * @param {string} key The key of the value to set.
  20512. * @param {*} value The value to set.
  20513. * @returns {Object} Returns the map cache instance.
  20514. */
  20515. function mapCacheSet(key, value) {
  20516. var data = getMapData(this, key),
  20517. size = data.size;
  20518. data.set(key, value);
  20519. this.size += data.size == size ? 0 : 1;
  20520. return this;
  20521. }
  20522. // Add methods to `MapCache`.
  20523. MapCache.prototype.clear = mapCacheClear;
  20524. MapCache.prototype['delete'] = mapCacheDelete;
  20525. MapCache.prototype.get = mapCacheGet;
  20526. MapCache.prototype.has = mapCacheHas;
  20527. MapCache.prototype.set = mapCacheSet;
  20528. /*------------------------------------------------------------------------*/
  20529. /**
  20530. *
  20531. * Creates an array cache object to store unique values.
  20532. *
  20533. * @private
  20534. * @constructor
  20535. * @param {Array} [values] The values to cache.
  20536. */
  20537. function SetCache(values) {
  20538. var index = -1,
  20539. length = values == null ? 0 : values.length;
  20540. this.__data__ = new MapCache;
  20541. while (++index < length) {
  20542. this.add(values[index]);
  20543. }
  20544. }
  20545. /**
  20546. * Adds `value` to the array cache.
  20547. *
  20548. * @private
  20549. * @name add
  20550. * @memberOf SetCache
  20551. * @alias push
  20552. * @param {*} value The value to cache.
  20553. * @returns {Object} Returns the cache instance.
  20554. */
  20555. function setCacheAdd(value) {
  20556. this.__data__.set(value, HASH_UNDEFINED);
  20557. return this;
  20558. }
  20559. /**
  20560. * Checks if `value` is in the array cache.
  20561. *
  20562. * @private
  20563. * @name has
  20564. * @memberOf SetCache
  20565. * @param {*} value The value to search for.
  20566. * @returns {number} Returns `true` if `value` is found, else `false`.
  20567. */
  20568. function setCacheHas(value) {
  20569. return this.__data__.has(value);
  20570. }
  20571. // Add methods to `SetCache`.
  20572. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20573. SetCache.prototype.has = setCacheHas;
  20574. /*------------------------------------------------------------------------*/
  20575. /**
  20576. * Creates a stack cache object to store key-value pairs.
  20577. *
  20578. * @private
  20579. * @constructor
  20580. * @param {Array} [entries] The key-value pairs to cache.
  20581. */
  20582. function Stack(entries) {
  20583. var data = this.__data__ = new ListCache(entries);
  20584. this.size = data.size;
  20585. }
  20586. /**
  20587. * Removes all key-value entries from the stack.
  20588. *
  20589. * @private
  20590. * @name clear
  20591. * @memberOf Stack
  20592. */
  20593. function stackClear() {
  20594. this.__data__ = new ListCache;
  20595. this.size = 0;
  20596. }
  20597. /**
  20598. * Removes `key` and its value from the stack.
  20599. *
  20600. * @private
  20601. * @name delete
  20602. * @memberOf Stack
  20603. * @param {string} key The key of the value to remove.
  20604. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20605. */
  20606. function stackDelete(key) {
  20607. var data = this.__data__,
  20608. result = data['delete'](key);
  20609. this.size = data.size;
  20610. return result;
  20611. }
  20612. /**
  20613. * Gets the stack value for `key`.
  20614. *
  20615. * @private
  20616. * @name get
  20617. * @memberOf Stack
  20618. * @param {string} key The key of the value to get.
  20619. * @returns {*} Returns the entry value.
  20620. */
  20621. function stackGet(key) {
  20622. return this.__data__.get(key);
  20623. }
  20624. /**
  20625. * Checks if a stack value for `key` exists.
  20626. *
  20627. * @private
  20628. * @name has
  20629. * @memberOf Stack
  20630. * @param {string} key The key of the entry to check.
  20631. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20632. */
  20633. function stackHas(key) {
  20634. return this.__data__.has(key);
  20635. }
  20636. /**
  20637. * Sets the stack `key` to `value`.
  20638. *
  20639. * @private
  20640. * @name set
  20641. * @memberOf Stack
  20642. * @param {string} key The key of the value to set.
  20643. * @param {*} value The value to set.
  20644. * @returns {Object} Returns the stack cache instance.
  20645. */
  20646. function stackSet(key, value) {
  20647. var data = this.__data__;
  20648. if (data instanceof ListCache) {
  20649. var pairs = data.__data__;
  20650. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20651. pairs.push([key, value]);
  20652. this.size = ++data.size;
  20653. return this;
  20654. }
  20655. data = this.__data__ = new MapCache(pairs);
  20656. }
  20657. data.set(key, value);
  20658. this.size = data.size;
  20659. return this;
  20660. }
  20661. // Add methods to `Stack`.
  20662. Stack.prototype.clear = stackClear;
  20663. Stack.prototype['delete'] = stackDelete;
  20664. Stack.prototype.get = stackGet;
  20665. Stack.prototype.has = stackHas;
  20666. Stack.prototype.set = stackSet;
  20667. /*------------------------------------------------------------------------*/
  20668. /**
  20669. * Creates an array of the enumerable property names of the array-like `value`.
  20670. *
  20671. * @private
  20672. * @param {*} value The value to query.
  20673. * @param {boolean} inherited Specify returning inherited property names.
  20674. * @returns {Array} Returns the array of property names.
  20675. */
  20676. function arrayLikeKeys(value, inherited) {
  20677. var isArr = isArray(value),
  20678. isArg = !isArr && isArguments(value),
  20679. isBuff = !isArr && !isArg && isBuffer(value),
  20680. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20681. skipIndexes = isArr || isArg || isBuff || isType,
  20682. result = skipIndexes ? baseTimes(value.length, String) : [],
  20683. length = result.length;
  20684. for (var key in value) {
  20685. if ((inherited || hasOwnProperty.call(value, key)) &&
  20686. !(skipIndexes && (
  20687. // Safari 9 has enumerable `arguments.length` in strict mode.
  20688. key == 'length' ||
  20689. // Node.js 0.10 has enumerable non-index properties on buffers.
  20690. (isBuff && (key == 'offset' || key == 'parent')) ||
  20691. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20692. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20693. // Skip index properties.
  20694. isIndex(key, length)
  20695. ))) {
  20696. result.push(key);
  20697. }
  20698. }
  20699. return result;
  20700. }
  20701. /**
  20702. * A specialized version of `_.sample` for arrays.
  20703. *
  20704. * @private
  20705. * @param {Array} array The array to sample.
  20706. * @returns {*} Returns the random element.
  20707. */
  20708. function arraySample(array) {
  20709. var length = array.length;
  20710. return length ? array[baseRandom(0, length - 1)] : undefined;
  20711. }
  20712. /**
  20713. * A specialized version of `_.sampleSize` for arrays.
  20714. *
  20715. * @private
  20716. * @param {Array} array The array to sample.
  20717. * @param {number} n The number of elements to sample.
  20718. * @returns {Array} Returns the random elements.
  20719. */
  20720. function arraySampleSize(array, n) {
  20721. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20722. }
  20723. /**
  20724. * A specialized version of `_.shuffle` for arrays.
  20725. *
  20726. * @private
  20727. * @param {Array} array The array to shuffle.
  20728. * @returns {Array} Returns the new shuffled array.
  20729. */
  20730. function arrayShuffle(array) {
  20731. return shuffleSelf(copyArray(array));
  20732. }
  20733. /**
  20734. * This function is like `assignValue` except that it doesn't assign
  20735. * `undefined` values.
  20736. *
  20737. * @private
  20738. * @param {Object} object The object to modify.
  20739. * @param {string} key The key of the property to assign.
  20740. * @param {*} value The value to assign.
  20741. */
  20742. function assignMergeValue(object, key, value) {
  20743. if ((value !== undefined && !eq(object[key], value)) ||
  20744. (value === undefined && !(key in object))) {
  20745. baseAssignValue(object, key, value);
  20746. }
  20747. }
  20748. /**
  20749. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20750. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20751. * for equality comparisons.
  20752. *
  20753. * @private
  20754. * @param {Object} object The object to modify.
  20755. * @param {string} key The key of the property to assign.
  20756. * @param {*} value The value to assign.
  20757. */
  20758. function assignValue(object, key, value) {
  20759. var objValue = object[key];
  20760. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20761. (value === undefined && !(key in object))) {
  20762. baseAssignValue(object, key, value);
  20763. }
  20764. }
  20765. /**
  20766. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20767. *
  20768. * @private
  20769. * @param {Array} array The array to inspect.
  20770. * @param {*} key The key to search for.
  20771. * @returns {number} Returns the index of the matched value, else `-1`.
  20772. */
  20773. function assocIndexOf(array, key) {
  20774. var length = array.length;
  20775. while (length--) {
  20776. if (eq(array[length][0], key)) {
  20777. return length;
  20778. }
  20779. }
  20780. return -1;
  20781. }
  20782. /**
  20783. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20784. * by `iteratee` and values set by `setter`.
  20785. *
  20786. * @private
  20787. * @param {Array|Object} collection The collection to iterate over.
  20788. * @param {Function} setter The function to set `accumulator` values.
  20789. * @param {Function} iteratee The iteratee to transform keys.
  20790. * @param {Object} accumulator The initial aggregated object.
  20791. * @returns {Function} Returns `accumulator`.
  20792. */
  20793. function baseAggregator(collection, setter, iteratee, accumulator) {
  20794. baseEach(collection, function(value, key, collection) {
  20795. setter(accumulator, value, iteratee(value), collection);
  20796. });
  20797. return accumulator;
  20798. }
  20799. /**
  20800. * The base implementation of `_.assign` without support for multiple sources
  20801. * or `customizer` functions.
  20802. *
  20803. * @private
  20804. * @param {Object} object The destination object.
  20805. * @param {Object} source The source object.
  20806. * @returns {Object} Returns `object`.
  20807. */
  20808. function baseAssign(object, source) {
  20809. return object && copyObject(source, keys(source), object);
  20810. }
  20811. /**
  20812. * The base implementation of `_.assignIn` without support for multiple sources
  20813. * or `customizer` functions.
  20814. *
  20815. * @private
  20816. * @param {Object} object The destination object.
  20817. * @param {Object} source The source object.
  20818. * @returns {Object} Returns `object`.
  20819. */
  20820. function baseAssignIn(object, source) {
  20821. return object && copyObject(source, keysIn(source), object);
  20822. }
  20823. /**
  20824. * The base implementation of `assignValue` and `assignMergeValue` without
  20825. * value checks.
  20826. *
  20827. * @private
  20828. * @param {Object} object The object to modify.
  20829. * @param {string} key The key of the property to assign.
  20830. * @param {*} value The value to assign.
  20831. */
  20832. function baseAssignValue(object, key, value) {
  20833. if (key == '__proto__' && defineProperty) {
  20834. defineProperty(object, key, {
  20835. 'configurable': true,
  20836. 'enumerable': true,
  20837. 'value': value,
  20838. 'writable': true
  20839. });
  20840. } else {
  20841. object[key] = value;
  20842. }
  20843. }
  20844. /**
  20845. * The base implementation of `_.at` without support for individual paths.
  20846. *
  20847. * @private
  20848. * @param {Object} object The object to iterate over.
  20849. * @param {string[]} paths The property paths to pick.
  20850. * @returns {Array} Returns the picked elements.
  20851. */
  20852. function baseAt(object, paths) {
  20853. var index = -1,
  20854. length = paths.length,
  20855. result = Array(length),
  20856. skip = object == null;
  20857. while (++index < length) {
  20858. result[index] = skip ? undefined : get(object, paths[index]);
  20859. }
  20860. return result;
  20861. }
  20862. /**
  20863. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20864. *
  20865. * @private
  20866. * @param {number} number The number to clamp.
  20867. * @param {number} [lower] The lower bound.
  20868. * @param {number} upper The upper bound.
  20869. * @returns {number} Returns the clamped number.
  20870. */
  20871. function baseClamp(number, lower, upper) {
  20872. if (number === number) {
  20873. if (upper !== undefined) {
  20874. number = number <= upper ? number : upper;
  20875. }
  20876. if (lower !== undefined) {
  20877. number = number >= lower ? number : lower;
  20878. }
  20879. }
  20880. return number;
  20881. }
  20882. /**
  20883. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20884. * traversed objects.
  20885. *
  20886. * @private
  20887. * @param {*} value The value to clone.
  20888. * @param {boolean} bitmask The bitmask flags.
  20889. * 1 - Deep clone
  20890. * 2 - Flatten inherited properties
  20891. * 4 - Clone symbols
  20892. * @param {Function} [customizer] The function to customize cloning.
  20893. * @param {string} [key] The key of `value`.
  20894. * @param {Object} [object] The parent object of `value`.
  20895. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20896. * @returns {*} Returns the cloned value.
  20897. */
  20898. function baseClone(value, bitmask, customizer, key, object, stack) {
  20899. var result,
  20900. isDeep = bitmask & CLONE_DEEP_FLAG,
  20901. isFlat = bitmask & CLONE_FLAT_FLAG,
  20902. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20903. if (customizer) {
  20904. result = object ? customizer(value, key, object, stack) : customizer(value);
  20905. }
  20906. if (result !== undefined) {
  20907. return result;
  20908. }
  20909. if (!isObject(value)) {
  20910. return value;
  20911. }
  20912. var isArr = isArray(value);
  20913. if (isArr) {
  20914. result = initCloneArray(value);
  20915. if (!isDeep) {
  20916. return copyArray(value, result);
  20917. }
  20918. } else {
  20919. var tag = getTag(value),
  20920. isFunc = tag == funcTag || tag == genTag;
  20921. if (isBuffer(value)) {
  20922. return cloneBuffer(value, isDeep);
  20923. }
  20924. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20925. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20926. if (!isDeep) {
  20927. return isFlat
  20928. ? copySymbolsIn(value, baseAssignIn(result, value))
  20929. : copySymbols(value, baseAssign(result, value));
  20930. }
  20931. } else {
  20932. if (!cloneableTags[tag]) {
  20933. return object ? value : {};
  20934. }
  20935. result = initCloneByTag(value, tag, isDeep);
  20936. }
  20937. }
  20938. // Check for circular references and return its corresponding clone.
  20939. stack || (stack = new Stack);
  20940. var stacked = stack.get(value);
  20941. if (stacked) {
  20942. return stacked;
  20943. }
  20944. stack.set(value, result);
  20945. if (isSet(value)) {
  20946. value.forEach(function(subValue) {
  20947. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20948. });
  20949. } else if (isMap(value)) {
  20950. value.forEach(function(subValue, key) {
  20951. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20952. });
  20953. }
  20954. var keysFunc = isFull
  20955. ? (isFlat ? getAllKeysIn : getAllKeys)
  20956. : (isFlat ? keysIn : keys);
  20957. var props = isArr ? undefined : keysFunc(value);
  20958. arrayEach(props || value, function(subValue, key) {
  20959. if (props) {
  20960. key = subValue;
  20961. subValue = value[key];
  20962. }
  20963. // Recursively populate clone (susceptible to call stack limits).
  20964. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20965. });
  20966. return result;
  20967. }
  20968. /**
  20969. * The base implementation of `_.conforms` which doesn't clone `source`.
  20970. *
  20971. * @private
  20972. * @param {Object} source The object of property predicates to conform to.
  20973. * @returns {Function} Returns the new spec function.
  20974. */
  20975. function baseConforms(source) {
  20976. var props = keys(source);
  20977. return function(object) {
  20978. return baseConformsTo(object, source, props);
  20979. };
  20980. }
  20981. /**
  20982. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20983. *
  20984. * @private
  20985. * @param {Object} object The object to inspect.
  20986. * @param {Object} source The object of property predicates to conform to.
  20987. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20988. */
  20989. function baseConformsTo(object, source, props) {
  20990. var length = props.length;
  20991. if (object == null) {
  20992. return !length;
  20993. }
  20994. object = Object(object);
  20995. while (length--) {
  20996. var key = props[length],
  20997. predicate = source[key],
  20998. value = object[key];
  20999. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21000. return false;
  21001. }
  21002. }
  21003. return true;
  21004. }
  21005. /**
  21006. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21007. * to provide to `func`.
  21008. *
  21009. * @private
  21010. * @param {Function} func The function to delay.
  21011. * @param {number} wait The number of milliseconds to delay invocation.
  21012. * @param {Array} args The arguments to provide to `func`.
  21013. * @returns {number|Object} Returns the timer id or timeout object.
  21014. */
  21015. function baseDelay(func, wait, args) {
  21016. if (typeof func != 'function') {
  21017. throw new TypeError(FUNC_ERROR_TEXT);
  21018. }
  21019. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21020. }
  21021. /**
  21022. * The base implementation of methods like `_.difference` without support
  21023. * for excluding multiple arrays or iteratee shorthands.
  21024. *
  21025. * @private
  21026. * @param {Array} array The array to inspect.
  21027. * @param {Array} values The values to exclude.
  21028. * @param {Function} [iteratee] The iteratee invoked per element.
  21029. * @param {Function} [comparator] The comparator invoked per element.
  21030. * @returns {Array} Returns the new array of filtered values.
  21031. */
  21032. function baseDifference(array, values, iteratee, comparator) {
  21033. var index = -1,
  21034. includes = arrayIncludes,
  21035. isCommon = true,
  21036. length = array.length,
  21037. result = [],
  21038. valuesLength = values.length;
  21039. if (!length) {
  21040. return result;
  21041. }
  21042. if (iteratee) {
  21043. values = arrayMap(values, baseUnary(iteratee));
  21044. }
  21045. if (comparator) {
  21046. includes = arrayIncludesWith;
  21047. isCommon = false;
  21048. }
  21049. else if (values.length >= LARGE_ARRAY_SIZE) {
  21050. includes = cacheHas;
  21051. isCommon = false;
  21052. values = new SetCache(values);
  21053. }
  21054. outer:
  21055. while (++index < length) {
  21056. var value = array[index],
  21057. computed = iteratee == null ? value : iteratee(value);
  21058. value = (comparator || value !== 0) ? value : 0;
  21059. if (isCommon && computed === computed) {
  21060. var valuesIndex = valuesLength;
  21061. while (valuesIndex--) {
  21062. if (values[valuesIndex] === computed) {
  21063. continue outer;
  21064. }
  21065. }
  21066. result.push(value);
  21067. }
  21068. else if (!includes(values, computed, comparator)) {
  21069. result.push(value);
  21070. }
  21071. }
  21072. return result;
  21073. }
  21074. /**
  21075. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21076. *
  21077. * @private
  21078. * @param {Array|Object} collection The collection to iterate over.
  21079. * @param {Function} iteratee The function invoked per iteration.
  21080. * @returns {Array|Object} Returns `collection`.
  21081. */
  21082. var baseEach = createBaseEach(baseForOwn);
  21083. /**
  21084. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21085. *
  21086. * @private
  21087. * @param {Array|Object} collection The collection to iterate over.
  21088. * @param {Function} iteratee The function invoked per iteration.
  21089. * @returns {Array|Object} Returns `collection`.
  21090. */
  21091. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21092. /**
  21093. * The base implementation of `_.every` without support for iteratee shorthands.
  21094. *
  21095. * @private
  21096. * @param {Array|Object} collection The collection to iterate over.
  21097. * @param {Function} predicate The function invoked per iteration.
  21098. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21099. * else `false`
  21100. */
  21101. function baseEvery(collection, predicate) {
  21102. var result = true;
  21103. baseEach(collection, function(value, index, collection) {
  21104. result = !!predicate(value, index, collection);
  21105. return result;
  21106. });
  21107. return result;
  21108. }
  21109. /**
  21110. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21111. * `comparator` to determine the extremum value.
  21112. *
  21113. * @private
  21114. * @param {Array} array The array to iterate over.
  21115. * @param {Function} iteratee The iteratee invoked per iteration.
  21116. * @param {Function} comparator The comparator used to compare values.
  21117. * @returns {*} Returns the extremum value.
  21118. */
  21119. function baseExtremum(array, iteratee, comparator) {
  21120. var index = -1,
  21121. length = array.length;
  21122. while (++index < length) {
  21123. var value = array[index],
  21124. current = iteratee(value);
  21125. if (current != null && (computed === undefined
  21126. ? (current === current && !isSymbol(current))
  21127. : comparator(current, computed)
  21128. )) {
  21129. var computed = current,
  21130. result = value;
  21131. }
  21132. }
  21133. return result;
  21134. }
  21135. /**
  21136. * The base implementation of `_.fill` without an iteratee call guard.
  21137. *
  21138. * @private
  21139. * @param {Array} array The array to fill.
  21140. * @param {*} value The value to fill `array` with.
  21141. * @param {number} [start=0] The start position.
  21142. * @param {number} [end=array.length] The end position.
  21143. * @returns {Array} Returns `array`.
  21144. */
  21145. function baseFill(array, value, start, end) {
  21146. var length = array.length;
  21147. start = toInteger(start);
  21148. if (start < 0) {
  21149. start = -start > length ? 0 : (length + start);
  21150. }
  21151. end = (end === undefined || end > length) ? length : toInteger(end);
  21152. if (end < 0) {
  21153. end += length;
  21154. }
  21155. end = start > end ? 0 : toLength(end);
  21156. while (start < end) {
  21157. array[start++] = value;
  21158. }
  21159. return array;
  21160. }
  21161. /**
  21162. * The base implementation of `_.filter` without support for iteratee shorthands.
  21163. *
  21164. * @private
  21165. * @param {Array|Object} collection The collection to iterate over.
  21166. * @param {Function} predicate The function invoked per iteration.
  21167. * @returns {Array} Returns the new filtered array.
  21168. */
  21169. function baseFilter(collection, predicate) {
  21170. var result = [];
  21171. baseEach(collection, function(value, index, collection) {
  21172. if (predicate(value, index, collection)) {
  21173. result.push(value);
  21174. }
  21175. });
  21176. return result;
  21177. }
  21178. /**
  21179. * The base implementation of `_.flatten` with support for restricting flattening.
  21180. *
  21181. * @private
  21182. * @param {Array} array The array to flatten.
  21183. * @param {number} depth The maximum recursion depth.
  21184. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21185. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21186. * @param {Array} [result=[]] The initial result value.
  21187. * @returns {Array} Returns the new flattened array.
  21188. */
  21189. function baseFlatten(array, depth, predicate, isStrict, result) {
  21190. var index = -1,
  21191. length = array.length;
  21192. predicate || (predicate = isFlattenable);
  21193. result || (result = []);
  21194. while (++index < length) {
  21195. var value = array[index];
  21196. if (depth > 0 && predicate(value)) {
  21197. if (depth > 1) {
  21198. // Recursively flatten arrays (susceptible to call stack limits).
  21199. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21200. } else {
  21201. arrayPush(result, value);
  21202. }
  21203. } else if (!isStrict) {
  21204. result[result.length] = value;
  21205. }
  21206. }
  21207. return result;
  21208. }
  21209. /**
  21210. * The base implementation of `baseForOwn` which iterates over `object`
  21211. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21212. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21213. *
  21214. * @private
  21215. * @param {Object} object The object to iterate over.
  21216. * @param {Function} iteratee The function invoked per iteration.
  21217. * @param {Function} keysFunc The function to get the keys of `object`.
  21218. * @returns {Object} Returns `object`.
  21219. */
  21220. var baseFor = createBaseFor();
  21221. /**
  21222. * This function is like `baseFor` except that it iterates over properties
  21223. * in the opposite order.
  21224. *
  21225. * @private
  21226. * @param {Object} object The object to iterate over.
  21227. * @param {Function} iteratee The function invoked per iteration.
  21228. * @param {Function} keysFunc The function to get the keys of `object`.
  21229. * @returns {Object} Returns `object`.
  21230. */
  21231. var baseForRight = createBaseFor(true);
  21232. /**
  21233. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21234. *
  21235. * @private
  21236. * @param {Object} object The object to iterate over.
  21237. * @param {Function} iteratee The function invoked per iteration.
  21238. * @returns {Object} Returns `object`.
  21239. */
  21240. function baseForOwn(object, iteratee) {
  21241. return object && baseFor(object, iteratee, keys);
  21242. }
  21243. /**
  21244. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21245. *
  21246. * @private
  21247. * @param {Object} object The object to iterate over.
  21248. * @param {Function} iteratee The function invoked per iteration.
  21249. * @returns {Object} Returns `object`.
  21250. */
  21251. function baseForOwnRight(object, iteratee) {
  21252. return object && baseForRight(object, iteratee, keys);
  21253. }
  21254. /**
  21255. * The base implementation of `_.functions` which creates an array of
  21256. * `object` function property names filtered from `props`.
  21257. *
  21258. * @private
  21259. * @param {Object} object The object to inspect.
  21260. * @param {Array} props The property names to filter.
  21261. * @returns {Array} Returns the function names.
  21262. */
  21263. function baseFunctions(object, props) {
  21264. return arrayFilter(props, function(key) {
  21265. return isFunction(object[key]);
  21266. });
  21267. }
  21268. /**
  21269. * The base implementation of `_.get` without support for default values.
  21270. *
  21271. * @private
  21272. * @param {Object} object The object to query.
  21273. * @param {Array|string} path The path of the property to get.
  21274. * @returns {*} Returns the resolved value.
  21275. */
  21276. function baseGet(object, path) {
  21277. path = castPath(path, object);
  21278. var index = 0,
  21279. length = path.length;
  21280. while (object != null && index < length) {
  21281. object = object[toKey(path[index++])];
  21282. }
  21283. return (index && index == length) ? object : undefined;
  21284. }
  21285. /**
  21286. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21287. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21288. * symbols of `object`.
  21289. *
  21290. * @private
  21291. * @param {Object} object The object to query.
  21292. * @param {Function} keysFunc The function to get the keys of `object`.
  21293. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21294. * @returns {Array} Returns the array of property names and symbols.
  21295. */
  21296. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21297. var result = keysFunc(object);
  21298. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21299. }
  21300. /**
  21301. * The base implementation of `getTag` without fallbacks for buggy environments.
  21302. *
  21303. * @private
  21304. * @param {*} value The value to query.
  21305. * @returns {string} Returns the `toStringTag`.
  21306. */
  21307. function baseGetTag(value) {
  21308. if (value == null) {
  21309. return value === undefined ? undefinedTag : nullTag;
  21310. }
  21311. return (symToStringTag && symToStringTag in Object(value))
  21312. ? getRawTag(value)
  21313. : objectToString(value);
  21314. }
  21315. /**
  21316. * The base implementation of `_.gt` which doesn't coerce arguments.
  21317. *
  21318. * @private
  21319. * @param {*} value The value to compare.
  21320. * @param {*} other The other value to compare.
  21321. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21322. * else `false`.
  21323. */
  21324. function baseGt(value, other) {
  21325. return value > other;
  21326. }
  21327. /**
  21328. * The base implementation of `_.has` without support for deep paths.
  21329. *
  21330. * @private
  21331. * @param {Object} [object] The object to query.
  21332. * @param {Array|string} key The key to check.
  21333. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21334. */
  21335. function baseHas(object, key) {
  21336. return object != null && hasOwnProperty.call(object, key);
  21337. }
  21338. /**
  21339. * The base implementation of `_.hasIn` without support for deep paths.
  21340. *
  21341. * @private
  21342. * @param {Object} [object] The object to query.
  21343. * @param {Array|string} key The key to check.
  21344. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21345. */
  21346. function baseHasIn(object, key) {
  21347. return object != null && key in Object(object);
  21348. }
  21349. /**
  21350. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21351. *
  21352. * @private
  21353. * @param {number} number The number to check.
  21354. * @param {number} start The start of the range.
  21355. * @param {number} end The end of the range.
  21356. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21357. */
  21358. function baseInRange(number, start, end) {
  21359. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21360. }
  21361. /**
  21362. * The base implementation of methods like `_.intersection`, without support
  21363. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21364. *
  21365. * @private
  21366. * @param {Array} arrays The arrays to inspect.
  21367. * @param {Function} [iteratee] The iteratee invoked per element.
  21368. * @param {Function} [comparator] The comparator invoked per element.
  21369. * @returns {Array} Returns the new array of shared values.
  21370. */
  21371. function baseIntersection(arrays, iteratee, comparator) {
  21372. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21373. length = arrays[0].length,
  21374. othLength = arrays.length,
  21375. othIndex = othLength,
  21376. caches = Array(othLength),
  21377. maxLength = Infinity,
  21378. result = [];
  21379. while (othIndex--) {
  21380. var array = arrays[othIndex];
  21381. if (othIndex && iteratee) {
  21382. array = arrayMap(array, baseUnary(iteratee));
  21383. }
  21384. maxLength = nativeMin(array.length, maxLength);
  21385. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21386. ? new SetCache(othIndex && array)
  21387. : undefined;
  21388. }
  21389. array = arrays[0];
  21390. var index = -1,
  21391. seen = caches[0];
  21392. outer:
  21393. while (++index < length && result.length < maxLength) {
  21394. var value = array[index],
  21395. computed = iteratee ? iteratee(value) : value;
  21396. value = (comparator || value !== 0) ? value : 0;
  21397. if (!(seen
  21398. ? cacheHas(seen, computed)
  21399. : includes(result, computed, comparator)
  21400. )) {
  21401. othIndex = othLength;
  21402. while (--othIndex) {
  21403. var cache = caches[othIndex];
  21404. if (!(cache
  21405. ? cacheHas(cache, computed)
  21406. : includes(arrays[othIndex], computed, comparator))
  21407. ) {
  21408. continue outer;
  21409. }
  21410. }
  21411. if (seen) {
  21412. seen.push(computed);
  21413. }
  21414. result.push(value);
  21415. }
  21416. }
  21417. return result;
  21418. }
  21419. /**
  21420. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21421. * `object` with values transformed by `iteratee` and set by `setter`.
  21422. *
  21423. * @private
  21424. * @param {Object} object The object to iterate over.
  21425. * @param {Function} setter The function to set `accumulator` values.
  21426. * @param {Function} iteratee The iteratee to transform values.
  21427. * @param {Object} accumulator The initial inverted object.
  21428. * @returns {Function} Returns `accumulator`.
  21429. */
  21430. function baseInverter(object, setter, iteratee, accumulator) {
  21431. baseForOwn(object, function(value, key, object) {
  21432. setter(accumulator, iteratee(value), key, object);
  21433. });
  21434. return accumulator;
  21435. }
  21436. /**
  21437. * The base implementation of `_.invoke` without support for individual
  21438. * method arguments.
  21439. *
  21440. * @private
  21441. * @param {Object} object The object to query.
  21442. * @param {Array|string} path The path of the method to invoke.
  21443. * @param {Array} args The arguments to invoke the method with.
  21444. * @returns {*} Returns the result of the invoked method.
  21445. */
  21446. function baseInvoke(object, path, args) {
  21447. path = castPath(path, object);
  21448. object = parent(object, path);
  21449. var func = object == null ? object : object[toKey(last(path))];
  21450. return func == null ? undefined : apply(func, object, args);
  21451. }
  21452. /**
  21453. * The base implementation of `_.isArguments`.
  21454. *
  21455. * @private
  21456. * @param {*} value The value to check.
  21457. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21458. */
  21459. function baseIsArguments(value) {
  21460. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21461. }
  21462. /**
  21463. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21464. *
  21465. * @private
  21466. * @param {*} value The value to check.
  21467. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21468. */
  21469. function baseIsArrayBuffer(value) {
  21470. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21471. }
  21472. /**
  21473. * The base implementation of `_.isDate` without Node.js optimizations.
  21474. *
  21475. * @private
  21476. * @param {*} value The value to check.
  21477. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21478. */
  21479. function baseIsDate(value) {
  21480. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21481. }
  21482. /**
  21483. * The base implementation of `_.isEqual` which supports partial comparisons
  21484. * and tracks traversed objects.
  21485. *
  21486. * @private
  21487. * @param {*} value The value to compare.
  21488. * @param {*} other The other value to compare.
  21489. * @param {boolean} bitmask The bitmask flags.
  21490. * 1 - Unordered comparison
  21491. * 2 - Partial comparison
  21492. * @param {Function} [customizer] The function to customize comparisons.
  21493. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21494. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21495. */
  21496. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21497. if (value === other) {
  21498. return true;
  21499. }
  21500. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21501. return value !== value && other !== other;
  21502. }
  21503. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21504. }
  21505. /**
  21506. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21507. * deep comparisons and tracks traversed objects enabling objects with circular
  21508. * references to be compared.
  21509. *
  21510. * @private
  21511. * @param {Object} object The object to compare.
  21512. * @param {Object} other The other object to compare.
  21513. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21514. * @param {Function} customizer The function to customize comparisons.
  21515. * @param {Function} equalFunc The function to determine equivalents of values.
  21516. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21517. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21518. */
  21519. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21520. var objIsArr = isArray(object),
  21521. othIsArr = isArray(other),
  21522. objTag = objIsArr ? arrayTag : getTag(object),
  21523. othTag = othIsArr ? arrayTag : getTag(other);
  21524. objTag = objTag == argsTag ? objectTag : objTag;
  21525. othTag = othTag == argsTag ? objectTag : othTag;
  21526. var objIsObj = objTag == objectTag,
  21527. othIsObj = othTag == objectTag,
  21528. isSameTag = objTag == othTag;
  21529. if (isSameTag && isBuffer(object)) {
  21530. if (!isBuffer(other)) {
  21531. return false;
  21532. }
  21533. objIsArr = true;
  21534. objIsObj = false;
  21535. }
  21536. if (isSameTag && !objIsObj) {
  21537. stack || (stack = new Stack);
  21538. return (objIsArr || isTypedArray(object))
  21539. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21540. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21541. }
  21542. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21543. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21544. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21545. if (objIsWrapped || othIsWrapped) {
  21546. var objUnwrapped = objIsWrapped ? object.value() : object,
  21547. othUnwrapped = othIsWrapped ? other.value() : other;
  21548. stack || (stack = new Stack);
  21549. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21550. }
  21551. }
  21552. if (!isSameTag) {
  21553. return false;
  21554. }
  21555. stack || (stack = new Stack);
  21556. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21557. }
  21558. /**
  21559. * The base implementation of `_.isMap` without Node.js optimizations.
  21560. *
  21561. * @private
  21562. * @param {*} value The value to check.
  21563. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21564. */
  21565. function baseIsMap(value) {
  21566. return isObjectLike(value) && getTag(value) == mapTag;
  21567. }
  21568. /**
  21569. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21570. *
  21571. * @private
  21572. * @param {Object} object The object to inspect.
  21573. * @param {Object} source The object of property values to match.
  21574. * @param {Array} matchData The property names, values, and compare flags to match.
  21575. * @param {Function} [customizer] The function to customize comparisons.
  21576. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21577. */
  21578. function baseIsMatch(object, source, matchData, customizer) {
  21579. var index = matchData.length,
  21580. length = index,
  21581. noCustomizer = !customizer;
  21582. if (object == null) {
  21583. return !length;
  21584. }
  21585. object = Object(object);
  21586. while (index--) {
  21587. var data = matchData[index];
  21588. if ((noCustomizer && data[2])
  21589. ? data[1] !== object[data[0]]
  21590. : !(data[0] in object)
  21591. ) {
  21592. return false;
  21593. }
  21594. }
  21595. while (++index < length) {
  21596. data = matchData[index];
  21597. var key = data[0],
  21598. objValue = object[key],
  21599. srcValue = data[1];
  21600. if (noCustomizer && data[2]) {
  21601. if (objValue === undefined && !(key in object)) {
  21602. return false;
  21603. }
  21604. } else {
  21605. var stack = new Stack;
  21606. if (customizer) {
  21607. var result = customizer(objValue, srcValue, key, object, source, stack);
  21608. }
  21609. if (!(result === undefined
  21610. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21611. : result
  21612. )) {
  21613. return false;
  21614. }
  21615. }
  21616. }
  21617. return true;
  21618. }
  21619. /**
  21620. * The base implementation of `_.isNative` without bad shim checks.
  21621. *
  21622. * @private
  21623. * @param {*} value The value to check.
  21624. * @returns {boolean} Returns `true` if `value` is a native function,
  21625. * else `false`.
  21626. */
  21627. function baseIsNative(value) {
  21628. if (!isObject(value) || isMasked(value)) {
  21629. return false;
  21630. }
  21631. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21632. return pattern.test(toSource(value));
  21633. }
  21634. /**
  21635. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21636. *
  21637. * @private
  21638. * @param {*} value The value to check.
  21639. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21640. */
  21641. function baseIsRegExp(value) {
  21642. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21643. }
  21644. /**
  21645. * The base implementation of `_.isSet` without Node.js optimizations.
  21646. *
  21647. * @private
  21648. * @param {*} value The value to check.
  21649. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21650. */
  21651. function baseIsSet(value) {
  21652. return isObjectLike(value) && getTag(value) == setTag;
  21653. }
  21654. /**
  21655. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21656. *
  21657. * @private
  21658. * @param {*} value The value to check.
  21659. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21660. */
  21661. function baseIsTypedArray(value) {
  21662. return isObjectLike(value) &&
  21663. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21664. }
  21665. /**
  21666. * The base implementation of `_.iteratee`.
  21667. *
  21668. * @private
  21669. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21670. * @returns {Function} Returns the iteratee.
  21671. */
  21672. function baseIteratee(value) {
  21673. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21674. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21675. if (typeof value == 'function') {
  21676. return value;
  21677. }
  21678. if (value == null) {
  21679. return identity;
  21680. }
  21681. if (typeof value == 'object') {
  21682. return isArray(value)
  21683. ? baseMatchesProperty(value[0], value[1])
  21684. : baseMatches(value);
  21685. }
  21686. return property(value);
  21687. }
  21688. /**
  21689. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21690. *
  21691. * @private
  21692. * @param {Object} object The object to query.
  21693. * @returns {Array} Returns the array of property names.
  21694. */
  21695. function baseKeys(object) {
  21696. if (!isPrototype(object)) {
  21697. return nativeKeys(object);
  21698. }
  21699. var result = [];
  21700. for (var key in Object(object)) {
  21701. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21702. result.push(key);
  21703. }
  21704. }
  21705. return result;
  21706. }
  21707. /**
  21708. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21709. *
  21710. * @private
  21711. * @param {Object} object The object to query.
  21712. * @returns {Array} Returns the array of property names.
  21713. */
  21714. function baseKeysIn(object) {
  21715. if (!isObject(object)) {
  21716. return nativeKeysIn(object);
  21717. }
  21718. var isProto = isPrototype(object),
  21719. result = [];
  21720. for (var key in object) {
  21721. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21722. result.push(key);
  21723. }
  21724. }
  21725. return result;
  21726. }
  21727. /**
  21728. * The base implementation of `_.lt` which doesn't coerce arguments.
  21729. *
  21730. * @private
  21731. * @param {*} value The value to compare.
  21732. * @param {*} other The other value to compare.
  21733. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21734. * else `false`.
  21735. */
  21736. function baseLt(value, other) {
  21737. return value < other;
  21738. }
  21739. /**
  21740. * The base implementation of `_.map` without support for iteratee shorthands.
  21741. *
  21742. * @private
  21743. * @param {Array|Object} collection The collection to iterate over.
  21744. * @param {Function} iteratee The function invoked per iteration.
  21745. * @returns {Array} Returns the new mapped array.
  21746. */
  21747. function baseMap(collection, iteratee) {
  21748. var index = -1,
  21749. result = isArrayLike(collection) ? Array(collection.length) : [];
  21750. baseEach(collection, function(value, key, collection) {
  21751. result[++index] = iteratee(value, key, collection);
  21752. });
  21753. return result;
  21754. }
  21755. /**
  21756. * The base implementation of `_.matches` which doesn't clone `source`.
  21757. *
  21758. * @private
  21759. * @param {Object} source The object of property values to match.
  21760. * @returns {Function} Returns the new spec function.
  21761. */
  21762. function baseMatches(source) {
  21763. var matchData = getMatchData(source);
  21764. if (matchData.length == 1 && matchData[0][2]) {
  21765. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21766. }
  21767. return function(object) {
  21768. return object === source || baseIsMatch(object, source, matchData);
  21769. };
  21770. }
  21771. /**
  21772. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21773. *
  21774. * @private
  21775. * @param {string} path The path of the property to get.
  21776. * @param {*} srcValue The value to match.
  21777. * @returns {Function} Returns the new spec function.
  21778. */
  21779. function baseMatchesProperty(path, srcValue) {
  21780. if (isKey(path) && isStrictComparable(srcValue)) {
  21781. return matchesStrictComparable(toKey(path), srcValue);
  21782. }
  21783. return function(object) {
  21784. var objValue = get(object, path);
  21785. return (objValue === undefined && objValue === srcValue)
  21786. ? hasIn(object, path)
  21787. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21788. };
  21789. }
  21790. /**
  21791. * The base implementation of `_.merge` without support for multiple sources.
  21792. *
  21793. * @private
  21794. * @param {Object} object The destination object.
  21795. * @param {Object} source The source object.
  21796. * @param {number} srcIndex The index of `source`.
  21797. * @param {Function} [customizer] The function to customize merged values.
  21798. * @param {Object} [stack] Tracks traversed source values and their merged
  21799. * counterparts.
  21800. */
  21801. function baseMerge(object, source, srcIndex, customizer, stack) {
  21802. if (object === source) {
  21803. return;
  21804. }
  21805. baseFor(source, function(srcValue, key) {
  21806. stack || (stack = new Stack);
  21807. if (isObject(srcValue)) {
  21808. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21809. }
  21810. else {
  21811. var newValue = customizer
  21812. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21813. : undefined;
  21814. if (newValue === undefined) {
  21815. newValue = srcValue;
  21816. }
  21817. assignMergeValue(object, key, newValue);
  21818. }
  21819. }, keysIn);
  21820. }
  21821. /**
  21822. * A specialized version of `baseMerge` for arrays and objects which performs
  21823. * deep merges and tracks traversed objects enabling objects with circular
  21824. * references to be merged.
  21825. *
  21826. * @private
  21827. * @param {Object} object The destination object.
  21828. * @param {Object} source The source object.
  21829. * @param {string} key The key of the value to merge.
  21830. * @param {number} srcIndex The index of `source`.
  21831. * @param {Function} mergeFunc The function to merge values.
  21832. * @param {Function} [customizer] The function to customize assigned values.
  21833. * @param {Object} [stack] Tracks traversed source values and their merged
  21834. * counterparts.
  21835. */
  21836. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21837. var objValue = safeGet(object, key),
  21838. srcValue = safeGet(source, key),
  21839. stacked = stack.get(srcValue);
  21840. if (stacked) {
  21841. assignMergeValue(object, key, stacked);
  21842. return;
  21843. }
  21844. var newValue = customizer
  21845. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21846. : undefined;
  21847. var isCommon = newValue === undefined;
  21848. if (isCommon) {
  21849. var isArr = isArray(srcValue),
  21850. isBuff = !isArr && isBuffer(srcValue),
  21851. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21852. newValue = srcValue;
  21853. if (isArr || isBuff || isTyped) {
  21854. if (isArray(objValue)) {
  21855. newValue = objValue;
  21856. }
  21857. else if (isArrayLikeObject(objValue)) {
  21858. newValue = copyArray(objValue);
  21859. }
  21860. else if (isBuff) {
  21861. isCommon = false;
  21862. newValue = cloneBuffer(srcValue, true);
  21863. }
  21864. else if (isTyped) {
  21865. isCommon = false;
  21866. newValue = cloneTypedArray(srcValue, true);
  21867. }
  21868. else {
  21869. newValue = [];
  21870. }
  21871. }
  21872. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21873. newValue = objValue;
  21874. if (isArguments(objValue)) {
  21875. newValue = toPlainObject(objValue);
  21876. }
  21877. else if (!isObject(objValue) || isFunction(objValue)) {
  21878. newValue = initCloneObject(srcValue);
  21879. }
  21880. }
  21881. else {
  21882. isCommon = false;
  21883. }
  21884. }
  21885. if (isCommon) {
  21886. // Recursively merge objects and arrays (susceptible to call stack limits).
  21887. stack.set(srcValue, newValue);
  21888. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21889. stack['delete'](srcValue);
  21890. }
  21891. assignMergeValue(object, key, newValue);
  21892. }
  21893. /**
  21894. * The base implementation of `_.nth` which doesn't coerce arguments.
  21895. *
  21896. * @private
  21897. * @param {Array} array The array to query.
  21898. * @param {number} n The index of the element to return.
  21899. * @returns {*} Returns the nth element of `array`.
  21900. */
  21901. function baseNth(array, n) {
  21902. var length = array.length;
  21903. if (!length) {
  21904. return;
  21905. }
  21906. n += n < 0 ? length : 0;
  21907. return isIndex(n, length) ? array[n] : undefined;
  21908. }
  21909. /**
  21910. * The base implementation of `_.orderBy` without param guards.
  21911. *
  21912. * @private
  21913. * @param {Array|Object} collection The collection to iterate over.
  21914. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21915. * @param {string[]} orders The sort orders of `iteratees`.
  21916. * @returns {Array} Returns the new sorted array.
  21917. */
  21918. function baseOrderBy(collection, iteratees, orders) {
  21919. var index = -1;
  21920. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21921. var result = baseMap(collection, function(value, key, collection) {
  21922. var criteria = arrayMap(iteratees, function(iteratee) {
  21923. return iteratee(value);
  21924. });
  21925. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21926. });
  21927. return baseSortBy(result, function(object, other) {
  21928. return compareMultiple(object, other, orders);
  21929. });
  21930. }
  21931. /**
  21932. * The base implementation of `_.pick` without support for individual
  21933. * property identifiers.
  21934. *
  21935. * @private
  21936. * @param {Object} object The source object.
  21937. * @param {string[]} paths The property paths to pick.
  21938. * @returns {Object} Returns the new object.
  21939. */
  21940. function basePick(object, paths) {
  21941. return basePickBy(object, paths, function(value, path) {
  21942. return hasIn(object, path);
  21943. });
  21944. }
  21945. /**
  21946. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21947. *
  21948. * @private
  21949. * @param {Object} object The source object.
  21950. * @param {string[]} paths The property paths to pick.
  21951. * @param {Function} predicate The function invoked per property.
  21952. * @returns {Object} Returns the new object.
  21953. */
  21954. function basePickBy(object, paths, predicate) {
  21955. var index = -1,
  21956. length = paths.length,
  21957. result = {};
  21958. while (++index < length) {
  21959. var path = paths[index],
  21960. value = baseGet(object, path);
  21961. if (predicate(value, path)) {
  21962. baseSet(result, castPath(path, object), value);
  21963. }
  21964. }
  21965. return result;
  21966. }
  21967. /**
  21968. * A specialized version of `baseProperty` which supports deep paths.
  21969. *
  21970. * @private
  21971. * @param {Array|string} path The path of the property to get.
  21972. * @returns {Function} Returns the new accessor function.
  21973. */
  21974. function basePropertyDeep(path) {
  21975. return function(object) {
  21976. return baseGet(object, path);
  21977. };
  21978. }
  21979. /**
  21980. * The base implementation of `_.pullAllBy` without support for iteratee
  21981. * shorthands.
  21982. *
  21983. * @private
  21984. * @param {Array} array The array to modify.
  21985. * @param {Array} values The values to remove.
  21986. * @param {Function} [iteratee] The iteratee invoked per element.
  21987. * @param {Function} [comparator] The comparator invoked per element.
  21988. * @returns {Array} Returns `array`.
  21989. */
  21990. function basePullAll(array, values, iteratee, comparator) {
  21991. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21992. index = -1,
  21993. length = values.length,
  21994. seen = array;
  21995. if (array === values) {
  21996. values = copyArray(values);
  21997. }
  21998. if (iteratee) {
  21999. seen = arrayMap(array, baseUnary(iteratee));
  22000. }
  22001. while (++index < length) {
  22002. var fromIndex = 0,
  22003. value = values[index],
  22004. computed = iteratee ? iteratee(value) : value;
  22005. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22006. if (seen !== array) {
  22007. splice.call(seen, fromIndex, 1);
  22008. }
  22009. splice.call(array, fromIndex, 1);
  22010. }
  22011. }
  22012. return array;
  22013. }
  22014. /**
  22015. * The base implementation of `_.pullAt` without support for individual
  22016. * indexes or capturing the removed elements.
  22017. *
  22018. * @private
  22019. * @param {Array} array The array to modify.
  22020. * @param {number[]} indexes The indexes of elements to remove.
  22021. * @returns {Array} Returns `array`.
  22022. */
  22023. function basePullAt(array, indexes) {
  22024. var length = array ? indexes.length : 0,
  22025. lastIndex = length - 1;
  22026. while (length--) {
  22027. var index = indexes[length];
  22028. if (length == lastIndex || index !== previous) {
  22029. var previous = index;
  22030. if (isIndex(index)) {
  22031. splice.call(array, index, 1);
  22032. } else {
  22033. baseUnset(array, index);
  22034. }
  22035. }
  22036. }
  22037. return array;
  22038. }
  22039. /**
  22040. * The base implementation of `_.random` without support for returning
  22041. * floating-point numbers.
  22042. *
  22043. * @private
  22044. * @param {number} lower The lower bound.
  22045. * @param {number} upper The upper bound.
  22046. * @returns {number} Returns the random number.
  22047. */
  22048. function baseRandom(lower, upper) {
  22049. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22050. }
  22051. /**
  22052. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22053. * coerce arguments.
  22054. *
  22055. * @private
  22056. * @param {number} start The start of the range.
  22057. * @param {number} end The end of the range.
  22058. * @param {number} step The value to increment or decrement by.
  22059. * @param {boolean} [fromRight] Specify iterating from right to left.
  22060. * @returns {Array} Returns the range of numbers.
  22061. */
  22062. function baseRange(start, end, step, fromRight) {
  22063. var index = -1,
  22064. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22065. result = Array(length);
  22066. while (length--) {
  22067. result[fromRight ? length : ++index] = start;
  22068. start += step;
  22069. }
  22070. return result;
  22071. }
  22072. /**
  22073. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22074. *
  22075. * @private
  22076. * @param {string} string The string to repeat.
  22077. * @param {number} n The number of times to repeat the string.
  22078. * @returns {string} Returns the repeated string.
  22079. */
  22080. function baseRepeat(string, n) {
  22081. var result = '';
  22082. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22083. return result;
  22084. }
  22085. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22086. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22087. do {
  22088. if (n % 2) {
  22089. result += string;
  22090. }
  22091. n = nativeFloor(n / 2);
  22092. if (n) {
  22093. string += string;
  22094. }
  22095. } while (n);
  22096. return result;
  22097. }
  22098. /**
  22099. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22100. *
  22101. * @private
  22102. * @param {Function} func The function to apply a rest parameter to.
  22103. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22104. * @returns {Function} Returns the new function.
  22105. */
  22106. function baseRest(func, start) {
  22107. return setToString(overRest(func, start, identity), func + '');
  22108. }
  22109. /**
  22110. * The base implementation of `_.sample`.
  22111. *
  22112. * @private
  22113. * @param {Array|Object} collection The collection to sample.
  22114. * @returns {*} Returns the random element.
  22115. */
  22116. function baseSample(collection) {
  22117. return arraySample(values(collection));
  22118. }
  22119. /**
  22120. * The base implementation of `_.sampleSize` without param guards.
  22121. *
  22122. * @private
  22123. * @param {Array|Object} collection The collection to sample.
  22124. * @param {number} n The number of elements to sample.
  22125. * @returns {Array} Returns the random elements.
  22126. */
  22127. function baseSampleSize(collection, n) {
  22128. var array = values(collection);
  22129. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22130. }
  22131. /**
  22132. * The base implementation of `_.set`.
  22133. *
  22134. * @private
  22135. * @param {Object} object The object to modify.
  22136. * @param {Array|string} path The path of the property to set.
  22137. * @param {*} value The value to set.
  22138. * @param {Function} [customizer] The function to customize path creation.
  22139. * @returns {Object} Returns `object`.
  22140. */
  22141. function baseSet(object, path, value, customizer) {
  22142. if (!isObject(object)) {
  22143. return object;
  22144. }
  22145. path = castPath(path, object);
  22146. var index = -1,
  22147. length = path.length,
  22148. lastIndex = length - 1,
  22149. nested = object;
  22150. while (nested != null && ++index < length) {
  22151. var key = toKey(path[index]),
  22152. newValue = value;
  22153. if (index != lastIndex) {
  22154. var objValue = nested[key];
  22155. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22156. if (newValue === undefined) {
  22157. newValue = isObject(objValue)
  22158. ? objValue
  22159. : (isIndex(path[index + 1]) ? [] : {});
  22160. }
  22161. }
  22162. assignValue(nested, key, newValue);
  22163. nested = nested[key];
  22164. }
  22165. return object;
  22166. }
  22167. /**
  22168. * The base implementation of `setData` without support for hot loop shorting.
  22169. *
  22170. * @private
  22171. * @param {Function} func The function to associate metadata with.
  22172. * @param {*} data The metadata.
  22173. * @returns {Function} Returns `func`.
  22174. */
  22175. var baseSetData = !metaMap ? identity : function(func, data) {
  22176. metaMap.set(func, data);
  22177. return func;
  22178. };
  22179. /**
  22180. * The base implementation of `setToString` without support for hot loop shorting.
  22181. *
  22182. * @private
  22183. * @param {Function} func The function to modify.
  22184. * @param {Function} string The `toString` result.
  22185. * @returns {Function} Returns `func`.
  22186. */
  22187. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22188. return defineProperty(func, 'toString', {
  22189. 'configurable': true,
  22190. 'enumerable': false,
  22191. 'value': constant(string),
  22192. 'writable': true
  22193. });
  22194. };
  22195. /**
  22196. * The base implementation of `_.shuffle`.
  22197. *
  22198. * @private
  22199. * @param {Array|Object} collection The collection to shuffle.
  22200. * @returns {Array} Returns the new shuffled array.
  22201. */
  22202. function baseShuffle(collection) {
  22203. return shuffleSelf(values(collection));
  22204. }
  22205. /**
  22206. * The base implementation of `_.slice` without an iteratee call guard.
  22207. *
  22208. * @private
  22209. * @param {Array} array The array to slice.
  22210. * @param {number} [start=0] The start position.
  22211. * @param {number} [end=array.length] The end position.
  22212. * @returns {Array} Returns the slice of `array`.
  22213. */
  22214. function baseSlice(array, start, end) {
  22215. var index = -1,
  22216. length = array.length;
  22217. if (start < 0) {
  22218. start = -start > length ? 0 : (length + start);
  22219. }
  22220. end = end > length ? length : end;
  22221. if (end < 0) {
  22222. end += length;
  22223. }
  22224. length = start > end ? 0 : ((end - start) >>> 0);
  22225. start >>>= 0;
  22226. var result = Array(length);
  22227. while (++index < length) {
  22228. result[index] = array[index + start];
  22229. }
  22230. return result;
  22231. }
  22232. /**
  22233. * The base implementation of `_.some` without support for iteratee shorthands.
  22234. *
  22235. * @private
  22236. * @param {Array|Object} collection The collection to iterate over.
  22237. * @param {Function} predicate The function invoked per iteration.
  22238. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22239. * else `false`.
  22240. */
  22241. function baseSome(collection, predicate) {
  22242. var result;
  22243. baseEach(collection, function(value, index, collection) {
  22244. result = predicate(value, index, collection);
  22245. return !result;
  22246. });
  22247. return !!result;
  22248. }
  22249. /**
  22250. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22251. * performs a binary search of `array` to determine the index at which `value`
  22252. * should be inserted into `array` in order to maintain its sort order.
  22253. *
  22254. * @private
  22255. * @param {Array} array The sorted array to inspect.
  22256. * @param {*} value The value to evaluate.
  22257. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22258. * @returns {number} Returns the index at which `value` should be inserted
  22259. * into `array`.
  22260. */
  22261. function baseSortedIndex(array, value, retHighest) {
  22262. var low = 0,
  22263. high = array == null ? low : array.length;
  22264. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22265. while (low < high) {
  22266. var mid = (low + high) >>> 1,
  22267. computed = array[mid];
  22268. if (computed !== null && !isSymbol(computed) &&
  22269. (retHighest ? (computed <= value) : (computed < value))) {
  22270. low = mid + 1;
  22271. } else {
  22272. high = mid;
  22273. }
  22274. }
  22275. return high;
  22276. }
  22277. return baseSortedIndexBy(array, value, identity, retHighest);
  22278. }
  22279. /**
  22280. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22281. * which invokes `iteratee` for `value` and each element of `array` to compute
  22282. * their sort ranking. The iteratee is invoked with one argument; (value).
  22283. *
  22284. * @private
  22285. * @param {Array} array The sorted array to inspect.
  22286. * @param {*} value The value to evaluate.
  22287. * @param {Function} iteratee The iteratee invoked per element.
  22288. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22289. * @returns {number} Returns the index at which `value` should be inserted
  22290. * into `array`.
  22291. */
  22292. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22293. value = iteratee(value);
  22294. var low = 0,
  22295. high = array == null ? 0 : array.length,
  22296. valIsNaN = value !== value,
  22297. valIsNull = value === null,
  22298. valIsSymbol = isSymbol(value),
  22299. valIsUndefined = value === undefined;
  22300. while (low < high) {
  22301. var mid = nativeFloor((low + high) / 2),
  22302. computed = iteratee(array[mid]),
  22303. othIsDefined = computed !== undefined,
  22304. othIsNull = computed === null,
  22305. othIsReflexive = computed === computed,
  22306. othIsSymbol = isSymbol(computed);
  22307. if (valIsNaN) {
  22308. var setLow = retHighest || othIsReflexive;
  22309. } else if (valIsUndefined) {
  22310. setLow = othIsReflexive && (retHighest || othIsDefined);
  22311. } else if (valIsNull) {
  22312. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22313. } else if (valIsSymbol) {
  22314. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22315. } else if (othIsNull || othIsSymbol) {
  22316. setLow = false;
  22317. } else {
  22318. setLow = retHighest ? (computed <= value) : (computed < value);
  22319. }
  22320. if (setLow) {
  22321. low = mid + 1;
  22322. } else {
  22323. high = mid;
  22324. }
  22325. }
  22326. return nativeMin(high, MAX_ARRAY_INDEX);
  22327. }
  22328. /**
  22329. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22330. * support for iteratee shorthands.
  22331. *
  22332. * @private
  22333. * @param {Array} array The array to inspect.
  22334. * @param {Function} [iteratee] The iteratee invoked per element.
  22335. * @returns {Array} Returns the new duplicate free array.
  22336. */
  22337. function baseSortedUniq(array, iteratee) {
  22338. var index = -1,
  22339. length = array.length,
  22340. resIndex = 0,
  22341. result = [];
  22342. while (++index < length) {
  22343. var value = array[index],
  22344. computed = iteratee ? iteratee(value) : value;
  22345. if (!index || !eq(computed, seen)) {
  22346. var seen = computed;
  22347. result[resIndex++] = value === 0 ? 0 : value;
  22348. }
  22349. }
  22350. return result;
  22351. }
  22352. /**
  22353. * The base implementation of `_.toNumber` which doesn't ensure correct
  22354. * conversions of binary, hexadecimal, or octal string values.
  22355. *
  22356. * @private
  22357. * @param {*} value The value to process.
  22358. * @returns {number} Returns the number.
  22359. */
  22360. function baseToNumber(value) {
  22361. if (typeof value == 'number') {
  22362. return value;
  22363. }
  22364. if (isSymbol(value)) {
  22365. return NAN;
  22366. }
  22367. return +value;
  22368. }
  22369. /**
  22370. * The base implementation of `_.toString` which doesn't convert nullish
  22371. * values to empty strings.
  22372. *
  22373. * @private
  22374. * @param {*} value The value to process.
  22375. * @returns {string} Returns the string.
  22376. */
  22377. function baseToString(value) {
  22378. // Exit early for strings to avoid a performance hit in some environments.
  22379. if (typeof value == 'string') {
  22380. return value;
  22381. }
  22382. if (isArray(value)) {
  22383. // Recursively convert values (susceptible to call stack limits).
  22384. return arrayMap(value, baseToString) + '';
  22385. }
  22386. if (isSymbol(value)) {
  22387. return symbolToString ? symbolToString.call(value) : '';
  22388. }
  22389. var result = (value + '');
  22390. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22391. }
  22392. /**
  22393. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22394. *
  22395. * @private
  22396. * @param {Array} array The array to inspect.
  22397. * @param {Function} [iteratee] The iteratee invoked per element.
  22398. * @param {Function} [comparator] The comparator invoked per element.
  22399. * @returns {Array} Returns the new duplicate free array.
  22400. */
  22401. function baseUniq(array, iteratee, comparator) {
  22402. var index = -1,
  22403. includes = arrayIncludes,
  22404. length = array.length,
  22405. isCommon = true,
  22406. result = [],
  22407. seen = result;
  22408. if (comparator) {
  22409. isCommon = false;
  22410. includes = arrayIncludesWith;
  22411. }
  22412. else if (length >= LARGE_ARRAY_SIZE) {
  22413. var set = iteratee ? null : createSet(array);
  22414. if (set) {
  22415. return setToArray(set);
  22416. }
  22417. isCommon = false;
  22418. includes = cacheHas;
  22419. seen = new SetCache;
  22420. }
  22421. else {
  22422. seen = iteratee ? [] : result;
  22423. }
  22424. outer:
  22425. while (++index < length) {
  22426. var value = array[index],
  22427. computed = iteratee ? iteratee(value) : value;
  22428. value = (comparator || value !== 0) ? value : 0;
  22429. if (isCommon && computed === computed) {
  22430. var seenIndex = seen.length;
  22431. while (seenIndex--) {
  22432. if (seen[seenIndex] === computed) {
  22433. continue outer;
  22434. }
  22435. }
  22436. if (iteratee) {
  22437. seen.push(computed);
  22438. }
  22439. result.push(value);
  22440. }
  22441. else if (!includes(seen, computed, comparator)) {
  22442. if (seen !== result) {
  22443. seen.push(computed);
  22444. }
  22445. result.push(value);
  22446. }
  22447. }
  22448. return result;
  22449. }
  22450. /**
  22451. * The base implementation of `_.unset`.
  22452. *
  22453. * @private
  22454. * @param {Object} object The object to modify.
  22455. * @param {Array|string} path The property path to unset.
  22456. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22457. */
  22458. function baseUnset(object, path) {
  22459. path = castPath(path, object);
  22460. object = parent(object, path);
  22461. return object == null || delete object[toKey(last(path))];
  22462. }
  22463. /**
  22464. * The base implementation of `_.update`.
  22465. *
  22466. * @private
  22467. * @param {Object} object The object to modify.
  22468. * @param {Array|string} path The path of the property to update.
  22469. * @param {Function} updater The function to produce the updated value.
  22470. * @param {Function} [customizer] The function to customize path creation.
  22471. * @returns {Object} Returns `object`.
  22472. */
  22473. function baseUpdate(object, path, updater, customizer) {
  22474. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22475. }
  22476. /**
  22477. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22478. * without support for iteratee shorthands.
  22479. *
  22480. * @private
  22481. * @param {Array} array The array to query.
  22482. * @param {Function} predicate The function invoked per iteration.
  22483. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22484. * @param {boolean} [fromRight] Specify iterating from right to left.
  22485. * @returns {Array} Returns the slice of `array`.
  22486. */
  22487. function baseWhile(array, predicate, isDrop, fromRight) {
  22488. var length = array.length,
  22489. index = fromRight ? length : -1;
  22490. while ((fromRight ? index-- : ++index < length) &&
  22491. predicate(array[index], index, array)) {}
  22492. return isDrop
  22493. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22494. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22495. }
  22496. /**
  22497. * The base implementation of `wrapperValue` which returns the result of
  22498. * performing a sequence of actions on the unwrapped `value`, where each
  22499. * successive action is supplied the return value of the previous.
  22500. *
  22501. * @private
  22502. * @param {*} value The unwrapped value.
  22503. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22504. * @returns {*} Returns the resolved value.
  22505. */
  22506. function baseWrapperValue(value, actions) {
  22507. var result = value;
  22508. if (result instanceof LazyWrapper) {
  22509. result = result.value();
  22510. }
  22511. return arrayReduce(actions, function(result, action) {
  22512. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22513. }, result);
  22514. }
  22515. /**
  22516. * The base implementation of methods like `_.xor`, without support for
  22517. * iteratee shorthands, that accepts an array of arrays to inspect.
  22518. *
  22519. * @private
  22520. * @param {Array} arrays The arrays to inspect.
  22521. * @param {Function} [iteratee] The iteratee invoked per element.
  22522. * @param {Function} [comparator] The comparator invoked per element.
  22523. * @returns {Array} Returns the new array of values.
  22524. */
  22525. function baseXor(arrays, iteratee, comparator) {
  22526. var length = arrays.length;
  22527. if (length < 2) {
  22528. return length ? baseUniq(arrays[0]) : [];
  22529. }
  22530. var index = -1,
  22531. result = Array(length);
  22532. while (++index < length) {
  22533. var array = arrays[index],
  22534. othIndex = -1;
  22535. while (++othIndex < length) {
  22536. if (othIndex != index) {
  22537. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22538. }
  22539. }
  22540. }
  22541. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22542. }
  22543. /**
  22544. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22545. *
  22546. * @private
  22547. * @param {Array} props The property identifiers.
  22548. * @param {Array} values The property values.
  22549. * @param {Function} assignFunc The function to assign values.
  22550. * @returns {Object} Returns the new object.
  22551. */
  22552. function baseZipObject(props, values, assignFunc) {
  22553. var index = -1,
  22554. length = props.length,
  22555. valsLength = values.length,
  22556. result = {};
  22557. while (++index < length) {
  22558. var value = index < valsLength ? values[index] : undefined;
  22559. assignFunc(result, props[index], value);
  22560. }
  22561. return result;
  22562. }
  22563. /**
  22564. * Casts `value` to an empty array if it's not an array like object.
  22565. *
  22566. * @private
  22567. * @param {*} value The value to inspect.
  22568. * @returns {Array|Object} Returns the cast array-like object.
  22569. */
  22570. function castArrayLikeObject(value) {
  22571. return isArrayLikeObject(value) ? value : [];
  22572. }
  22573. /**
  22574. * Casts `value` to `identity` if it's not a function.
  22575. *
  22576. * @private
  22577. * @param {*} value The value to inspect.
  22578. * @returns {Function} Returns cast function.
  22579. */
  22580. function castFunction(value) {
  22581. return typeof value == 'function' ? value : identity;
  22582. }
  22583. /**
  22584. * Casts `value` to a path array if it's not one.
  22585. *
  22586. * @private
  22587. * @param {*} value The value to inspect.
  22588. * @param {Object} [object] The object to query keys on.
  22589. * @returns {Array} Returns the cast property path array.
  22590. */
  22591. function castPath(value, object) {
  22592. if (isArray(value)) {
  22593. return value;
  22594. }
  22595. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22596. }
  22597. /**
  22598. * A `baseRest` alias which can be replaced with `identity` by module
  22599. * replacement plugins.
  22600. *
  22601. * @private
  22602. * @type {Function}
  22603. * @param {Function} func The function to apply a rest parameter to.
  22604. * @returns {Function} Returns the new function.
  22605. */
  22606. var castRest = baseRest;
  22607. /**
  22608. * Casts `array` to a slice if it's needed.
  22609. *
  22610. * @private
  22611. * @param {Array} array The array to inspect.
  22612. * @param {number} start The start position.
  22613. * @param {number} [end=array.length] The end position.
  22614. * @returns {Array} Returns the cast slice.
  22615. */
  22616. function castSlice(array, start, end) {
  22617. var length = array.length;
  22618. end = end === undefined ? length : end;
  22619. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22620. }
  22621. /**
  22622. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22623. *
  22624. * @private
  22625. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22626. */
  22627. var clearTimeout = ctxClearTimeout || function(id) {
  22628. return root.clearTimeout(id);
  22629. };
  22630. /**
  22631. * Creates a clone of `buffer`.
  22632. *
  22633. * @private
  22634. * @param {Buffer} buffer The buffer to clone.
  22635. * @param {boolean} [isDeep] Specify a deep clone.
  22636. * @returns {Buffer} Returns the cloned buffer.
  22637. */
  22638. function cloneBuffer(buffer, isDeep) {
  22639. if (isDeep) {
  22640. return buffer.slice();
  22641. }
  22642. var length = buffer.length,
  22643. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22644. buffer.copy(result);
  22645. return result;
  22646. }
  22647. /**
  22648. * Creates a clone of `arrayBuffer`.
  22649. *
  22650. * @private
  22651. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22652. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22653. */
  22654. function cloneArrayBuffer(arrayBuffer) {
  22655. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22656. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22657. return result;
  22658. }
  22659. /**
  22660. * Creates a clone of `dataView`.
  22661. *
  22662. * @private
  22663. * @param {Object} dataView The data view to clone.
  22664. * @param {boolean} [isDeep] Specify a deep clone.
  22665. * @returns {Object} Returns the cloned data view.
  22666. */
  22667. function cloneDataView(dataView, isDeep) {
  22668. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22669. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22670. }
  22671. /**
  22672. * Creates a clone of `regexp`.
  22673. *
  22674. * @private
  22675. * @param {Object} regexp The regexp to clone.
  22676. * @returns {Object} Returns the cloned regexp.
  22677. */
  22678. function cloneRegExp(regexp) {
  22679. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22680. result.lastIndex = regexp.lastIndex;
  22681. return result;
  22682. }
  22683. /**
  22684. * Creates a clone of the `symbol` object.
  22685. *
  22686. * @private
  22687. * @param {Object} symbol The symbol object to clone.
  22688. * @returns {Object} Returns the cloned symbol object.
  22689. */
  22690. function cloneSymbol(symbol) {
  22691. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22692. }
  22693. /**
  22694. * Creates a clone of `typedArray`.
  22695. *
  22696. * @private
  22697. * @param {Object} typedArray The typed array to clone.
  22698. * @param {boolean} [isDeep] Specify a deep clone.
  22699. * @returns {Object} Returns the cloned typed array.
  22700. */
  22701. function cloneTypedArray(typedArray, isDeep) {
  22702. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22703. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22704. }
  22705. /**
  22706. * Compares values to sort them in ascending order.
  22707. *
  22708. * @private
  22709. * @param {*} value The value to compare.
  22710. * @param {*} other The other value to compare.
  22711. * @returns {number} Returns the sort order indicator for `value`.
  22712. */
  22713. function compareAscending(value, other) {
  22714. if (value !== other) {
  22715. var valIsDefined = value !== undefined,
  22716. valIsNull = value === null,
  22717. valIsReflexive = value === value,
  22718. valIsSymbol = isSymbol(value);
  22719. var othIsDefined = other !== undefined,
  22720. othIsNull = other === null,
  22721. othIsReflexive = other === other,
  22722. othIsSymbol = isSymbol(other);
  22723. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22724. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22725. (valIsNull && othIsDefined && othIsReflexive) ||
  22726. (!valIsDefined && othIsReflexive) ||
  22727. !valIsReflexive) {
  22728. return 1;
  22729. }
  22730. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22731. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22732. (othIsNull && valIsDefined && valIsReflexive) ||
  22733. (!othIsDefined && valIsReflexive) ||
  22734. !othIsReflexive) {
  22735. return -1;
  22736. }
  22737. }
  22738. return 0;
  22739. }
  22740. /**
  22741. * Used by `_.orderBy` to compare multiple properties of a value to another
  22742. * and stable sort them.
  22743. *
  22744. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22745. * specify an order of "desc" for descending or "asc" for ascending sort order
  22746. * of corresponding values.
  22747. *
  22748. * @private
  22749. * @param {Object} object The object to compare.
  22750. * @param {Object} other The other object to compare.
  22751. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22752. * @returns {number} Returns the sort order indicator for `object`.
  22753. */
  22754. function compareMultiple(object, other, orders) {
  22755. var index = -1,
  22756. objCriteria = object.criteria,
  22757. othCriteria = other.criteria,
  22758. length = objCriteria.length,
  22759. ordersLength = orders.length;
  22760. while (++index < length) {
  22761. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22762. if (result) {
  22763. if (index >= ordersLength) {
  22764. return result;
  22765. }
  22766. var order = orders[index];
  22767. return result * (order == 'desc' ? -1 : 1);
  22768. }
  22769. }
  22770. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22771. // that causes it, under certain circumstances, to provide the same value for
  22772. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22773. // for more details.
  22774. //
  22775. // This also ensures a stable sort in V8 and other engines.
  22776. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22777. return object.index - other.index;
  22778. }
  22779. /**
  22780. * Creates an array that is the composition of partially applied arguments,
  22781. * placeholders, and provided arguments into a single array of arguments.
  22782. *
  22783. * @private
  22784. * @param {Array} args The provided arguments.
  22785. * @param {Array} partials The arguments to prepend to those provided.
  22786. * @param {Array} holders The `partials` placeholder indexes.
  22787. * @params {boolean} [isCurried] Specify composing for a curried function.
  22788. * @returns {Array} Returns the new array of composed arguments.
  22789. */
  22790. function composeArgs(args, partials, holders, isCurried) {
  22791. var argsIndex = -1,
  22792. argsLength = args.length,
  22793. holdersLength = holders.length,
  22794. leftIndex = -1,
  22795. leftLength = partials.length,
  22796. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22797. result = Array(leftLength + rangeLength),
  22798. isUncurried = !isCurried;
  22799. while (++leftIndex < leftLength) {
  22800. result[leftIndex] = partials[leftIndex];
  22801. }
  22802. while (++argsIndex < holdersLength) {
  22803. if (isUncurried || argsIndex < argsLength) {
  22804. result[holders[argsIndex]] = args[argsIndex];
  22805. }
  22806. }
  22807. while (rangeLength--) {
  22808. result[leftIndex++] = args[argsIndex++];
  22809. }
  22810. return result;
  22811. }
  22812. /**
  22813. * This function is like `composeArgs` except that the arguments composition
  22814. * is tailored for `_.partialRight`.
  22815. *
  22816. * @private
  22817. * @param {Array} args The provided arguments.
  22818. * @param {Array} partials The arguments to append to those provided.
  22819. * @param {Array} holders The `partials` placeholder indexes.
  22820. * @params {boolean} [isCurried] Specify composing for a curried function.
  22821. * @returns {Array} Returns the new array of composed arguments.
  22822. */
  22823. function composeArgsRight(args, partials, holders, isCurried) {
  22824. var argsIndex = -1,
  22825. argsLength = args.length,
  22826. holdersIndex = -1,
  22827. holdersLength = holders.length,
  22828. rightIndex = -1,
  22829. rightLength = partials.length,
  22830. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22831. result = Array(rangeLength + rightLength),
  22832. isUncurried = !isCurried;
  22833. while (++argsIndex < rangeLength) {
  22834. result[argsIndex] = args[argsIndex];
  22835. }
  22836. var offset = argsIndex;
  22837. while (++rightIndex < rightLength) {
  22838. result[offset + rightIndex] = partials[rightIndex];
  22839. }
  22840. while (++holdersIndex < holdersLength) {
  22841. if (isUncurried || argsIndex < argsLength) {
  22842. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22843. }
  22844. }
  22845. return result;
  22846. }
  22847. /**
  22848. * Copies the values of `source` to `array`.
  22849. *
  22850. * @private
  22851. * @param {Array} source The array to copy values from.
  22852. * @param {Array} [array=[]] The array to copy values to.
  22853. * @returns {Array} Returns `array`.
  22854. */
  22855. function copyArray(source, array) {
  22856. var index = -1,
  22857. length = source.length;
  22858. array || (array = Array(length));
  22859. while (++index < length) {
  22860. array[index] = source[index];
  22861. }
  22862. return array;
  22863. }
  22864. /**
  22865. * Copies properties of `source` to `object`.
  22866. *
  22867. * @private
  22868. * @param {Object} source The object to copy properties from.
  22869. * @param {Array} props The property identifiers to copy.
  22870. * @param {Object} [object={}] The object to copy properties to.
  22871. * @param {Function} [customizer] The function to customize copied values.
  22872. * @returns {Object} Returns `object`.
  22873. */
  22874. function copyObject(source, props, object, customizer) {
  22875. var isNew = !object;
  22876. object || (object = {});
  22877. var index = -1,
  22878. length = props.length;
  22879. while (++index < length) {
  22880. var key = props[index];
  22881. var newValue = customizer
  22882. ? customizer(object[key], source[key], key, object, source)
  22883. : undefined;
  22884. if (newValue === undefined) {
  22885. newValue = source[key];
  22886. }
  22887. if (isNew) {
  22888. baseAssignValue(object, key, newValue);
  22889. } else {
  22890. assignValue(object, key, newValue);
  22891. }
  22892. }
  22893. return object;
  22894. }
  22895. /**
  22896. * Copies own symbols of `source` to `object`.
  22897. *
  22898. * @private
  22899. * @param {Object} source The object to copy symbols from.
  22900. * @param {Object} [object={}] The object to copy symbols to.
  22901. * @returns {Object} Returns `object`.
  22902. */
  22903. function copySymbols(source, object) {
  22904. return copyObject(source, getSymbols(source), object);
  22905. }
  22906. /**
  22907. * Copies own and inherited symbols of `source` to `object`.
  22908. *
  22909. * @private
  22910. * @param {Object} source The object to copy symbols from.
  22911. * @param {Object} [object={}] The object to copy symbols to.
  22912. * @returns {Object} Returns `object`.
  22913. */
  22914. function copySymbolsIn(source, object) {
  22915. return copyObject(source, getSymbolsIn(source), object);
  22916. }
  22917. /**
  22918. * Creates a function like `_.groupBy`.
  22919. *
  22920. * @private
  22921. * @param {Function} setter The function to set accumulator values.
  22922. * @param {Function} [initializer] The accumulator object initializer.
  22923. * @returns {Function} Returns the new aggregator function.
  22924. */
  22925. function createAggregator(setter, initializer) {
  22926. return function(collection, iteratee) {
  22927. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22928. accumulator = initializer ? initializer() : {};
  22929. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22930. };
  22931. }
  22932. /**
  22933. * Creates a function like `_.assign`.
  22934. *
  22935. * @private
  22936. * @param {Function} assigner The function to assign values.
  22937. * @returns {Function} Returns the new assigner function.
  22938. */
  22939. function createAssigner(assigner) {
  22940. return baseRest(function(object, sources) {
  22941. var index = -1,
  22942. length = sources.length,
  22943. customizer = length > 1 ? sources[length - 1] : undefined,
  22944. guard = length > 2 ? sources[2] : undefined;
  22945. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22946. ? (length--, customizer)
  22947. : undefined;
  22948. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22949. customizer = length < 3 ? undefined : customizer;
  22950. length = 1;
  22951. }
  22952. object = Object(object);
  22953. while (++index < length) {
  22954. var source = sources[index];
  22955. if (source) {
  22956. assigner(object, source, index, customizer);
  22957. }
  22958. }
  22959. return object;
  22960. });
  22961. }
  22962. /**
  22963. * Creates a `baseEach` or `baseEachRight` function.
  22964. *
  22965. * @private
  22966. * @param {Function} eachFunc The function to iterate over a collection.
  22967. * @param {boolean} [fromRight] Specify iterating from right to left.
  22968. * @returns {Function} Returns the new base function.
  22969. */
  22970. function createBaseEach(eachFunc, fromRight) {
  22971. return function(collection, iteratee) {
  22972. if (collection == null) {
  22973. return collection;
  22974. }
  22975. if (!isArrayLike(collection)) {
  22976. return eachFunc(collection, iteratee);
  22977. }
  22978. var length = collection.length,
  22979. index = fromRight ? length : -1,
  22980. iterable = Object(collection);
  22981. while ((fromRight ? index-- : ++index < length)) {
  22982. if (iteratee(iterable[index], index, iterable) === false) {
  22983. break;
  22984. }
  22985. }
  22986. return collection;
  22987. };
  22988. }
  22989. /**
  22990. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22991. *
  22992. * @private
  22993. * @param {boolean} [fromRight] Specify iterating from right to left.
  22994. * @returns {Function} Returns the new base function.
  22995. */
  22996. function createBaseFor(fromRight) {
  22997. return function(object, iteratee, keysFunc) {
  22998. var index = -1,
  22999. iterable = Object(object),
  23000. props = keysFunc(object),
  23001. length = props.length;
  23002. while (length--) {
  23003. var key = props[fromRight ? length : ++index];
  23004. if (iteratee(iterable[key], key, iterable) === false) {
  23005. break;
  23006. }
  23007. }
  23008. return object;
  23009. };
  23010. }
  23011. /**
  23012. * Creates a function that wraps `func` to invoke it with the optional `this`
  23013. * binding of `thisArg`.
  23014. *
  23015. * @private
  23016. * @param {Function} func The function to wrap.
  23017. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23018. * @param {*} [thisArg] The `this` binding of `func`.
  23019. * @returns {Function} Returns the new wrapped function.
  23020. */
  23021. function createBind(func, bitmask, thisArg) {
  23022. var isBind = bitmask & WRAP_BIND_FLAG,
  23023. Ctor = createCtor(func);
  23024. function wrapper() {
  23025. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23026. return fn.apply(isBind ? thisArg : this, arguments);
  23027. }
  23028. return wrapper;
  23029. }
  23030. /**
  23031. * Creates a function like `_.lowerFirst`.
  23032. *
  23033. * @private
  23034. * @param {string} methodName The name of the `String` case method to use.
  23035. * @returns {Function} Returns the new case function.
  23036. */
  23037. function createCaseFirst(methodName) {
  23038. return function(string) {
  23039. string = toString(string);
  23040. var strSymbols = hasUnicode(string)
  23041. ? stringToArray(string)
  23042. : undefined;
  23043. var chr = strSymbols
  23044. ? strSymbols[0]
  23045. : string.charAt(0);
  23046. var trailing = strSymbols
  23047. ? castSlice(strSymbols, 1).join('')
  23048. : string.slice(1);
  23049. return chr[methodName]() + trailing;
  23050. };
  23051. }
  23052. /**
  23053. * Creates a function like `_.camelCase`.
  23054. *
  23055. * @private
  23056. * @param {Function} callback The function to combine each word.
  23057. * @returns {Function} Returns the new compounder function.
  23058. */
  23059. function createCompounder(callback) {
  23060. return function(string) {
  23061. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23062. };
  23063. }
  23064. /**
  23065. * Creates a function that produces an instance of `Ctor` regardless of
  23066. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23067. *
  23068. * @private
  23069. * @param {Function} Ctor The constructor to wrap.
  23070. * @returns {Function} Returns the new wrapped function.
  23071. */
  23072. function createCtor(Ctor) {
  23073. return function() {
  23074. // Use a `switch` statement to work with class constructors. See
  23075. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23076. // for more details.
  23077. var args = arguments;
  23078. switch (args.length) {
  23079. case 0: return new Ctor;
  23080. case 1: return new Ctor(args[0]);
  23081. case 2: return new Ctor(args[0], args[1]);
  23082. case 3: return new Ctor(args[0], args[1], args[2]);
  23083. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23084. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23085. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23086. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23087. }
  23088. var thisBinding = baseCreate(Ctor.prototype),
  23089. result = Ctor.apply(thisBinding, args);
  23090. // Mimic the constructor's `return` behavior.
  23091. // See https://es5.github.io/#x13.2.2 for more details.
  23092. return isObject(result) ? result : thisBinding;
  23093. };
  23094. }
  23095. /**
  23096. * Creates a function that wraps `func` to enable currying.
  23097. *
  23098. * @private
  23099. * @param {Function} func The function to wrap.
  23100. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23101. * @param {number} arity The arity of `func`.
  23102. * @returns {Function} Returns the new wrapped function.
  23103. */
  23104. function createCurry(func, bitmask, arity) {
  23105. var Ctor = createCtor(func);
  23106. function wrapper() {
  23107. var length = arguments.length,
  23108. args = Array(length),
  23109. index = length,
  23110. placeholder = getHolder(wrapper);
  23111. while (index--) {
  23112. args[index] = arguments[index];
  23113. }
  23114. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23115. ? []
  23116. : replaceHolders(args, placeholder);
  23117. length -= holders.length;
  23118. if (length < arity) {
  23119. return createRecurry(
  23120. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23121. args, holders, undefined, undefined, arity - length);
  23122. }
  23123. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23124. return apply(fn, this, args);
  23125. }
  23126. return wrapper;
  23127. }
  23128. /**
  23129. * Creates a `_.find` or `_.findLast` function.
  23130. *
  23131. * @private
  23132. * @param {Function} findIndexFunc The function to find the collection index.
  23133. * @returns {Function} Returns the new find function.
  23134. */
  23135. function createFind(findIndexFunc) {
  23136. return function(collection, predicate, fromIndex) {
  23137. var iterable = Object(collection);
  23138. if (!isArrayLike(collection)) {
  23139. var iteratee = getIteratee(predicate, 3);
  23140. collection = keys(collection);
  23141. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23142. }
  23143. var index = findIndexFunc(collection, predicate, fromIndex);
  23144. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23145. };
  23146. }
  23147. /**
  23148. * Creates a `_.flow` or `_.flowRight` function.
  23149. *
  23150. * @private
  23151. * @param {boolean} [fromRight] Specify iterating from right to left.
  23152. * @returns {Function} Returns the new flow function.
  23153. */
  23154. function createFlow(fromRight) {
  23155. return flatRest(function(funcs) {
  23156. var length = funcs.length,
  23157. index = length,
  23158. prereq = LodashWrapper.prototype.thru;
  23159. if (fromRight) {
  23160. funcs.reverse();
  23161. }
  23162. while (index--) {
  23163. var func = funcs[index];
  23164. if (typeof func != 'function') {
  23165. throw new TypeError(FUNC_ERROR_TEXT);
  23166. }
  23167. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23168. var wrapper = new LodashWrapper([], true);
  23169. }
  23170. }
  23171. index = wrapper ? index : length;
  23172. while (++index < length) {
  23173. func = funcs[index];
  23174. var funcName = getFuncName(func),
  23175. data = funcName == 'wrapper' ? getData(func) : undefined;
  23176. if (data && isLaziable(data[0]) &&
  23177. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23178. !data[4].length && data[9] == 1
  23179. ) {
  23180. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23181. } else {
  23182. wrapper = (func.length == 1 && isLaziable(func))
  23183. ? wrapper[funcName]()
  23184. : wrapper.thru(func);
  23185. }
  23186. }
  23187. return function() {
  23188. var args = arguments,
  23189. value = args[0];
  23190. if (wrapper && args.length == 1 && isArray(value)) {
  23191. return wrapper.plant(value).value();
  23192. }
  23193. var index = 0,
  23194. result = length ? funcs[index].apply(this, args) : value;
  23195. while (++index < length) {
  23196. result = funcs[index].call(this, result);
  23197. }
  23198. return result;
  23199. };
  23200. });
  23201. }
  23202. /**
  23203. * Creates a function that wraps `func` to invoke it with optional `this`
  23204. * binding of `thisArg`, partial application, and currying.
  23205. *
  23206. * @private
  23207. * @param {Function|string} func The function or method name to wrap.
  23208. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23209. * @param {*} [thisArg] The `this` binding of `func`.
  23210. * @param {Array} [partials] The arguments to prepend to those provided to
  23211. * the new function.
  23212. * @param {Array} [holders] The `partials` placeholder indexes.
  23213. * @param {Array} [partialsRight] The arguments to append to those provided
  23214. * to the new function.
  23215. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23216. * @param {Array} [argPos] The argument positions of the new function.
  23217. * @param {number} [ary] The arity cap of `func`.
  23218. * @param {number} [arity] The arity of `func`.
  23219. * @returns {Function} Returns the new wrapped function.
  23220. */
  23221. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23222. var isAry = bitmask & WRAP_ARY_FLAG,
  23223. isBind = bitmask & WRAP_BIND_FLAG,
  23224. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23225. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23226. isFlip = bitmask & WRAP_FLIP_FLAG,
  23227. Ctor = isBindKey ? undefined : createCtor(func);
  23228. function wrapper() {
  23229. var length = arguments.length,
  23230. args = Array(length),
  23231. index = length;
  23232. while (index--) {
  23233. args[index] = arguments[index];
  23234. }
  23235. if (isCurried) {
  23236. var placeholder = getHolder(wrapper),
  23237. holdersCount = countHolders(args, placeholder);
  23238. }
  23239. if (partials) {
  23240. args = composeArgs(args, partials, holders, isCurried);
  23241. }
  23242. if (partialsRight) {
  23243. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23244. }
  23245. length -= holdersCount;
  23246. if (isCurried && length < arity) {
  23247. var newHolders = replaceHolders(args, placeholder);
  23248. return createRecurry(
  23249. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23250. args, newHolders, argPos, ary, arity - length
  23251. );
  23252. }
  23253. var thisBinding = isBind ? thisArg : this,
  23254. fn = isBindKey ? thisBinding[func] : func;
  23255. length = args.length;
  23256. if (argPos) {
  23257. args = reorder(args, argPos);
  23258. } else if (isFlip && length > 1) {
  23259. args.reverse();
  23260. }
  23261. if (isAry && ary < length) {
  23262. args.length = ary;
  23263. }
  23264. if (this && this !== root && this instanceof wrapper) {
  23265. fn = Ctor || createCtor(fn);
  23266. }
  23267. return fn.apply(thisBinding, args);
  23268. }
  23269. return wrapper;
  23270. }
  23271. /**
  23272. * Creates a function like `_.invertBy`.
  23273. *
  23274. * @private
  23275. * @param {Function} setter The function to set accumulator values.
  23276. * @param {Function} toIteratee The function to resolve iteratees.
  23277. * @returns {Function} Returns the new inverter function.
  23278. */
  23279. function createInverter(setter, toIteratee) {
  23280. return function(object, iteratee) {
  23281. return baseInverter(object, setter, toIteratee(iteratee), {});
  23282. };
  23283. }
  23284. /**
  23285. * Creates a function that performs a mathematical operation on two values.
  23286. *
  23287. * @private
  23288. * @param {Function} operator The function to perform the operation.
  23289. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23290. * @returns {Function} Returns the new mathematical operation function.
  23291. */
  23292. function createMathOperation(operator, defaultValue) {
  23293. return function(value, other) {
  23294. var result;
  23295. if (value === undefined && other === undefined) {
  23296. return defaultValue;
  23297. }
  23298. if (value !== undefined) {
  23299. result = value;
  23300. }
  23301. if (other !== undefined) {
  23302. if (result === undefined) {
  23303. return other;
  23304. }
  23305. if (typeof value == 'string' || typeof other == 'string') {
  23306. value = baseToString(value);
  23307. other = baseToString(other);
  23308. } else {
  23309. value = baseToNumber(value);
  23310. other = baseToNumber(other);
  23311. }
  23312. result = operator(value, other);
  23313. }
  23314. return result;
  23315. };
  23316. }
  23317. /**
  23318. * Creates a function like `_.over`.
  23319. *
  23320. * @private
  23321. * @param {Function} arrayFunc The function to iterate over iteratees.
  23322. * @returns {Function} Returns the new over function.
  23323. */
  23324. function createOver(arrayFunc) {
  23325. return flatRest(function(iteratees) {
  23326. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23327. return baseRest(function(args) {
  23328. var thisArg = this;
  23329. return arrayFunc(iteratees, function(iteratee) {
  23330. return apply(iteratee, thisArg, args);
  23331. });
  23332. });
  23333. });
  23334. }
  23335. /**
  23336. * Creates the padding for `string` based on `length`. The `chars` string
  23337. * is truncated if the number of characters exceeds `length`.
  23338. *
  23339. * @private
  23340. * @param {number} length The padding length.
  23341. * @param {string} [chars=' '] The string used as padding.
  23342. * @returns {string} Returns the padding for `string`.
  23343. */
  23344. function createPadding(length, chars) {
  23345. chars = chars === undefined ? ' ' : baseToString(chars);
  23346. var charsLength = chars.length;
  23347. if (charsLength < 2) {
  23348. return charsLength ? baseRepeat(chars, length) : chars;
  23349. }
  23350. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23351. return hasUnicode(chars)
  23352. ? castSlice(stringToArray(result), 0, length).join('')
  23353. : result.slice(0, length);
  23354. }
  23355. /**
  23356. * Creates a function that wraps `func` to invoke it with the `this` binding
  23357. * of `thisArg` and `partials` prepended to the arguments it receives.
  23358. *
  23359. * @private
  23360. * @param {Function} func The function to wrap.
  23361. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23362. * @param {*} thisArg The `this` binding of `func`.
  23363. * @param {Array} partials The arguments to prepend to those provided to
  23364. * the new function.
  23365. * @returns {Function} Returns the new wrapped function.
  23366. */
  23367. function createPartial(func, bitmask, thisArg, partials) {
  23368. var isBind = bitmask & WRAP_BIND_FLAG,
  23369. Ctor = createCtor(func);
  23370. function wrapper() {
  23371. var argsIndex = -1,
  23372. argsLength = arguments.length,
  23373. leftIndex = -1,
  23374. leftLength = partials.length,
  23375. args = Array(leftLength + argsLength),
  23376. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23377. while (++leftIndex < leftLength) {
  23378. args[leftIndex] = partials[leftIndex];
  23379. }
  23380. while (argsLength--) {
  23381. args[leftIndex++] = arguments[++argsIndex];
  23382. }
  23383. return apply(fn, isBind ? thisArg : this, args);
  23384. }
  23385. return wrapper;
  23386. }
  23387. /**
  23388. * Creates a `_.range` or `_.rangeRight` function.
  23389. *
  23390. * @private
  23391. * @param {boolean} [fromRight] Specify iterating from right to left.
  23392. * @returns {Function} Returns the new range function.
  23393. */
  23394. function createRange(fromRight) {
  23395. return function(start, end, step) {
  23396. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23397. end = step = undefined;
  23398. }
  23399. // Ensure the sign of `-0` is preserved.
  23400. start = toFinite(start);
  23401. if (end === undefined) {
  23402. end = start;
  23403. start = 0;
  23404. } else {
  23405. end = toFinite(end);
  23406. }
  23407. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23408. return baseRange(start, end, step, fromRight);
  23409. };
  23410. }
  23411. /**
  23412. * Creates a function that performs a relational operation on two values.
  23413. *
  23414. * @private
  23415. * @param {Function} operator The function to perform the operation.
  23416. * @returns {Function} Returns the new relational operation function.
  23417. */
  23418. function createRelationalOperation(operator) {
  23419. return function(value, other) {
  23420. if (!(typeof value == 'string' && typeof other == 'string')) {
  23421. value = toNumber(value);
  23422. other = toNumber(other);
  23423. }
  23424. return operator(value, other);
  23425. };
  23426. }
  23427. /**
  23428. * Creates a function that wraps `func` to continue currying.
  23429. *
  23430. * @private
  23431. * @param {Function} func The function to wrap.
  23432. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23433. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23434. * @param {*} placeholder The placeholder value.
  23435. * @param {*} [thisArg] The `this` binding of `func`.
  23436. * @param {Array} [partials] The arguments to prepend to those provided to
  23437. * the new function.
  23438. * @param {Array} [holders] The `partials` placeholder indexes.
  23439. * @param {Array} [argPos] The argument positions of the new function.
  23440. * @param {number} [ary] The arity cap of `func`.
  23441. * @param {number} [arity] The arity of `func`.
  23442. * @returns {Function} Returns the new wrapped function.
  23443. */
  23444. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23445. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23446. newHolders = isCurry ? holders : undefined,
  23447. newHoldersRight = isCurry ? undefined : holders,
  23448. newPartials = isCurry ? partials : undefined,
  23449. newPartialsRight = isCurry ? undefined : partials;
  23450. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23451. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23452. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23453. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23454. }
  23455. var newData = [
  23456. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23457. newHoldersRight, argPos, ary, arity
  23458. ];
  23459. var result = wrapFunc.apply(undefined, newData);
  23460. if (isLaziable(func)) {
  23461. setData(result, newData);
  23462. }
  23463. result.placeholder = placeholder;
  23464. return setWrapToString(result, func, bitmask);
  23465. }
  23466. /**
  23467. * Creates a function like `_.round`.
  23468. *
  23469. * @private
  23470. * @param {string} methodName The name of the `Math` method to use when rounding.
  23471. * @returns {Function} Returns the new round function.
  23472. */
  23473. function createRound(methodName) {
  23474. var func = Math[methodName];
  23475. return function(number, precision) {
  23476. number = toNumber(number);
  23477. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23478. if (precision && nativeIsFinite(number)) {
  23479. // Shift with exponential notation to avoid floating-point issues.
  23480. // See [MDN](https://mdn.io/round#Examples) for more details.
  23481. var pair = (toString(number) + 'e').split('e'),
  23482. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23483. pair = (toString(value) + 'e').split('e');
  23484. return +(pair[0] + 'e' + (+pair[1] - precision));
  23485. }
  23486. return func(number);
  23487. };
  23488. }
  23489. /**
  23490. * Creates a set object of `values`.
  23491. *
  23492. * @private
  23493. * @param {Array} values The values to add to the set.
  23494. * @returns {Object} Returns the new set.
  23495. */
  23496. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23497. return new Set(values);
  23498. };
  23499. /**
  23500. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23501. *
  23502. * @private
  23503. * @param {Function} keysFunc The function to get the keys of a given object.
  23504. * @returns {Function} Returns the new pairs function.
  23505. */
  23506. function createToPairs(keysFunc) {
  23507. return function(object) {
  23508. var tag = getTag(object);
  23509. if (tag == mapTag) {
  23510. return mapToArray(object);
  23511. }
  23512. if (tag == setTag) {
  23513. return setToPairs(object);
  23514. }
  23515. return baseToPairs(object, keysFunc(object));
  23516. };
  23517. }
  23518. /**
  23519. * Creates a function that either curries or invokes `func` with optional
  23520. * `this` binding and partially applied arguments.
  23521. *
  23522. * @private
  23523. * @param {Function|string} func The function or method name to wrap.
  23524. * @param {number} bitmask The bitmask flags.
  23525. * 1 - `_.bind`
  23526. * 2 - `_.bindKey`
  23527. * 4 - `_.curry` or `_.curryRight` of a bound function
  23528. * 8 - `_.curry`
  23529. * 16 - `_.curryRight`
  23530. * 32 - `_.partial`
  23531. * 64 - `_.partialRight`
  23532. * 128 - `_.rearg`
  23533. * 256 - `_.ary`
  23534. * 512 - `_.flip`
  23535. * @param {*} [thisArg] The `this` binding of `func`.
  23536. * @param {Array} [partials] The arguments to be partially applied.
  23537. * @param {Array} [holders] The `partials` placeholder indexes.
  23538. * @param {Array} [argPos] The argument positions of the new function.
  23539. * @param {number} [ary] The arity cap of `func`.
  23540. * @param {number} [arity] The arity of `func`.
  23541. * @returns {Function} Returns the new wrapped function.
  23542. */
  23543. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23544. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23545. if (!isBindKey && typeof func != 'function') {
  23546. throw new TypeError(FUNC_ERROR_TEXT);
  23547. }
  23548. var length = partials ? partials.length : 0;
  23549. if (!length) {
  23550. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23551. partials = holders = undefined;
  23552. }
  23553. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23554. arity = arity === undefined ? arity : toInteger(arity);
  23555. length -= holders ? holders.length : 0;
  23556. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23557. var partialsRight = partials,
  23558. holdersRight = holders;
  23559. partials = holders = undefined;
  23560. }
  23561. var data = isBindKey ? undefined : getData(func);
  23562. var newData = [
  23563. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23564. argPos, ary, arity
  23565. ];
  23566. if (data) {
  23567. mergeData(newData, data);
  23568. }
  23569. func = newData[0];
  23570. bitmask = newData[1];
  23571. thisArg = newData[2];
  23572. partials = newData[3];
  23573. holders = newData[4];
  23574. arity = newData[9] = newData[9] === undefined
  23575. ? (isBindKey ? 0 : func.length)
  23576. : nativeMax(newData[9] - length, 0);
  23577. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23578. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23579. }
  23580. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23581. var result = createBind(func, bitmask, thisArg);
  23582. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23583. result = createCurry(func, bitmask, arity);
  23584. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23585. result = createPartial(func, bitmask, thisArg, partials);
  23586. } else {
  23587. result = createHybrid.apply(undefined, newData);
  23588. }
  23589. var setter = data ? baseSetData : setData;
  23590. return setWrapToString(setter(result, newData), func, bitmask);
  23591. }
  23592. /**
  23593. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23594. * of source objects to the destination object for all destination properties
  23595. * that resolve to `undefined`.
  23596. *
  23597. * @private
  23598. * @param {*} objValue The destination value.
  23599. * @param {*} srcValue The source value.
  23600. * @param {string} key The key of the property to assign.
  23601. * @param {Object} object The parent object of `objValue`.
  23602. * @returns {*} Returns the value to assign.
  23603. */
  23604. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23605. if (objValue === undefined ||
  23606. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23607. return srcValue;
  23608. }
  23609. return objValue;
  23610. }
  23611. /**
  23612. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23613. * objects into destination objects that are passed thru.
  23614. *
  23615. * @private
  23616. * @param {*} objValue The destination value.
  23617. * @param {*} srcValue The source value.
  23618. * @param {string} key The key of the property to merge.
  23619. * @param {Object} object The parent object of `objValue`.
  23620. * @param {Object} source The parent object of `srcValue`.
  23621. * @param {Object} [stack] Tracks traversed source values and their merged
  23622. * counterparts.
  23623. * @returns {*} Returns the value to assign.
  23624. */
  23625. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23626. if (isObject(objValue) && isObject(srcValue)) {
  23627. // Recursively merge objects and arrays (susceptible to call stack limits).
  23628. stack.set(srcValue, objValue);
  23629. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23630. stack['delete'](srcValue);
  23631. }
  23632. return objValue;
  23633. }
  23634. /**
  23635. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23636. * objects.
  23637. *
  23638. * @private
  23639. * @param {*} value The value to inspect.
  23640. * @param {string} key The key of the property to inspect.
  23641. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23642. */
  23643. function customOmitClone(value) {
  23644. return isPlainObject(value) ? undefined : value;
  23645. }
  23646. /**
  23647. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23648. * partial deep comparisons.
  23649. *
  23650. * @private
  23651. * @param {Array} array The array to compare.
  23652. * @param {Array} other The other array to compare.
  23653. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23654. * @param {Function} customizer The function to customize comparisons.
  23655. * @param {Function} equalFunc The function to determine equivalents of values.
  23656. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23657. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23658. */
  23659. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23660. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23661. arrLength = array.length,
  23662. othLength = other.length;
  23663. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23664. return false;
  23665. }
  23666. // Assume cyclic values are equal.
  23667. var stacked = stack.get(array);
  23668. if (stacked && stack.get(other)) {
  23669. return stacked == other;
  23670. }
  23671. var index = -1,
  23672. result = true,
  23673. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23674. stack.set(array, other);
  23675. stack.set(other, array);
  23676. // Ignore non-index properties.
  23677. while (++index < arrLength) {
  23678. var arrValue = array[index],
  23679. othValue = other[index];
  23680. if (customizer) {
  23681. var compared = isPartial
  23682. ? customizer(othValue, arrValue, index, other, array, stack)
  23683. : customizer(arrValue, othValue, index, array, other, stack);
  23684. }
  23685. if (compared !== undefined) {
  23686. if (compared) {
  23687. continue;
  23688. }
  23689. result = false;
  23690. break;
  23691. }
  23692. // Recursively compare arrays (susceptible to call stack limits).
  23693. if (seen) {
  23694. if (!arraySome(other, function(othValue, othIndex) {
  23695. if (!cacheHas(seen, othIndex) &&
  23696. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23697. return seen.push(othIndex);
  23698. }
  23699. })) {
  23700. result = false;
  23701. break;
  23702. }
  23703. } else if (!(
  23704. arrValue === othValue ||
  23705. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23706. )) {
  23707. result = false;
  23708. break;
  23709. }
  23710. }
  23711. stack['delete'](array);
  23712. stack['delete'](other);
  23713. return result;
  23714. }
  23715. /**
  23716. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23717. * the same `toStringTag`.
  23718. *
  23719. * **Note:** This function only supports comparing values with tags of
  23720. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23721. *
  23722. * @private
  23723. * @param {Object} object The object to compare.
  23724. * @param {Object} other The other object to compare.
  23725. * @param {string} tag The `toStringTag` of the objects to compare.
  23726. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23727. * @param {Function} customizer The function to customize comparisons.
  23728. * @param {Function} equalFunc The function to determine equivalents of values.
  23729. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23730. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23731. */
  23732. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23733. switch (tag) {
  23734. case dataViewTag:
  23735. if ((object.byteLength != other.byteLength) ||
  23736. (object.byteOffset != other.byteOffset)) {
  23737. return false;
  23738. }
  23739. object = object.buffer;
  23740. other = other.buffer;
  23741. case arrayBufferTag:
  23742. if ((object.byteLength != other.byteLength) ||
  23743. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23744. return false;
  23745. }
  23746. return true;
  23747. case boolTag:
  23748. case dateTag:
  23749. case numberTag:
  23750. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23751. // Invalid dates are coerced to `NaN`.
  23752. return eq(+object, +other);
  23753. case errorTag:
  23754. return object.name == other.name && object.message == other.message;
  23755. case regexpTag:
  23756. case stringTag:
  23757. // Coerce regexes to strings and treat strings, primitives and objects,
  23758. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23759. // for more details.
  23760. return object == (other + '');
  23761. case mapTag:
  23762. var convert = mapToArray;
  23763. case setTag:
  23764. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23765. convert || (convert = setToArray);
  23766. if (object.size != other.size && !isPartial) {
  23767. return false;
  23768. }
  23769. // Assume cyclic values are equal.
  23770. var stacked = stack.get(object);
  23771. if (stacked) {
  23772. return stacked == other;
  23773. }
  23774. bitmask |= COMPARE_UNORDERED_FLAG;
  23775. // Recursively compare objects (susceptible to call stack limits).
  23776. stack.set(object, other);
  23777. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23778. stack['delete'](object);
  23779. return result;
  23780. case symbolTag:
  23781. if (symbolValueOf) {
  23782. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23783. }
  23784. }
  23785. return false;
  23786. }
  23787. /**
  23788. * A specialized version of `baseIsEqualDeep` for objects with support for
  23789. * partial deep comparisons.
  23790. *
  23791. * @private
  23792. * @param {Object} object The object to compare.
  23793. * @param {Object} other The other object to compare.
  23794. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23795. * @param {Function} customizer The function to customize comparisons.
  23796. * @param {Function} equalFunc The function to determine equivalents of values.
  23797. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23798. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23799. */
  23800. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23801. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23802. objProps = getAllKeys(object),
  23803. objLength = objProps.length,
  23804. othProps = getAllKeys(other),
  23805. othLength = othProps.length;
  23806. if (objLength != othLength && !isPartial) {
  23807. return false;
  23808. }
  23809. var index = objLength;
  23810. while (index--) {
  23811. var key = objProps[index];
  23812. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23813. return false;
  23814. }
  23815. }
  23816. // Assume cyclic values are equal.
  23817. var stacked = stack.get(object);
  23818. if (stacked && stack.get(other)) {
  23819. return stacked == other;
  23820. }
  23821. var result = true;
  23822. stack.set(object, other);
  23823. stack.set(other, object);
  23824. var skipCtor = isPartial;
  23825. while (++index < objLength) {
  23826. key = objProps[index];
  23827. var objValue = object[key],
  23828. othValue = other[key];
  23829. if (customizer) {
  23830. var compared = isPartial
  23831. ? customizer(othValue, objValue, key, other, object, stack)
  23832. : customizer(objValue, othValue, key, object, other, stack);
  23833. }
  23834. // Recursively compare objects (susceptible to call stack limits).
  23835. if (!(compared === undefined
  23836. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23837. : compared
  23838. )) {
  23839. result = false;
  23840. break;
  23841. }
  23842. skipCtor || (skipCtor = key == 'constructor');
  23843. }
  23844. if (result && !skipCtor) {
  23845. var objCtor = object.constructor,
  23846. othCtor = other.constructor;
  23847. // Non `Object` object instances with different constructors are not equal.
  23848. if (objCtor != othCtor &&
  23849. ('constructor' in object && 'constructor' in other) &&
  23850. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23851. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23852. result = false;
  23853. }
  23854. }
  23855. stack['delete'](object);
  23856. stack['delete'](other);
  23857. return result;
  23858. }
  23859. /**
  23860. * A specialized version of `baseRest` which flattens the rest array.
  23861. *
  23862. * @private
  23863. * @param {Function} func The function to apply a rest parameter to.
  23864. * @returns {Function} Returns the new function.
  23865. */
  23866. function flatRest(func) {
  23867. return setToString(overRest(func, undefined, flatten), func + '');
  23868. }
  23869. /**
  23870. * Creates an array of own enumerable property names and symbols of `object`.
  23871. *
  23872. * @private
  23873. * @param {Object} object The object to query.
  23874. * @returns {Array} Returns the array of property names and symbols.
  23875. */
  23876. function getAllKeys(object) {
  23877. return baseGetAllKeys(object, keys, getSymbols);
  23878. }
  23879. /**
  23880. * Creates an array of own and inherited enumerable property names and
  23881. * symbols of `object`.
  23882. *
  23883. * @private
  23884. * @param {Object} object The object to query.
  23885. * @returns {Array} Returns the array of property names and symbols.
  23886. */
  23887. function getAllKeysIn(object) {
  23888. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23889. }
  23890. /**
  23891. * Gets metadata for `func`.
  23892. *
  23893. * @private
  23894. * @param {Function} func The function to query.
  23895. * @returns {*} Returns the metadata for `func`.
  23896. */
  23897. var getData = !metaMap ? noop : function(func) {
  23898. return metaMap.get(func);
  23899. };
  23900. /**
  23901. * Gets the name of `func`.
  23902. *
  23903. * @private
  23904. * @param {Function} func The function to query.
  23905. * @returns {string} Returns the function name.
  23906. */
  23907. function getFuncName(func) {
  23908. var result = (func.name + ''),
  23909. array = realNames[result],
  23910. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23911. while (length--) {
  23912. var data = array[length],
  23913. otherFunc = data.func;
  23914. if (otherFunc == null || otherFunc == func) {
  23915. return data.name;
  23916. }
  23917. }
  23918. return result;
  23919. }
  23920. /**
  23921. * Gets the argument placeholder value for `func`.
  23922. *
  23923. * @private
  23924. * @param {Function} func The function to inspect.
  23925. * @returns {*} Returns the placeholder value.
  23926. */
  23927. function getHolder(func) {
  23928. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23929. return object.placeholder;
  23930. }
  23931. /**
  23932. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23933. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23934. * If arguments are provided, the chosen function is invoked with them and
  23935. * its result is returned.
  23936. *
  23937. * @private
  23938. * @param {*} [value] The value to convert to an iteratee.
  23939. * @param {number} [arity] The arity of the created iteratee.
  23940. * @returns {Function} Returns the chosen function or its result.
  23941. */
  23942. function getIteratee() {
  23943. var result = lodash.iteratee || iteratee;
  23944. result = result === iteratee ? baseIteratee : result;
  23945. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23946. }
  23947. /**
  23948. * Gets the data for `map`.
  23949. *
  23950. * @private
  23951. * @param {Object} map The map to query.
  23952. * @param {string} key The reference key.
  23953. * @returns {*} Returns the map data.
  23954. */
  23955. function getMapData(map, key) {
  23956. var data = map.__data__;
  23957. return isKeyable(key)
  23958. ? data[typeof key == 'string' ? 'string' : 'hash']
  23959. : data.map;
  23960. }
  23961. /**
  23962. * Gets the property names, values, and compare flags of `object`.
  23963. *
  23964. * @private
  23965. * @param {Object} object The object to query.
  23966. * @returns {Array} Returns the match data of `object`.
  23967. */
  23968. function getMatchData(object) {
  23969. var result = keys(object),
  23970. length = result.length;
  23971. while (length--) {
  23972. var key = result[length],
  23973. value = object[key];
  23974. result[length] = [key, value, isStrictComparable(value)];
  23975. }
  23976. return result;
  23977. }
  23978. /**
  23979. * Gets the native function at `key` of `object`.
  23980. *
  23981. * @private
  23982. * @param {Object} object The object to query.
  23983. * @param {string} key The key of the method to get.
  23984. * @returns {*} Returns the function if it's native, else `undefined`.
  23985. */
  23986. function getNative(object, key) {
  23987. var value = getValue(object, key);
  23988. return baseIsNative(value) ? value : undefined;
  23989. }
  23990. /**
  23991. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23992. *
  23993. * @private
  23994. * @param {*} value The value to query.
  23995. * @returns {string} Returns the raw `toStringTag`.
  23996. */
  23997. function getRawTag(value) {
  23998. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23999. tag = value[symToStringTag];
  24000. try {
  24001. value[symToStringTag] = undefined;
  24002. var unmasked = true;
  24003. } catch (e) {}
  24004. var result = nativeObjectToString.call(value);
  24005. if (unmasked) {
  24006. if (isOwn) {
  24007. value[symToStringTag] = tag;
  24008. } else {
  24009. delete value[symToStringTag];
  24010. }
  24011. }
  24012. return result;
  24013. }
  24014. /**
  24015. * Creates an array of the own enumerable symbols of `object`.
  24016. *
  24017. * @private
  24018. * @param {Object} object The object to query.
  24019. * @returns {Array} Returns the array of symbols.
  24020. */
  24021. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24022. if (object == null) {
  24023. return [];
  24024. }
  24025. object = Object(object);
  24026. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24027. return propertyIsEnumerable.call(object, symbol);
  24028. });
  24029. };
  24030. /**
  24031. * Creates an array of the own and inherited enumerable symbols of `object`.
  24032. *
  24033. * @private
  24034. * @param {Object} object The object to query.
  24035. * @returns {Array} Returns the array of symbols.
  24036. */
  24037. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24038. var result = [];
  24039. while (object) {
  24040. arrayPush(result, getSymbols(object));
  24041. object = getPrototype(object);
  24042. }
  24043. return result;
  24044. };
  24045. /**
  24046. * Gets the `toStringTag` of `value`.
  24047. *
  24048. * @private
  24049. * @param {*} value The value to query.
  24050. * @returns {string} Returns the `toStringTag`.
  24051. */
  24052. var getTag = baseGetTag;
  24053. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24054. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24055. (Map && getTag(new Map) != mapTag) ||
  24056. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24057. (Set && getTag(new Set) != setTag) ||
  24058. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24059. getTag = function(value) {
  24060. var result = baseGetTag(value),
  24061. Ctor = result == objectTag ? value.constructor : undefined,
  24062. ctorString = Ctor ? toSource(Ctor) : '';
  24063. if (ctorString) {
  24064. switch (ctorString) {
  24065. case dataViewCtorString: return dataViewTag;
  24066. case mapCtorString: return mapTag;
  24067. case promiseCtorString: return promiseTag;
  24068. case setCtorString: return setTag;
  24069. case weakMapCtorString: return weakMapTag;
  24070. }
  24071. }
  24072. return result;
  24073. };
  24074. }
  24075. /**
  24076. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24077. *
  24078. * @private
  24079. * @param {number} start The start of the view.
  24080. * @param {number} end The end of the view.
  24081. * @param {Array} transforms The transformations to apply to the view.
  24082. * @returns {Object} Returns an object containing the `start` and `end`
  24083. * positions of the view.
  24084. */
  24085. function getView(start, end, transforms) {
  24086. var index = -1,
  24087. length = transforms.length;
  24088. while (++index < length) {
  24089. var data = transforms[index],
  24090. size = data.size;
  24091. switch (data.type) {
  24092. case 'drop': start += size; break;
  24093. case 'dropRight': end -= size; break;
  24094. case 'take': end = nativeMin(end, start + size); break;
  24095. case 'takeRight': start = nativeMax(start, end - size); break;
  24096. }
  24097. }
  24098. return { 'start': start, 'end': end };
  24099. }
  24100. /**
  24101. * Extracts wrapper details from the `source` body comment.
  24102. *
  24103. * @private
  24104. * @param {string} source The source to inspect.
  24105. * @returns {Array} Returns the wrapper details.
  24106. */
  24107. function getWrapDetails(source) {
  24108. var match = source.match(reWrapDetails);
  24109. return match ? match[1].split(reSplitDetails) : [];
  24110. }
  24111. /**
  24112. * Checks if `path` exists on `object`.
  24113. *
  24114. * @private
  24115. * @param {Object} object The object to query.
  24116. * @param {Array|string} path The path to check.
  24117. * @param {Function} hasFunc The function to check properties.
  24118. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24119. */
  24120. function hasPath(object, path, hasFunc) {
  24121. path = castPath(path, object);
  24122. var index = -1,
  24123. length = path.length,
  24124. result = false;
  24125. while (++index < length) {
  24126. var key = toKey(path[index]);
  24127. if (!(result = object != null && hasFunc(object, key))) {
  24128. break;
  24129. }
  24130. object = object[key];
  24131. }
  24132. if (result || ++index != length) {
  24133. return result;
  24134. }
  24135. length = object == null ? 0 : object.length;
  24136. return !!length && isLength(length) && isIndex(key, length) &&
  24137. (isArray(object) || isArguments(object));
  24138. }
  24139. /**
  24140. * Initializes an array clone.
  24141. *
  24142. * @private
  24143. * @param {Array} array The array to clone.
  24144. * @returns {Array} Returns the initialized clone.
  24145. */
  24146. function initCloneArray(array) {
  24147. var length = array.length,
  24148. result = new array.constructor(length);
  24149. // Add properties assigned by `RegExp#exec`.
  24150. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24151. result.index = array.index;
  24152. result.input = array.input;
  24153. }
  24154. return result;
  24155. }
  24156. /**
  24157. * Initializes an object clone.
  24158. *
  24159. * @private
  24160. * @param {Object} object The object to clone.
  24161. * @returns {Object} Returns the initialized clone.
  24162. */
  24163. function initCloneObject(object) {
  24164. return (typeof object.constructor == 'function' && !isPrototype(object))
  24165. ? baseCreate(getPrototype(object))
  24166. : {};
  24167. }
  24168. /**
  24169. * Initializes an object clone based on its `toStringTag`.
  24170. *
  24171. * **Note:** This function only supports cloning values with tags of
  24172. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24173. *
  24174. * @private
  24175. * @param {Object} object The object to clone.
  24176. * @param {string} tag The `toStringTag` of the object to clone.
  24177. * @param {boolean} [isDeep] Specify a deep clone.
  24178. * @returns {Object} Returns the initialized clone.
  24179. */
  24180. function initCloneByTag(object, tag, isDeep) {
  24181. var Ctor = object.constructor;
  24182. switch (tag) {
  24183. case arrayBufferTag:
  24184. return cloneArrayBuffer(object);
  24185. case boolTag:
  24186. case dateTag:
  24187. return new Ctor(+object);
  24188. case dataViewTag:
  24189. return cloneDataView(object, isDeep);
  24190. case float32Tag: case float64Tag:
  24191. case int8Tag: case int16Tag: case int32Tag:
  24192. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24193. return cloneTypedArray(object, isDeep);
  24194. case mapTag:
  24195. return new Ctor;
  24196. case numberTag:
  24197. case stringTag:
  24198. return new Ctor(object);
  24199. case regexpTag:
  24200. return cloneRegExp(object);
  24201. case setTag:
  24202. return new Ctor;
  24203. case symbolTag:
  24204. return cloneSymbol(object);
  24205. }
  24206. }
  24207. /**
  24208. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24209. *
  24210. * @private
  24211. * @param {string} source The source to modify.
  24212. * @returns {Array} details The details to insert.
  24213. * @returns {string} Returns the modified source.
  24214. */
  24215. function insertWrapDetails(source, details) {
  24216. var length = details.length;
  24217. if (!length) {
  24218. return source;
  24219. }
  24220. var lastIndex = length - 1;
  24221. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24222. details = details.join(length > 2 ? ', ' : ' ');
  24223. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24224. }
  24225. /**
  24226. * Checks if `value` is a flattenable `arguments` object or array.
  24227. *
  24228. * @private
  24229. * @param {*} value The value to check.
  24230. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24231. */
  24232. function isFlattenable(value) {
  24233. return isArray(value) || isArguments(value) ||
  24234. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24235. }
  24236. /**
  24237. * Checks if `value` is a valid array-like index.
  24238. *
  24239. * @private
  24240. * @param {*} value The value to check.
  24241. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24242. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24243. */
  24244. function isIndex(value, length) {
  24245. var type = typeof value;
  24246. length = length == null ? MAX_SAFE_INTEGER : length;
  24247. return !!length &&
  24248. (type == 'number' ||
  24249. (type != 'symbol' && reIsUint.test(value))) &&
  24250. (value > -1 && value % 1 == 0 && value < length);
  24251. }
  24252. /**
  24253. * Checks if the given arguments are from an iteratee call.
  24254. *
  24255. * @private
  24256. * @param {*} value The potential iteratee value argument.
  24257. * @param {*} index The potential iteratee index or key argument.
  24258. * @param {*} object The potential iteratee object argument.
  24259. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24260. * else `false`.
  24261. */
  24262. function isIterateeCall(value, index, object) {
  24263. if (!isObject(object)) {
  24264. return false;
  24265. }
  24266. var type = typeof index;
  24267. if (type == 'number'
  24268. ? (isArrayLike(object) && isIndex(index, object.length))
  24269. : (type == 'string' && index in object)
  24270. ) {
  24271. return eq(object[index], value);
  24272. }
  24273. return false;
  24274. }
  24275. /**
  24276. * Checks if `value` is a property name and not a property path.
  24277. *
  24278. * @private
  24279. * @param {*} value The value to check.
  24280. * @param {Object} [object] The object to query keys on.
  24281. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24282. */
  24283. function isKey(value, object) {
  24284. if (isArray(value)) {
  24285. return false;
  24286. }
  24287. var type = typeof value;
  24288. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24289. value == null || isSymbol(value)) {
  24290. return true;
  24291. }
  24292. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24293. (object != null && value in Object(object));
  24294. }
  24295. /**
  24296. * Checks if `value` is suitable for use as unique object key.
  24297. *
  24298. * @private
  24299. * @param {*} value The value to check.
  24300. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24301. */
  24302. function isKeyable(value) {
  24303. var type = typeof value;
  24304. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24305. ? (value !== '__proto__')
  24306. : (value === null);
  24307. }
  24308. /**
  24309. * Checks if `func` has a lazy counterpart.
  24310. *
  24311. * @private
  24312. * @param {Function} func The function to check.
  24313. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24314. * else `false`.
  24315. */
  24316. function isLaziable(func) {
  24317. var funcName = getFuncName(func),
  24318. other = lodash[funcName];
  24319. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24320. return false;
  24321. }
  24322. if (func === other) {
  24323. return true;
  24324. }
  24325. var data = getData(other);
  24326. return !!data && func === data[0];
  24327. }
  24328. /**
  24329. * Checks if `func` has its source masked.
  24330. *
  24331. * @private
  24332. * @param {Function} func The function to check.
  24333. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24334. */
  24335. function isMasked(func) {
  24336. return !!maskSrcKey && (maskSrcKey in func);
  24337. }
  24338. /**
  24339. * Checks if `func` is capable of being masked.
  24340. *
  24341. * @private
  24342. * @param {*} value The value to check.
  24343. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24344. */
  24345. var isMaskable = coreJsData ? isFunction : stubFalse;
  24346. /**
  24347. * Checks if `value` is likely a prototype object.
  24348. *
  24349. * @private
  24350. * @param {*} value The value to check.
  24351. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24352. */
  24353. function isPrototype(value) {
  24354. var Ctor = value && value.constructor,
  24355. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24356. return value === proto;
  24357. }
  24358. /**
  24359. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24360. *
  24361. * @private
  24362. * @param {*} value The value to check.
  24363. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24364. * equality comparisons, else `false`.
  24365. */
  24366. function isStrictComparable(value) {
  24367. return value === value && !isObject(value);
  24368. }
  24369. /**
  24370. * A specialized version of `matchesProperty` for source values suitable
  24371. * for strict equality comparisons, i.e. `===`.
  24372. *
  24373. * @private
  24374. * @param {string} key The key of the property to get.
  24375. * @param {*} srcValue The value to match.
  24376. * @returns {Function} Returns the new spec function.
  24377. */
  24378. function matchesStrictComparable(key, srcValue) {
  24379. return function(object) {
  24380. if (object == null) {
  24381. return false;
  24382. }
  24383. return object[key] === srcValue &&
  24384. (srcValue !== undefined || (key in Object(object)));
  24385. };
  24386. }
  24387. /**
  24388. * A specialized version of `_.memoize` which clears the memoized function's
  24389. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24390. *
  24391. * @private
  24392. * @param {Function} func The function to have its output memoized.
  24393. * @returns {Function} Returns the new memoized function.
  24394. */
  24395. function memoizeCapped(func) {
  24396. var result = memoize(func, function(key) {
  24397. if (cache.size === MAX_MEMOIZE_SIZE) {
  24398. cache.clear();
  24399. }
  24400. return key;
  24401. });
  24402. var cache = result.cache;
  24403. return result;
  24404. }
  24405. /**
  24406. * Merges the function metadata of `source` into `data`.
  24407. *
  24408. * Merging metadata reduces the number of wrappers used to invoke a function.
  24409. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24410. * may be applied regardless of execution order. Methods like `_.ary` and
  24411. * `_.rearg` modify function arguments, making the order in which they are
  24412. * executed important, preventing the merging of metadata. However, we make
  24413. * an exception for a safe combined case where curried functions have `_.ary`
  24414. * and or `_.rearg` applied.
  24415. *
  24416. * @private
  24417. * @param {Array} data The destination metadata.
  24418. * @param {Array} source The source metadata.
  24419. * @returns {Array} Returns `data`.
  24420. */
  24421. function mergeData(data, source) {
  24422. var bitmask = data[1],
  24423. srcBitmask = source[1],
  24424. newBitmask = bitmask | srcBitmask,
  24425. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24426. var isCombo =
  24427. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24428. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24429. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24430. // Exit early if metadata can't be merged.
  24431. if (!(isCommon || isCombo)) {
  24432. return data;
  24433. }
  24434. // Use source `thisArg` if available.
  24435. if (srcBitmask & WRAP_BIND_FLAG) {
  24436. data[2] = source[2];
  24437. // Set when currying a bound function.
  24438. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24439. }
  24440. // Compose partial arguments.
  24441. var value = source[3];
  24442. if (value) {
  24443. var partials = data[3];
  24444. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24445. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24446. }
  24447. // Compose partial right arguments.
  24448. value = source[5];
  24449. if (value) {
  24450. partials = data[5];
  24451. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24452. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24453. }
  24454. // Use source `argPos` if available.
  24455. value = source[7];
  24456. if (value) {
  24457. data[7] = value;
  24458. }
  24459. // Use source `ary` if it's smaller.
  24460. if (srcBitmask & WRAP_ARY_FLAG) {
  24461. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24462. }
  24463. // Use source `arity` if one is not provided.
  24464. if (data[9] == null) {
  24465. data[9] = source[9];
  24466. }
  24467. // Use source `func` and merge bitmasks.
  24468. data[0] = source[0];
  24469. data[1] = newBitmask;
  24470. return data;
  24471. }
  24472. /**
  24473. * This function is like
  24474. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24475. * except that it includes inherited enumerable properties.
  24476. *
  24477. * @private
  24478. * @param {Object} object The object to query.
  24479. * @returns {Array} Returns the array of property names.
  24480. */
  24481. function nativeKeysIn(object) {
  24482. var result = [];
  24483. if (object != null) {
  24484. for (var key in Object(object)) {
  24485. result.push(key);
  24486. }
  24487. }
  24488. return result;
  24489. }
  24490. /**
  24491. * Converts `value` to a string using `Object.prototype.toString`.
  24492. *
  24493. * @private
  24494. * @param {*} value The value to convert.
  24495. * @returns {string} Returns the converted string.
  24496. */
  24497. function objectToString(value) {
  24498. return nativeObjectToString.call(value);
  24499. }
  24500. /**
  24501. * A specialized version of `baseRest` which transforms the rest array.
  24502. *
  24503. * @private
  24504. * @param {Function} func The function to apply a rest parameter to.
  24505. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24506. * @param {Function} transform The rest array transform.
  24507. * @returns {Function} Returns the new function.
  24508. */
  24509. function overRest(func, start, transform) {
  24510. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24511. return function() {
  24512. var args = arguments,
  24513. index = -1,
  24514. length = nativeMax(args.length - start, 0),
  24515. array = Array(length);
  24516. while (++index < length) {
  24517. array[index] = args[start + index];
  24518. }
  24519. index = -1;
  24520. var otherArgs = Array(start + 1);
  24521. while (++index < start) {
  24522. otherArgs[index] = args[index];
  24523. }
  24524. otherArgs[start] = transform(array);
  24525. return apply(func, this, otherArgs);
  24526. };
  24527. }
  24528. /**
  24529. * Gets the parent value at `path` of `object`.
  24530. *
  24531. * @private
  24532. * @param {Object} object The object to query.
  24533. * @param {Array} path The path to get the parent value of.
  24534. * @returns {*} Returns the parent value.
  24535. */
  24536. function parent(object, path) {
  24537. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24538. }
  24539. /**
  24540. * Reorder `array` according to the specified indexes where the element at
  24541. * the first index is assigned as the first element, the element at
  24542. * the second index is assigned as the second element, and so on.
  24543. *
  24544. * @private
  24545. * @param {Array} array The array to reorder.
  24546. * @param {Array} indexes The arranged array indexes.
  24547. * @returns {Array} Returns `array`.
  24548. */
  24549. function reorder(array, indexes) {
  24550. var arrLength = array.length,
  24551. length = nativeMin(indexes.length, arrLength),
  24552. oldArray = copyArray(array);
  24553. while (length--) {
  24554. var index = indexes[length];
  24555. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24556. }
  24557. return array;
  24558. }
  24559. /**
  24560. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24561. *
  24562. * @private
  24563. * @param {Object} object The object to query.
  24564. * @param {string} key The key of the property to get.
  24565. * @returns {*} Returns the property value.
  24566. */
  24567. function safeGet(object, key) {
  24568. if (key === 'constructor' && typeof object[key] === 'function') {
  24569. return;
  24570. }
  24571. if (key == '__proto__') {
  24572. return;
  24573. }
  24574. return object[key];
  24575. }
  24576. /**
  24577. * Sets metadata for `func`.
  24578. *
  24579. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24580. * period of time, it will trip its breaker and transition to an identity
  24581. * function to avoid garbage collection pauses in V8. See
  24582. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24583. * for more details.
  24584. *
  24585. * @private
  24586. * @param {Function} func The function to associate metadata with.
  24587. * @param {*} data The metadata.
  24588. * @returns {Function} Returns `func`.
  24589. */
  24590. var setData = shortOut(baseSetData);
  24591. /**
  24592. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24593. *
  24594. * @private
  24595. * @param {Function} func The function to delay.
  24596. * @param {number} wait The number of milliseconds to delay invocation.
  24597. * @returns {number|Object} Returns the timer id or timeout object.
  24598. */
  24599. var setTimeout = ctxSetTimeout || function(func, wait) {
  24600. return root.setTimeout(func, wait);
  24601. };
  24602. /**
  24603. * Sets the `toString` method of `func` to return `string`.
  24604. *
  24605. * @private
  24606. * @param {Function} func The function to modify.
  24607. * @param {Function} string The `toString` result.
  24608. * @returns {Function} Returns `func`.
  24609. */
  24610. var setToString = shortOut(baseSetToString);
  24611. /**
  24612. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24613. * with wrapper details in a comment at the top of the source body.
  24614. *
  24615. * @private
  24616. * @param {Function} wrapper The function to modify.
  24617. * @param {Function} reference The reference function.
  24618. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24619. * @returns {Function} Returns `wrapper`.
  24620. */
  24621. function setWrapToString(wrapper, reference, bitmask) {
  24622. var source = (reference + '');
  24623. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24624. }
  24625. /**
  24626. * Creates a function that'll short out and invoke `identity` instead
  24627. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24628. * milliseconds.
  24629. *
  24630. * @private
  24631. * @param {Function} func The function to restrict.
  24632. * @returns {Function} Returns the new shortable function.
  24633. */
  24634. function shortOut(func) {
  24635. var count = 0,
  24636. lastCalled = 0;
  24637. return function() {
  24638. var stamp = nativeNow(),
  24639. remaining = HOT_SPAN - (stamp - lastCalled);
  24640. lastCalled = stamp;
  24641. if (remaining > 0) {
  24642. if (++count >= HOT_COUNT) {
  24643. return arguments[0];
  24644. }
  24645. } else {
  24646. count = 0;
  24647. }
  24648. return func.apply(undefined, arguments);
  24649. };
  24650. }
  24651. /**
  24652. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24653. *
  24654. * @private
  24655. * @param {Array} array The array to shuffle.
  24656. * @param {number} [size=array.length] The size of `array`.
  24657. * @returns {Array} Returns `array`.
  24658. */
  24659. function shuffleSelf(array, size) {
  24660. var index = -1,
  24661. length = array.length,
  24662. lastIndex = length - 1;
  24663. size = size === undefined ? length : size;
  24664. while (++index < size) {
  24665. var rand = baseRandom(index, lastIndex),
  24666. value = array[rand];
  24667. array[rand] = array[index];
  24668. array[index] = value;
  24669. }
  24670. array.length = size;
  24671. return array;
  24672. }
  24673. /**
  24674. * Converts `string` to a property path array.
  24675. *
  24676. * @private
  24677. * @param {string} string The string to convert.
  24678. * @returns {Array} Returns the property path array.
  24679. */
  24680. var stringToPath = memoizeCapped(function(string) {
  24681. var result = [];
  24682. if (string.charCodeAt(0) === 46 /* . */) {
  24683. result.push('');
  24684. }
  24685. string.replace(rePropName, function(match, number, quote, subString) {
  24686. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24687. });
  24688. return result;
  24689. });
  24690. /**
  24691. * Converts `value` to a string key if it's not a string or symbol.
  24692. *
  24693. * @private
  24694. * @param {*} value The value to inspect.
  24695. * @returns {string|symbol} Returns the key.
  24696. */
  24697. function toKey(value) {
  24698. if (typeof value == 'string' || isSymbol(value)) {
  24699. return value;
  24700. }
  24701. var result = (value + '');
  24702. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24703. }
  24704. /**
  24705. * Converts `func` to its source code.
  24706. *
  24707. * @private
  24708. * @param {Function} func The function to convert.
  24709. * @returns {string} Returns the source code.
  24710. */
  24711. function toSource(func) {
  24712. if (func != null) {
  24713. try {
  24714. return funcToString.call(func);
  24715. } catch (e) {}
  24716. try {
  24717. return (func + '');
  24718. } catch (e) {}
  24719. }
  24720. return '';
  24721. }
  24722. /**
  24723. * Updates wrapper `details` based on `bitmask` flags.
  24724. *
  24725. * @private
  24726. * @returns {Array} details The details to modify.
  24727. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24728. * @returns {Array} Returns `details`.
  24729. */
  24730. function updateWrapDetails(details, bitmask) {
  24731. arrayEach(wrapFlags, function(pair) {
  24732. var value = '_.' + pair[0];
  24733. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24734. details.push(value);
  24735. }
  24736. });
  24737. return details.sort();
  24738. }
  24739. /**
  24740. * Creates a clone of `wrapper`.
  24741. *
  24742. * @private
  24743. * @param {Object} wrapper The wrapper to clone.
  24744. * @returns {Object} Returns the cloned wrapper.
  24745. */
  24746. function wrapperClone(wrapper) {
  24747. if (wrapper instanceof LazyWrapper) {
  24748. return wrapper.clone();
  24749. }
  24750. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24751. result.__actions__ = copyArray(wrapper.__actions__);
  24752. result.__index__ = wrapper.__index__;
  24753. result.__values__ = wrapper.__values__;
  24754. return result;
  24755. }
  24756. /*------------------------------------------------------------------------*/
  24757. /**
  24758. * Creates an array of elements split into groups the length of `size`.
  24759. * If `array` can't be split evenly, the final chunk will be the remaining
  24760. * elements.
  24761. *
  24762. * @static
  24763. * @memberOf _
  24764. * @since 3.0.0
  24765. * @category Array
  24766. * @param {Array} array The array to process.
  24767. * @param {number} [size=1] The length of each chunk
  24768. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24769. * @returns {Array} Returns the new array of chunks.
  24770. * @example
  24771. *
  24772. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24773. * // => [['a', 'b'], ['c', 'd']]
  24774. *
  24775. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24776. * // => [['a', 'b', 'c'], ['d']]
  24777. */
  24778. function chunk(array, size, guard) {
  24779. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24780. size = 1;
  24781. } else {
  24782. size = nativeMax(toInteger(size), 0);
  24783. }
  24784. var length = array == null ? 0 : array.length;
  24785. if (!length || size < 1) {
  24786. return [];
  24787. }
  24788. var index = 0,
  24789. resIndex = 0,
  24790. result = Array(nativeCeil(length / size));
  24791. while (index < length) {
  24792. result[resIndex++] = baseSlice(array, index, (index += size));
  24793. }
  24794. return result;
  24795. }
  24796. /**
  24797. * Creates an array with all falsey values removed. The values `false`, `null`,
  24798. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24799. *
  24800. * @static
  24801. * @memberOf _
  24802. * @since 0.1.0
  24803. * @category Array
  24804. * @param {Array} array The array to compact.
  24805. * @returns {Array} Returns the new array of filtered values.
  24806. * @example
  24807. *
  24808. * _.compact([0, 1, false, 2, '', 3]);
  24809. * // => [1, 2, 3]
  24810. */
  24811. function compact(array) {
  24812. var index = -1,
  24813. length = array == null ? 0 : array.length,
  24814. resIndex = 0,
  24815. result = [];
  24816. while (++index < length) {
  24817. var value = array[index];
  24818. if (value) {
  24819. result[resIndex++] = value;
  24820. }
  24821. }
  24822. return result;
  24823. }
  24824. /**
  24825. * Creates a new array concatenating `array` with any additional arrays
  24826. * and/or values.
  24827. *
  24828. * @static
  24829. * @memberOf _
  24830. * @since 4.0.0
  24831. * @category Array
  24832. * @param {Array} array The array to concatenate.
  24833. * @param {...*} [values] The values to concatenate.
  24834. * @returns {Array} Returns the new concatenated array.
  24835. * @example
  24836. *
  24837. * var array = [1];
  24838. * var other = _.concat(array, 2, [3], [[4]]);
  24839. *
  24840. * console.log(other);
  24841. * // => [1, 2, 3, [4]]
  24842. *
  24843. * console.log(array);
  24844. * // => [1]
  24845. */
  24846. function concat() {
  24847. var length = arguments.length;
  24848. if (!length) {
  24849. return [];
  24850. }
  24851. var args = Array(length - 1),
  24852. array = arguments[0],
  24853. index = length;
  24854. while (index--) {
  24855. args[index - 1] = arguments[index];
  24856. }
  24857. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24858. }
  24859. /**
  24860. * Creates an array of `array` values not included in the other given arrays
  24861. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24862. * for equality comparisons. The order and references of result values are
  24863. * determined by the first array.
  24864. *
  24865. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24866. *
  24867. * @static
  24868. * @memberOf _
  24869. * @since 0.1.0
  24870. * @category Array
  24871. * @param {Array} array The array to inspect.
  24872. * @param {...Array} [values] The values to exclude.
  24873. * @returns {Array} Returns the new array of filtered values.
  24874. * @see _.without, _.xor
  24875. * @example
  24876. *
  24877. * _.difference([2, 1], [2, 3]);
  24878. * // => [1]
  24879. */
  24880. var difference = baseRest(function(array, values) {
  24881. return isArrayLikeObject(array)
  24882. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24883. : [];
  24884. });
  24885. /**
  24886. * This method is like `_.difference` except that it accepts `iteratee` which
  24887. * is invoked for each element of `array` and `values` to generate the criterion
  24888. * by which they're compared. The order and references of result values are
  24889. * determined by the first array. The iteratee is invoked with one argument:
  24890. * (value).
  24891. *
  24892. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24893. *
  24894. * @static
  24895. * @memberOf _
  24896. * @since 4.0.0
  24897. * @category Array
  24898. * @param {Array} array The array to inspect.
  24899. * @param {...Array} [values] The values to exclude.
  24900. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24901. * @returns {Array} Returns the new array of filtered values.
  24902. * @example
  24903. *
  24904. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24905. * // => [1.2]
  24906. *
  24907. * // The `_.property` iteratee shorthand.
  24908. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24909. * // => [{ 'x': 2 }]
  24910. */
  24911. var differenceBy = baseRest(function(array, values) {
  24912. var iteratee = last(values);
  24913. if (isArrayLikeObject(iteratee)) {
  24914. iteratee = undefined;
  24915. }
  24916. return isArrayLikeObject(array)
  24917. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24918. : [];
  24919. });
  24920. /**
  24921. * This method is like `_.difference` except that it accepts `comparator`
  24922. * which is invoked to compare elements of `array` to `values`. The order and
  24923. * references of result values are determined by the first array. The comparator
  24924. * is invoked with two arguments: (arrVal, othVal).
  24925. *
  24926. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24927. *
  24928. * @static
  24929. * @memberOf _
  24930. * @since 4.0.0
  24931. * @category Array
  24932. * @param {Array} array The array to inspect.
  24933. * @param {...Array} [values] The values to exclude.
  24934. * @param {Function} [comparator] The comparator invoked per element.
  24935. * @returns {Array} Returns the new array of filtered values.
  24936. * @example
  24937. *
  24938. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24939. *
  24940. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24941. * // => [{ 'x': 2, 'y': 1 }]
  24942. */
  24943. var differenceWith = baseRest(function(array, values) {
  24944. var comparator = last(values);
  24945. if (isArrayLikeObject(comparator)) {
  24946. comparator = undefined;
  24947. }
  24948. return isArrayLikeObject(array)
  24949. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24950. : [];
  24951. });
  24952. /**
  24953. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24954. *
  24955. * @static
  24956. * @memberOf _
  24957. * @since 0.5.0
  24958. * @category Array
  24959. * @param {Array} array The array to query.
  24960. * @param {number} [n=1] The number of elements to drop.
  24961. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24962. * @returns {Array} Returns the slice of `array`.
  24963. * @example
  24964. *
  24965. * _.drop([1, 2, 3]);
  24966. * // => [2, 3]
  24967. *
  24968. * _.drop([1, 2, 3], 2);
  24969. * // => [3]
  24970. *
  24971. * _.drop([1, 2, 3], 5);
  24972. * // => []
  24973. *
  24974. * _.drop([1, 2, 3], 0);
  24975. * // => [1, 2, 3]
  24976. */
  24977. function drop(array, n, guard) {
  24978. var length = array == null ? 0 : array.length;
  24979. if (!length) {
  24980. return [];
  24981. }
  24982. n = (guard || n === undefined) ? 1 : toInteger(n);
  24983. return baseSlice(array, n < 0 ? 0 : n, length);
  24984. }
  24985. /**
  24986. * Creates a slice of `array` with `n` elements dropped from the end.
  24987. *
  24988. * @static
  24989. * @memberOf _
  24990. * @since 3.0.0
  24991. * @category Array
  24992. * @param {Array} array The array to query.
  24993. * @param {number} [n=1] The number of elements to drop.
  24994. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24995. * @returns {Array} Returns the slice of `array`.
  24996. * @example
  24997. *
  24998. * _.dropRight([1, 2, 3]);
  24999. * // => [1, 2]
  25000. *
  25001. * _.dropRight([1, 2, 3], 2);
  25002. * // => [1]
  25003. *
  25004. * _.dropRight([1, 2, 3], 5);
  25005. * // => []
  25006. *
  25007. * _.dropRight([1, 2, 3], 0);
  25008. * // => [1, 2, 3]
  25009. */
  25010. function dropRight(array, n, guard) {
  25011. var length = array == null ? 0 : array.length;
  25012. if (!length) {
  25013. return [];
  25014. }
  25015. n = (guard || n === undefined) ? 1 : toInteger(n);
  25016. n = length - n;
  25017. return baseSlice(array, 0, n < 0 ? 0 : n);
  25018. }
  25019. /**
  25020. * Creates a slice of `array` excluding elements dropped from the end.
  25021. * Elements are dropped until `predicate` returns falsey. The predicate is
  25022. * invoked with three arguments: (value, index, array).
  25023. *
  25024. * @static
  25025. * @memberOf _
  25026. * @since 3.0.0
  25027. * @category Array
  25028. * @param {Array} array The array to query.
  25029. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25030. * @returns {Array} Returns the slice of `array`.
  25031. * @example
  25032. *
  25033. * var users = [
  25034. * { 'user': 'barney', 'active': true },
  25035. * { 'user': 'fred', 'active': false },
  25036. * { 'user': 'pebbles', 'active': false }
  25037. * ];
  25038. *
  25039. * _.dropRightWhile(users, function(o) { return !o.active; });
  25040. * // => objects for ['barney']
  25041. *
  25042. * // The `_.matches` iteratee shorthand.
  25043. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25044. * // => objects for ['barney', 'fred']
  25045. *
  25046. * // The `_.matchesProperty` iteratee shorthand.
  25047. * _.dropRightWhile(users, ['active', false]);
  25048. * // => objects for ['barney']
  25049. *
  25050. * // The `_.property` iteratee shorthand.
  25051. * _.dropRightWhile(users, 'active');
  25052. * // => objects for ['barney', 'fred', 'pebbles']
  25053. */
  25054. function dropRightWhile(array, predicate) {
  25055. return (array && array.length)
  25056. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25057. : [];
  25058. }
  25059. /**
  25060. * Creates a slice of `array` excluding elements dropped from the beginning.
  25061. * Elements are dropped until `predicate` returns falsey. The predicate is
  25062. * invoked with three arguments: (value, index, array).
  25063. *
  25064. * @static
  25065. * @memberOf _
  25066. * @since 3.0.0
  25067. * @category Array
  25068. * @param {Array} array The array to query.
  25069. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25070. * @returns {Array} Returns the slice of `array`.
  25071. * @example
  25072. *
  25073. * var users = [
  25074. * { 'user': 'barney', 'active': false },
  25075. * { 'user': 'fred', 'active': false },
  25076. * { 'user': 'pebbles', 'active': true }
  25077. * ];
  25078. *
  25079. * _.dropWhile(users, function(o) { return !o.active; });
  25080. * // => objects for ['pebbles']
  25081. *
  25082. * // The `_.matches` iteratee shorthand.
  25083. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25084. * // => objects for ['fred', 'pebbles']
  25085. *
  25086. * // The `_.matchesProperty` iteratee shorthand.
  25087. * _.dropWhile(users, ['active', false]);
  25088. * // => objects for ['pebbles']
  25089. *
  25090. * // The `_.property` iteratee shorthand.
  25091. * _.dropWhile(users, 'active');
  25092. * // => objects for ['barney', 'fred', 'pebbles']
  25093. */
  25094. function dropWhile(array, predicate) {
  25095. return (array && array.length)
  25096. ? baseWhile(array, getIteratee(predicate, 3), true)
  25097. : [];
  25098. }
  25099. /**
  25100. * Fills elements of `array` with `value` from `start` up to, but not
  25101. * including, `end`.
  25102. *
  25103. * **Note:** This method mutates `array`.
  25104. *
  25105. * @static
  25106. * @memberOf _
  25107. * @since 3.2.0
  25108. * @category Array
  25109. * @param {Array} array The array to fill.
  25110. * @param {*} value The value to fill `array` with.
  25111. * @param {number} [start=0] The start position.
  25112. * @param {number} [end=array.length] The end position.
  25113. * @returns {Array} Returns `array`.
  25114. * @example
  25115. *
  25116. * var array = [1, 2, 3];
  25117. *
  25118. * _.fill(array, 'a');
  25119. * console.log(array);
  25120. * // => ['a', 'a', 'a']
  25121. *
  25122. * _.fill(Array(3), 2);
  25123. * // => [2, 2, 2]
  25124. *
  25125. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25126. * // => [4, '*', '*', 10]
  25127. */
  25128. function fill(array, value, start, end) {
  25129. var length = array == null ? 0 : array.length;
  25130. if (!length) {
  25131. return [];
  25132. }
  25133. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25134. start = 0;
  25135. end = length;
  25136. }
  25137. return baseFill(array, value, start, end);
  25138. }
  25139. /**
  25140. * This method is like `_.find` except that it returns the index of the first
  25141. * element `predicate` returns truthy for instead of the element itself.
  25142. *
  25143. * @static
  25144. * @memberOf _
  25145. * @since 1.1.0
  25146. * @category Array
  25147. * @param {Array} array The array to inspect.
  25148. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25149. * @param {number} [fromIndex=0] The index to search from.
  25150. * @returns {number} Returns the index of the found element, else `-1`.
  25151. * @example
  25152. *
  25153. * var users = [
  25154. * { 'user': 'barney', 'active': false },
  25155. * { 'user': 'fred', 'active': false },
  25156. * { 'user': 'pebbles', 'active': true }
  25157. * ];
  25158. *
  25159. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25160. * // => 0
  25161. *
  25162. * // The `_.matches` iteratee shorthand.
  25163. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25164. * // => 1
  25165. *
  25166. * // The `_.matchesProperty` iteratee shorthand.
  25167. * _.findIndex(users, ['active', false]);
  25168. * // => 0
  25169. *
  25170. * // The `_.property` iteratee shorthand.
  25171. * _.findIndex(users, 'active');
  25172. * // => 2
  25173. */
  25174. function findIndex(array, predicate, fromIndex) {
  25175. var length = array == null ? 0 : array.length;
  25176. if (!length) {
  25177. return -1;
  25178. }
  25179. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25180. if (index < 0) {
  25181. index = nativeMax(length + index, 0);
  25182. }
  25183. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25184. }
  25185. /**
  25186. * This method is like `_.findIndex` except that it iterates over elements
  25187. * of `collection` from right to left.
  25188. *
  25189. * @static
  25190. * @memberOf _
  25191. * @since 2.0.0
  25192. * @category Array
  25193. * @param {Array} array The array to inspect.
  25194. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25195. * @param {number} [fromIndex=array.length-1] The index to search from.
  25196. * @returns {number} Returns the index of the found element, else `-1`.
  25197. * @example
  25198. *
  25199. * var users = [
  25200. * { 'user': 'barney', 'active': true },
  25201. * { 'user': 'fred', 'active': false },
  25202. * { 'user': 'pebbles', 'active': false }
  25203. * ];
  25204. *
  25205. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25206. * // => 2
  25207. *
  25208. * // The `_.matches` iteratee shorthand.
  25209. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25210. * // => 0
  25211. *
  25212. * // The `_.matchesProperty` iteratee shorthand.
  25213. * _.findLastIndex(users, ['active', false]);
  25214. * // => 2
  25215. *
  25216. * // The `_.property` iteratee shorthand.
  25217. * _.findLastIndex(users, 'active');
  25218. * // => 0
  25219. */
  25220. function findLastIndex(array, predicate, fromIndex) {
  25221. var length = array == null ? 0 : array.length;
  25222. if (!length) {
  25223. return -1;
  25224. }
  25225. var index = length - 1;
  25226. if (fromIndex !== undefined) {
  25227. index = toInteger(fromIndex);
  25228. index = fromIndex < 0
  25229. ? nativeMax(length + index, 0)
  25230. : nativeMin(index, length - 1);
  25231. }
  25232. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25233. }
  25234. /**
  25235. * Flattens `array` a single level deep.
  25236. *
  25237. * @static
  25238. * @memberOf _
  25239. * @since 0.1.0
  25240. * @category Array
  25241. * @param {Array} array The array to flatten.
  25242. * @returns {Array} Returns the new flattened array.
  25243. * @example
  25244. *
  25245. * _.flatten([1, [2, [3, [4]], 5]]);
  25246. * // => [1, 2, [3, [4]], 5]
  25247. */
  25248. function flatten(array) {
  25249. var length = array == null ? 0 : array.length;
  25250. return length ? baseFlatten(array, 1) : [];
  25251. }
  25252. /**
  25253. * Recursively flattens `array`.
  25254. *
  25255. * @static
  25256. * @memberOf _
  25257. * @since 3.0.0
  25258. * @category Array
  25259. * @param {Array} array The array to flatten.
  25260. * @returns {Array} Returns the new flattened array.
  25261. * @example
  25262. *
  25263. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25264. * // => [1, 2, 3, 4, 5]
  25265. */
  25266. function flattenDeep(array) {
  25267. var length = array == null ? 0 : array.length;
  25268. return length ? baseFlatten(array, INFINITY) : [];
  25269. }
  25270. /**
  25271. * Recursively flatten `array` up to `depth` times.
  25272. *
  25273. * @static
  25274. * @memberOf _
  25275. * @since 4.4.0
  25276. * @category Array
  25277. * @param {Array} array The array to flatten.
  25278. * @param {number} [depth=1] The maximum recursion depth.
  25279. * @returns {Array} Returns the new flattened array.
  25280. * @example
  25281. *
  25282. * var array = [1, [2, [3, [4]], 5]];
  25283. *
  25284. * _.flattenDepth(array, 1);
  25285. * // => [1, 2, [3, [4]], 5]
  25286. *
  25287. * _.flattenDepth(array, 2);
  25288. * // => [1, 2, 3, [4], 5]
  25289. */
  25290. function flattenDepth(array, depth) {
  25291. var length = array == null ? 0 : array.length;
  25292. if (!length) {
  25293. return [];
  25294. }
  25295. depth = depth === undefined ? 1 : toInteger(depth);
  25296. return baseFlatten(array, depth);
  25297. }
  25298. /**
  25299. * The inverse of `_.toPairs`; this method returns an object composed
  25300. * from key-value `pairs`.
  25301. *
  25302. * @static
  25303. * @memberOf _
  25304. * @since 4.0.0
  25305. * @category Array
  25306. * @param {Array} pairs The key-value pairs.
  25307. * @returns {Object} Returns the new object.
  25308. * @example
  25309. *
  25310. * _.fromPairs([['a', 1], ['b', 2]]);
  25311. * // => { 'a': 1, 'b': 2 }
  25312. */
  25313. function fromPairs(pairs) {
  25314. var index = -1,
  25315. length = pairs == null ? 0 : pairs.length,
  25316. result = {};
  25317. while (++index < length) {
  25318. var pair = pairs[index];
  25319. result[pair[0]] = pair[1];
  25320. }
  25321. return result;
  25322. }
  25323. /**
  25324. * Gets the first element of `array`.
  25325. *
  25326. * @static
  25327. * @memberOf _
  25328. * @since 0.1.0
  25329. * @alias first
  25330. * @category Array
  25331. * @param {Array} array The array to query.
  25332. * @returns {*} Returns the first element of `array`.
  25333. * @example
  25334. *
  25335. * _.head([1, 2, 3]);
  25336. * // => 1
  25337. *
  25338. * _.head([]);
  25339. * // => undefined
  25340. */
  25341. function head(array) {
  25342. return (array && array.length) ? array[0] : undefined;
  25343. }
  25344. /**
  25345. * Gets the index at which the first occurrence of `value` is found in `array`
  25346. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25347. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25348. * offset from the end of `array`.
  25349. *
  25350. * @static
  25351. * @memberOf _
  25352. * @since 0.1.0
  25353. * @category Array
  25354. * @param {Array} array The array to inspect.
  25355. * @param {*} value The value to search for.
  25356. * @param {number} [fromIndex=0] The index to search from.
  25357. * @returns {number} Returns the index of the matched value, else `-1`.
  25358. * @example
  25359. *
  25360. * _.indexOf([1, 2, 1, 2], 2);
  25361. * // => 1
  25362. *
  25363. * // Search from the `fromIndex`.
  25364. * _.indexOf([1, 2, 1, 2], 2, 2);
  25365. * // => 3
  25366. */
  25367. function indexOf(array, value, fromIndex) {
  25368. var length = array == null ? 0 : array.length;
  25369. if (!length) {
  25370. return -1;
  25371. }
  25372. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25373. if (index < 0) {
  25374. index = nativeMax(length + index, 0);
  25375. }
  25376. return baseIndexOf(array, value, index);
  25377. }
  25378. /**
  25379. * Gets all but the last element of `array`.
  25380. *
  25381. * @static
  25382. * @memberOf _
  25383. * @since 0.1.0
  25384. * @category Array
  25385. * @param {Array} array The array to query.
  25386. * @returns {Array} Returns the slice of `array`.
  25387. * @example
  25388. *
  25389. * _.initial([1, 2, 3]);
  25390. * // => [1, 2]
  25391. */
  25392. function initial(array) {
  25393. var length = array == null ? 0 : array.length;
  25394. return length ? baseSlice(array, 0, -1) : [];
  25395. }
  25396. /**
  25397. * Creates an array of unique values that are included in all given arrays
  25398. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25399. * for equality comparisons. The order and references of result values are
  25400. * determined by the first array.
  25401. *
  25402. * @static
  25403. * @memberOf _
  25404. * @since 0.1.0
  25405. * @category Array
  25406. * @param {...Array} [arrays] The arrays to inspect.
  25407. * @returns {Array} Returns the new array of intersecting values.
  25408. * @example
  25409. *
  25410. * _.intersection([2, 1], [2, 3]);
  25411. * // => [2]
  25412. */
  25413. var intersection = baseRest(function(arrays) {
  25414. var mapped = arrayMap(arrays, castArrayLikeObject);
  25415. return (mapped.length && mapped[0] === arrays[0])
  25416. ? baseIntersection(mapped)
  25417. : [];
  25418. });
  25419. /**
  25420. * This method is like `_.intersection` except that it accepts `iteratee`
  25421. * which is invoked for each element of each `arrays` to generate the criterion
  25422. * by which they're compared. The order and references of result values are
  25423. * determined by the first array. The iteratee is invoked with one argument:
  25424. * (value).
  25425. *
  25426. * @static
  25427. * @memberOf _
  25428. * @since 4.0.0
  25429. * @category Array
  25430. * @param {...Array} [arrays] The arrays to inspect.
  25431. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25432. * @returns {Array} Returns the new array of intersecting values.
  25433. * @example
  25434. *
  25435. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25436. * // => [2.1]
  25437. *
  25438. * // The `_.property` iteratee shorthand.
  25439. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25440. * // => [{ 'x': 1 }]
  25441. */
  25442. var intersectionBy = baseRest(function(arrays) {
  25443. var iteratee = last(arrays),
  25444. mapped = arrayMap(arrays, castArrayLikeObject);
  25445. if (iteratee === last(mapped)) {
  25446. iteratee = undefined;
  25447. } else {
  25448. mapped.pop();
  25449. }
  25450. return (mapped.length && mapped[0] === arrays[0])
  25451. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25452. : [];
  25453. });
  25454. /**
  25455. * This method is like `_.intersection` except that it accepts `comparator`
  25456. * which is invoked to compare elements of `arrays`. The order and references
  25457. * of result values are determined by the first array. The comparator is
  25458. * invoked with two arguments: (arrVal, othVal).
  25459. *
  25460. * @static
  25461. * @memberOf _
  25462. * @since 4.0.0
  25463. * @category Array
  25464. * @param {...Array} [arrays] The arrays to inspect.
  25465. * @param {Function} [comparator] The comparator invoked per element.
  25466. * @returns {Array} Returns the new array of intersecting values.
  25467. * @example
  25468. *
  25469. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25470. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25471. *
  25472. * _.intersectionWith(objects, others, _.isEqual);
  25473. * // => [{ 'x': 1, 'y': 2 }]
  25474. */
  25475. var intersectionWith = baseRest(function(arrays) {
  25476. var comparator = last(arrays),
  25477. mapped = arrayMap(arrays, castArrayLikeObject);
  25478. comparator = typeof comparator == 'function' ? comparator : undefined;
  25479. if (comparator) {
  25480. mapped.pop();
  25481. }
  25482. return (mapped.length && mapped[0] === arrays[0])
  25483. ? baseIntersection(mapped, undefined, comparator)
  25484. : [];
  25485. });
  25486. /**
  25487. * Converts all elements in `array` into a string separated by `separator`.
  25488. *
  25489. * @static
  25490. * @memberOf _
  25491. * @since 4.0.0
  25492. * @category Array
  25493. * @param {Array} array The array to convert.
  25494. * @param {string} [separator=','] The element separator.
  25495. * @returns {string} Returns the joined string.
  25496. * @example
  25497. *
  25498. * _.join(['a', 'b', 'c'], '~');
  25499. * // => 'a~b~c'
  25500. */
  25501. function join(array, separator) {
  25502. return array == null ? '' : nativeJoin.call(array, separator);
  25503. }
  25504. /**
  25505. * Gets the last element of `array`.
  25506. *
  25507. * @static
  25508. * @memberOf _
  25509. * @since 0.1.0
  25510. * @category Array
  25511. * @param {Array} array The array to query.
  25512. * @returns {*} Returns the last element of `array`.
  25513. * @example
  25514. *
  25515. * _.last([1, 2, 3]);
  25516. * // => 3
  25517. */
  25518. function last(array) {
  25519. var length = array == null ? 0 : array.length;
  25520. return length ? array[length - 1] : undefined;
  25521. }
  25522. /**
  25523. * This method is like `_.indexOf` except that it iterates over elements of
  25524. * `array` from right to left.
  25525. *
  25526. * @static
  25527. * @memberOf _
  25528. * @since 0.1.0
  25529. * @category Array
  25530. * @param {Array} array The array to inspect.
  25531. * @param {*} value The value to search for.
  25532. * @param {number} [fromIndex=array.length-1] The index to search from.
  25533. * @returns {number} Returns the index of the matched value, else `-1`.
  25534. * @example
  25535. *
  25536. * _.lastIndexOf([1, 2, 1, 2], 2);
  25537. * // => 3
  25538. *
  25539. * // Search from the `fromIndex`.
  25540. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25541. * // => 1
  25542. */
  25543. function lastIndexOf(array, value, fromIndex) {
  25544. var length = array == null ? 0 : array.length;
  25545. if (!length) {
  25546. return -1;
  25547. }
  25548. var index = length;
  25549. if (fromIndex !== undefined) {
  25550. index = toInteger(fromIndex);
  25551. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25552. }
  25553. return value === value
  25554. ? strictLastIndexOf(array, value, index)
  25555. : baseFindIndex(array, baseIsNaN, index, true);
  25556. }
  25557. /**
  25558. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25559. * element from the end is returned.
  25560. *
  25561. * @static
  25562. * @memberOf _
  25563. * @since 4.11.0
  25564. * @category Array
  25565. * @param {Array} array The array to query.
  25566. * @param {number} [n=0] The index of the element to return.
  25567. * @returns {*} Returns the nth element of `array`.
  25568. * @example
  25569. *
  25570. * var array = ['a', 'b', 'c', 'd'];
  25571. *
  25572. * _.nth(array, 1);
  25573. * // => 'b'
  25574. *
  25575. * _.nth(array, -2);
  25576. * // => 'c';
  25577. */
  25578. function nth(array, n) {
  25579. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25580. }
  25581. /**
  25582. * Removes all given values from `array` using
  25583. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25584. * for equality comparisons.
  25585. *
  25586. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25587. * to remove elements from an array by predicate.
  25588. *
  25589. * @static
  25590. * @memberOf _
  25591. * @since 2.0.0
  25592. * @category Array
  25593. * @param {Array} array The array to modify.
  25594. * @param {...*} [values] The values to remove.
  25595. * @returns {Array} Returns `array`.
  25596. * @example
  25597. *
  25598. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25599. *
  25600. * _.pull(array, 'a', 'c');
  25601. * console.log(array);
  25602. * // => ['b', 'b']
  25603. */
  25604. var pull = baseRest(pullAll);
  25605. /**
  25606. * This method is like `_.pull` except that it accepts an array of values to remove.
  25607. *
  25608. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25609. *
  25610. * @static
  25611. * @memberOf _
  25612. * @since 4.0.0
  25613. * @category Array
  25614. * @param {Array} array The array to modify.
  25615. * @param {Array} values The values to remove.
  25616. * @returns {Array} Returns `array`.
  25617. * @example
  25618. *
  25619. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25620. *
  25621. * _.pullAll(array, ['a', 'c']);
  25622. * console.log(array);
  25623. * // => ['b', 'b']
  25624. */
  25625. function pullAll(array, values) {
  25626. return (array && array.length && values && values.length)
  25627. ? basePullAll(array, values)
  25628. : array;
  25629. }
  25630. /**
  25631. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25632. * invoked for each element of `array` and `values` to generate the criterion
  25633. * by which they're compared. The iteratee is invoked with one argument: (value).
  25634. *
  25635. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25636. *
  25637. * @static
  25638. * @memberOf _
  25639. * @since 4.0.0
  25640. * @category Array
  25641. * @param {Array} array The array to modify.
  25642. * @param {Array} values The values to remove.
  25643. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25644. * @returns {Array} Returns `array`.
  25645. * @example
  25646. *
  25647. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25648. *
  25649. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25650. * console.log(array);
  25651. * // => [{ 'x': 2 }]
  25652. */
  25653. function pullAllBy(array, values, iteratee) {
  25654. return (array && array.length && values && values.length)
  25655. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25656. : array;
  25657. }
  25658. /**
  25659. * This method is like `_.pullAll` except that it accepts `comparator` which
  25660. * is invoked to compare elements of `array` to `values`. The comparator is
  25661. * invoked with two arguments: (arrVal, othVal).
  25662. *
  25663. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25664. *
  25665. * @static
  25666. * @memberOf _
  25667. * @since 4.6.0
  25668. * @category Array
  25669. * @param {Array} array The array to modify.
  25670. * @param {Array} values The values to remove.
  25671. * @param {Function} [comparator] The comparator invoked per element.
  25672. * @returns {Array} Returns `array`.
  25673. * @example
  25674. *
  25675. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25676. *
  25677. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25678. * console.log(array);
  25679. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25680. */
  25681. function pullAllWith(array, values, comparator) {
  25682. return (array && array.length && values && values.length)
  25683. ? basePullAll(array, values, undefined, comparator)
  25684. : array;
  25685. }
  25686. /**
  25687. * Removes elements from `array` corresponding to `indexes` and returns an
  25688. * array of removed elements.
  25689. *
  25690. * **Note:** Unlike `_.at`, this method mutates `array`.
  25691. *
  25692. * @static
  25693. * @memberOf _
  25694. * @since 3.0.0
  25695. * @category Array
  25696. * @param {Array} array The array to modify.
  25697. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25698. * @returns {Array} Returns the new array of removed elements.
  25699. * @example
  25700. *
  25701. * var array = ['a', 'b', 'c', 'd'];
  25702. * var pulled = _.pullAt(array, [1, 3]);
  25703. *
  25704. * console.log(array);
  25705. * // => ['a', 'c']
  25706. *
  25707. * console.log(pulled);
  25708. * // => ['b', 'd']
  25709. */
  25710. var pullAt = flatRest(function(array, indexes) {
  25711. var length = array == null ? 0 : array.length,
  25712. result = baseAt(array, indexes);
  25713. basePullAt(array, arrayMap(indexes, function(index) {
  25714. return isIndex(index, length) ? +index : index;
  25715. }).sort(compareAscending));
  25716. return result;
  25717. });
  25718. /**
  25719. * Removes all elements from `array` that `predicate` returns truthy for
  25720. * and returns an array of the removed elements. The predicate is invoked
  25721. * with three arguments: (value, index, array).
  25722. *
  25723. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25724. * to pull elements from an array by value.
  25725. *
  25726. * @static
  25727. * @memberOf _
  25728. * @since 2.0.0
  25729. * @category Array
  25730. * @param {Array} array The array to modify.
  25731. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25732. * @returns {Array} Returns the new array of removed elements.
  25733. * @example
  25734. *
  25735. * var array = [1, 2, 3, 4];
  25736. * var evens = _.remove(array, function(n) {
  25737. * return n % 2 == 0;
  25738. * });
  25739. *
  25740. * console.log(array);
  25741. * // => [1, 3]
  25742. *
  25743. * console.log(evens);
  25744. * // => [2, 4]
  25745. */
  25746. function remove(array, predicate) {
  25747. var result = [];
  25748. if (!(array && array.length)) {
  25749. return result;
  25750. }
  25751. var index = -1,
  25752. indexes = [],
  25753. length = array.length;
  25754. predicate = getIteratee(predicate, 3);
  25755. while (++index < length) {
  25756. var value = array[index];
  25757. if (predicate(value, index, array)) {
  25758. result.push(value);
  25759. indexes.push(index);
  25760. }
  25761. }
  25762. basePullAt(array, indexes);
  25763. return result;
  25764. }
  25765. /**
  25766. * Reverses `array` so that the first element becomes the last, the second
  25767. * element becomes the second to last, and so on.
  25768. *
  25769. * **Note:** This method mutates `array` and is based on
  25770. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25771. *
  25772. * @static
  25773. * @memberOf _
  25774. * @since 4.0.0
  25775. * @category Array
  25776. * @param {Array} array The array to modify.
  25777. * @returns {Array} Returns `array`.
  25778. * @example
  25779. *
  25780. * var array = [1, 2, 3];
  25781. *
  25782. * _.reverse(array);
  25783. * // => [3, 2, 1]
  25784. *
  25785. * console.log(array);
  25786. * // => [3, 2, 1]
  25787. */
  25788. function reverse(array) {
  25789. return array == null ? array : nativeReverse.call(array);
  25790. }
  25791. /**
  25792. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25793. *
  25794. * **Note:** This method is used instead of
  25795. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25796. * returned.
  25797. *
  25798. * @static
  25799. * @memberOf _
  25800. * @since 3.0.0
  25801. * @category Array
  25802. * @param {Array} array The array to slice.
  25803. * @param {number} [start=0] The start position.
  25804. * @param {number} [end=array.length] The end position.
  25805. * @returns {Array} Returns the slice of `array`.
  25806. */
  25807. function slice(array, start, end) {
  25808. var length = array == null ? 0 : array.length;
  25809. if (!length) {
  25810. return [];
  25811. }
  25812. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25813. start = 0;
  25814. end = length;
  25815. }
  25816. else {
  25817. start = start == null ? 0 : toInteger(start);
  25818. end = end === undefined ? length : toInteger(end);
  25819. }
  25820. return baseSlice(array, start, end);
  25821. }
  25822. /**
  25823. * Uses a binary search to determine the lowest index at which `value`
  25824. * should be inserted into `array` in order to maintain its sort order.
  25825. *
  25826. * @static
  25827. * @memberOf _
  25828. * @since 0.1.0
  25829. * @category Array
  25830. * @param {Array} array The sorted array to inspect.
  25831. * @param {*} value The value to evaluate.
  25832. * @returns {number} Returns the index at which `value` should be inserted
  25833. * into `array`.
  25834. * @example
  25835. *
  25836. * _.sortedIndex([30, 50], 40);
  25837. * // => 1
  25838. */
  25839. function sortedIndex(array, value) {
  25840. return baseSortedIndex(array, value);
  25841. }
  25842. /**
  25843. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25844. * which is invoked for `value` and each element of `array` to compute their
  25845. * sort ranking. The iteratee is invoked with one argument: (value).
  25846. *
  25847. * @static
  25848. * @memberOf _
  25849. * @since 4.0.0
  25850. * @category Array
  25851. * @param {Array} array The sorted array to inspect.
  25852. * @param {*} value The value to evaluate.
  25853. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25854. * @returns {number} Returns the index at which `value` should be inserted
  25855. * into `array`.
  25856. * @example
  25857. *
  25858. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25859. *
  25860. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25861. * // => 0
  25862. *
  25863. * // The `_.property` iteratee shorthand.
  25864. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25865. * // => 0
  25866. */
  25867. function sortedIndexBy(array, value, iteratee) {
  25868. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25869. }
  25870. /**
  25871. * This method is like `_.indexOf` except that it performs a binary
  25872. * search on a sorted `array`.
  25873. *
  25874. * @static
  25875. * @memberOf _
  25876. * @since 4.0.0
  25877. * @category Array
  25878. * @param {Array} array The array to inspect.
  25879. * @param {*} value The value to search for.
  25880. * @returns {number} Returns the index of the matched value, else `-1`.
  25881. * @example
  25882. *
  25883. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25884. * // => 1
  25885. */
  25886. function sortedIndexOf(array, value) {
  25887. var length = array == null ? 0 : array.length;
  25888. if (length) {
  25889. var index = baseSortedIndex(array, value);
  25890. if (index < length && eq(array[index], value)) {
  25891. return index;
  25892. }
  25893. }
  25894. return -1;
  25895. }
  25896. /**
  25897. * This method is like `_.sortedIndex` except that it returns the highest
  25898. * index at which `value` should be inserted into `array` in order to
  25899. * maintain its sort order.
  25900. *
  25901. * @static
  25902. * @memberOf _
  25903. * @since 3.0.0
  25904. * @category Array
  25905. * @param {Array} array The sorted array to inspect.
  25906. * @param {*} value The value to evaluate.
  25907. * @returns {number} Returns the index at which `value` should be inserted
  25908. * into `array`.
  25909. * @example
  25910. *
  25911. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25912. * // => 4
  25913. */
  25914. function sortedLastIndex(array, value) {
  25915. return baseSortedIndex(array, value, true);
  25916. }
  25917. /**
  25918. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25919. * which is invoked for `value` and each element of `array` to compute their
  25920. * sort ranking. The iteratee is invoked with one argument: (value).
  25921. *
  25922. * @static
  25923. * @memberOf _
  25924. * @since 4.0.0
  25925. * @category Array
  25926. * @param {Array} array The sorted array to inspect.
  25927. * @param {*} value The value to evaluate.
  25928. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25929. * @returns {number} Returns the index at which `value` should be inserted
  25930. * into `array`.
  25931. * @example
  25932. *
  25933. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25934. *
  25935. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25936. * // => 1
  25937. *
  25938. * // The `_.property` iteratee shorthand.
  25939. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25940. * // => 1
  25941. */
  25942. function sortedLastIndexBy(array, value, iteratee) {
  25943. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25944. }
  25945. /**
  25946. * This method is like `_.lastIndexOf` except that it performs a binary
  25947. * search on a sorted `array`.
  25948. *
  25949. * @static
  25950. * @memberOf _
  25951. * @since 4.0.0
  25952. * @category Array
  25953. * @param {Array} array The array to inspect.
  25954. * @param {*} value The value to search for.
  25955. * @returns {number} Returns the index of the matched value, else `-1`.
  25956. * @example
  25957. *
  25958. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25959. * // => 3
  25960. */
  25961. function sortedLastIndexOf(array, value) {
  25962. var length = array == null ? 0 : array.length;
  25963. if (length) {
  25964. var index = baseSortedIndex(array, value, true) - 1;
  25965. if (eq(array[index], value)) {
  25966. return index;
  25967. }
  25968. }
  25969. return -1;
  25970. }
  25971. /**
  25972. * This method is like `_.uniq` except that it's designed and optimized
  25973. * for sorted arrays.
  25974. *
  25975. * @static
  25976. * @memberOf _
  25977. * @since 4.0.0
  25978. * @category Array
  25979. * @param {Array} array The array to inspect.
  25980. * @returns {Array} Returns the new duplicate free array.
  25981. * @example
  25982. *
  25983. * _.sortedUniq([1, 1, 2]);
  25984. * // => [1, 2]
  25985. */
  25986. function sortedUniq(array) {
  25987. return (array && array.length)
  25988. ? baseSortedUniq(array)
  25989. : [];
  25990. }
  25991. /**
  25992. * This method is like `_.uniqBy` except that it's designed and optimized
  25993. * for sorted arrays.
  25994. *
  25995. * @static
  25996. * @memberOf _
  25997. * @since 4.0.0
  25998. * @category Array
  25999. * @param {Array} array The array to inspect.
  26000. * @param {Function} [iteratee] The iteratee invoked per element.
  26001. * @returns {Array} Returns the new duplicate free array.
  26002. * @example
  26003. *
  26004. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26005. * // => [1.1, 2.3]
  26006. */
  26007. function sortedUniqBy(array, iteratee) {
  26008. return (array && array.length)
  26009. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26010. : [];
  26011. }
  26012. /**
  26013. * Gets all but the first element of `array`.
  26014. *
  26015. * @static
  26016. * @memberOf _
  26017. * @since 4.0.0
  26018. * @category Array
  26019. * @param {Array} array The array to query.
  26020. * @returns {Array} Returns the slice of `array`.
  26021. * @example
  26022. *
  26023. * _.tail([1, 2, 3]);
  26024. * // => [2, 3]
  26025. */
  26026. function tail(array) {
  26027. var length = array == null ? 0 : array.length;
  26028. return length ? baseSlice(array, 1, length) : [];
  26029. }
  26030. /**
  26031. * Creates a slice of `array` with `n` elements taken from the beginning.
  26032. *
  26033. * @static
  26034. * @memberOf _
  26035. * @since 0.1.0
  26036. * @category Array
  26037. * @param {Array} array The array to query.
  26038. * @param {number} [n=1] The number of elements to take.
  26039. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26040. * @returns {Array} Returns the slice of `array`.
  26041. * @example
  26042. *
  26043. * _.take([1, 2, 3]);
  26044. * // => [1]
  26045. *
  26046. * _.take([1, 2, 3], 2);
  26047. * // => [1, 2]
  26048. *
  26049. * _.take([1, 2, 3], 5);
  26050. * // => [1, 2, 3]
  26051. *
  26052. * _.take([1, 2, 3], 0);
  26053. * // => []
  26054. */
  26055. function take(array, n, guard) {
  26056. if (!(array && array.length)) {
  26057. return [];
  26058. }
  26059. n = (guard || n === undefined) ? 1 : toInteger(n);
  26060. return baseSlice(array, 0, n < 0 ? 0 : n);
  26061. }
  26062. /**
  26063. * Creates a slice of `array` with `n` elements taken from the end.
  26064. *
  26065. * @static
  26066. * @memberOf _
  26067. * @since 3.0.0
  26068. * @category Array
  26069. * @param {Array} array The array to query.
  26070. * @param {number} [n=1] The number of elements to take.
  26071. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26072. * @returns {Array} Returns the slice of `array`.
  26073. * @example
  26074. *
  26075. * _.takeRight([1, 2, 3]);
  26076. * // => [3]
  26077. *
  26078. * _.takeRight([1, 2, 3], 2);
  26079. * // => [2, 3]
  26080. *
  26081. * _.takeRight([1, 2, 3], 5);
  26082. * // => [1, 2, 3]
  26083. *
  26084. * _.takeRight([1, 2, 3], 0);
  26085. * // => []
  26086. */
  26087. function takeRight(array, n, guard) {
  26088. var length = array == null ? 0 : array.length;
  26089. if (!length) {
  26090. return [];
  26091. }
  26092. n = (guard || n === undefined) ? 1 : toInteger(n);
  26093. n = length - n;
  26094. return baseSlice(array, n < 0 ? 0 : n, length);
  26095. }
  26096. /**
  26097. * Creates a slice of `array` with elements taken from the end. Elements are
  26098. * taken until `predicate` returns falsey. The predicate is invoked with
  26099. * three arguments: (value, index, array).
  26100. *
  26101. * @static
  26102. * @memberOf _
  26103. * @since 3.0.0
  26104. * @category Array
  26105. * @param {Array} array The array to query.
  26106. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26107. * @returns {Array} Returns the slice of `array`.
  26108. * @example
  26109. *
  26110. * var users = [
  26111. * { 'user': 'barney', 'active': true },
  26112. * { 'user': 'fred', 'active': false },
  26113. * { 'user': 'pebbles', 'active': false }
  26114. * ];
  26115. *
  26116. * _.takeRightWhile(users, function(o) { return !o.active; });
  26117. * // => objects for ['fred', 'pebbles']
  26118. *
  26119. * // The `_.matches` iteratee shorthand.
  26120. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26121. * // => objects for ['pebbles']
  26122. *
  26123. * // The `_.matchesProperty` iteratee shorthand.
  26124. * _.takeRightWhile(users, ['active', false]);
  26125. * // => objects for ['fred', 'pebbles']
  26126. *
  26127. * // The `_.property` iteratee shorthand.
  26128. * _.takeRightWhile(users, 'active');
  26129. * // => []
  26130. */
  26131. function takeRightWhile(array, predicate) {
  26132. return (array && array.length)
  26133. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26134. : [];
  26135. }
  26136. /**
  26137. * Creates a slice of `array` with elements taken from the beginning. Elements
  26138. * are taken until `predicate` returns falsey. The predicate is invoked with
  26139. * three arguments: (value, index, array).
  26140. *
  26141. * @static
  26142. * @memberOf _
  26143. * @since 3.0.0
  26144. * @category Array
  26145. * @param {Array} array The array to query.
  26146. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26147. * @returns {Array} Returns the slice of `array`.
  26148. * @example
  26149. *
  26150. * var users = [
  26151. * { 'user': 'barney', 'active': false },
  26152. * { 'user': 'fred', 'active': false },
  26153. * { 'user': 'pebbles', 'active': true }
  26154. * ];
  26155. *
  26156. * _.takeWhile(users, function(o) { return !o.active; });
  26157. * // => objects for ['barney', 'fred']
  26158. *
  26159. * // The `_.matches` iteratee shorthand.
  26160. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26161. * // => objects for ['barney']
  26162. *
  26163. * // The `_.matchesProperty` iteratee shorthand.
  26164. * _.takeWhile(users, ['active', false]);
  26165. * // => objects for ['barney', 'fred']
  26166. *
  26167. * // The `_.property` iteratee shorthand.
  26168. * _.takeWhile(users, 'active');
  26169. * // => []
  26170. */
  26171. function takeWhile(array, predicate) {
  26172. return (array && array.length)
  26173. ? baseWhile(array, getIteratee(predicate, 3))
  26174. : [];
  26175. }
  26176. /**
  26177. * Creates an array of unique values, in order, from all given arrays using
  26178. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26179. * for equality comparisons.
  26180. *
  26181. * @static
  26182. * @memberOf _
  26183. * @since 0.1.0
  26184. * @category Array
  26185. * @param {...Array} [arrays] The arrays to inspect.
  26186. * @returns {Array} Returns the new array of combined values.
  26187. * @example
  26188. *
  26189. * _.union([2], [1, 2]);
  26190. * // => [2, 1]
  26191. */
  26192. var union = baseRest(function(arrays) {
  26193. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26194. });
  26195. /**
  26196. * This method is like `_.union` except that it accepts `iteratee` which is
  26197. * invoked for each element of each `arrays` to generate the criterion by
  26198. * which uniqueness is computed. Result values are chosen from the first
  26199. * array in which the value occurs. The iteratee is invoked with one argument:
  26200. * (value).
  26201. *
  26202. * @static
  26203. * @memberOf _
  26204. * @since 4.0.0
  26205. * @category Array
  26206. * @param {...Array} [arrays] The arrays to inspect.
  26207. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26208. * @returns {Array} Returns the new array of combined values.
  26209. * @example
  26210. *
  26211. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26212. * // => [2.1, 1.2]
  26213. *
  26214. * // The `_.property` iteratee shorthand.
  26215. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26216. * // => [{ 'x': 1 }, { 'x': 2 }]
  26217. */
  26218. var unionBy = baseRest(function(arrays) {
  26219. var iteratee = last(arrays);
  26220. if (isArrayLikeObject(iteratee)) {
  26221. iteratee = undefined;
  26222. }
  26223. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26224. });
  26225. /**
  26226. * This method is like `_.union` except that it accepts `comparator` which
  26227. * is invoked to compare elements of `arrays`. Result values are chosen from
  26228. * the first array in which the value occurs. The comparator is invoked
  26229. * with two arguments: (arrVal, othVal).
  26230. *
  26231. * @static
  26232. * @memberOf _
  26233. * @since 4.0.0
  26234. * @category Array
  26235. * @param {...Array} [arrays] The arrays to inspect.
  26236. * @param {Function} [comparator] The comparator invoked per element.
  26237. * @returns {Array} Returns the new array of combined values.
  26238. * @example
  26239. *
  26240. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26241. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26242. *
  26243. * _.unionWith(objects, others, _.isEqual);
  26244. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26245. */
  26246. var unionWith = baseRest(function(arrays) {
  26247. var comparator = last(arrays);
  26248. comparator = typeof comparator == 'function' ? comparator : undefined;
  26249. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26250. });
  26251. /**
  26252. * Creates a duplicate-free version of an array, using
  26253. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26254. * for equality comparisons, in which only the first occurrence of each element
  26255. * is kept. The order of result values is determined by the order they occur
  26256. * in the array.
  26257. *
  26258. * @static
  26259. * @memberOf _
  26260. * @since 0.1.0
  26261. * @category Array
  26262. * @param {Array} array The array to inspect.
  26263. * @returns {Array} Returns the new duplicate free array.
  26264. * @example
  26265. *
  26266. * _.uniq([2, 1, 2]);
  26267. * // => [2, 1]
  26268. */
  26269. function uniq(array) {
  26270. return (array && array.length) ? baseUniq(array) : [];
  26271. }
  26272. /**
  26273. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26274. * invoked for each element in `array` to generate the criterion by which
  26275. * uniqueness is computed. The order of result values is determined by the
  26276. * order they occur in the array. The iteratee is invoked with one argument:
  26277. * (value).
  26278. *
  26279. * @static
  26280. * @memberOf _
  26281. * @since 4.0.0
  26282. * @category Array
  26283. * @param {Array} array The array to inspect.
  26284. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26285. * @returns {Array} Returns the new duplicate free array.
  26286. * @example
  26287. *
  26288. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26289. * // => [2.1, 1.2]
  26290. *
  26291. * // The `_.property` iteratee shorthand.
  26292. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26293. * // => [{ 'x': 1 }, { 'x': 2 }]
  26294. */
  26295. function uniqBy(array, iteratee) {
  26296. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26297. }
  26298. /**
  26299. * This method is like `_.uniq` except that it accepts `comparator` which
  26300. * is invoked to compare elements of `array`. The order of result values is
  26301. * determined by the order they occur in the array.The comparator is invoked
  26302. * with two arguments: (arrVal, othVal).
  26303. *
  26304. * @static
  26305. * @memberOf _
  26306. * @since 4.0.0
  26307. * @category Array
  26308. * @param {Array} array The array to inspect.
  26309. * @param {Function} [comparator] The comparator invoked per element.
  26310. * @returns {Array} Returns the new duplicate free array.
  26311. * @example
  26312. *
  26313. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26314. *
  26315. * _.uniqWith(objects, _.isEqual);
  26316. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26317. */
  26318. function uniqWith(array, comparator) {
  26319. comparator = typeof comparator == 'function' ? comparator : undefined;
  26320. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26321. }
  26322. /**
  26323. * This method is like `_.zip` except that it accepts an array of grouped
  26324. * elements and creates an array regrouping the elements to their pre-zip
  26325. * configuration.
  26326. *
  26327. * @static
  26328. * @memberOf _
  26329. * @since 1.2.0
  26330. * @category Array
  26331. * @param {Array} array The array of grouped elements to process.
  26332. * @returns {Array} Returns the new array of regrouped elements.
  26333. * @example
  26334. *
  26335. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26336. * // => [['a', 1, true], ['b', 2, false]]
  26337. *
  26338. * _.unzip(zipped);
  26339. * // => [['a', 'b'], [1, 2], [true, false]]
  26340. */
  26341. function unzip(array) {
  26342. if (!(array && array.length)) {
  26343. return [];
  26344. }
  26345. var length = 0;
  26346. array = arrayFilter(array, function(group) {
  26347. if (isArrayLikeObject(group)) {
  26348. length = nativeMax(group.length, length);
  26349. return true;
  26350. }
  26351. });
  26352. return baseTimes(length, function(index) {
  26353. return arrayMap(array, baseProperty(index));
  26354. });
  26355. }
  26356. /**
  26357. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26358. * how regrouped values should be combined. The iteratee is invoked with the
  26359. * elements of each group: (...group).
  26360. *
  26361. * @static
  26362. * @memberOf _
  26363. * @since 3.8.0
  26364. * @category Array
  26365. * @param {Array} array The array of grouped elements to process.
  26366. * @param {Function} [iteratee=_.identity] The function to combine
  26367. * regrouped values.
  26368. * @returns {Array} Returns the new array of regrouped elements.
  26369. * @example
  26370. *
  26371. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26372. * // => [[1, 10, 100], [2, 20, 200]]
  26373. *
  26374. * _.unzipWith(zipped, _.add);
  26375. * // => [3, 30, 300]
  26376. */
  26377. function unzipWith(array, iteratee) {
  26378. if (!(array && array.length)) {
  26379. return [];
  26380. }
  26381. var result = unzip(array);
  26382. if (iteratee == null) {
  26383. return result;
  26384. }
  26385. return arrayMap(result, function(group) {
  26386. return apply(iteratee, undefined, group);
  26387. });
  26388. }
  26389. /**
  26390. * Creates an array excluding all given values using
  26391. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26392. * for equality comparisons.
  26393. *
  26394. * **Note:** Unlike `_.pull`, this method returns a new array.
  26395. *
  26396. * @static
  26397. * @memberOf _
  26398. * @since 0.1.0
  26399. * @category Array
  26400. * @param {Array} array The array to inspect.
  26401. * @param {...*} [values] The values to exclude.
  26402. * @returns {Array} Returns the new array of filtered values.
  26403. * @see _.difference, _.xor
  26404. * @example
  26405. *
  26406. * _.without([2, 1, 2, 3], 1, 2);
  26407. * // => [3]
  26408. */
  26409. var without = baseRest(function(array, values) {
  26410. return isArrayLikeObject(array)
  26411. ? baseDifference(array, values)
  26412. : [];
  26413. });
  26414. /**
  26415. * Creates an array of unique values that is the
  26416. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26417. * of the given arrays. The order of result values is determined by the order
  26418. * they occur in the arrays.
  26419. *
  26420. * @static
  26421. * @memberOf _
  26422. * @since 2.4.0
  26423. * @category Array
  26424. * @param {...Array} [arrays] The arrays to inspect.
  26425. * @returns {Array} Returns the new array of filtered values.
  26426. * @see _.difference, _.without
  26427. * @example
  26428. *
  26429. * _.xor([2, 1], [2, 3]);
  26430. * // => [1, 3]
  26431. */
  26432. var xor = baseRest(function(arrays) {
  26433. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26434. });
  26435. /**
  26436. * This method is like `_.xor` except that it accepts `iteratee` which is
  26437. * invoked for each element of each `arrays` to generate the criterion by
  26438. * which by which they're compared. The order of result values is determined
  26439. * by the order they occur in the arrays. The iteratee is invoked with one
  26440. * argument: (value).
  26441. *
  26442. * @static
  26443. * @memberOf _
  26444. * @since 4.0.0
  26445. * @category Array
  26446. * @param {...Array} [arrays] The arrays to inspect.
  26447. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26448. * @returns {Array} Returns the new array of filtered values.
  26449. * @example
  26450. *
  26451. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26452. * // => [1.2, 3.4]
  26453. *
  26454. * // The `_.property` iteratee shorthand.
  26455. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26456. * // => [{ 'x': 2 }]
  26457. */
  26458. var xorBy = baseRest(function(arrays) {
  26459. var iteratee = last(arrays);
  26460. if (isArrayLikeObject(iteratee)) {
  26461. iteratee = undefined;
  26462. }
  26463. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26464. });
  26465. /**
  26466. * This method is like `_.xor` except that it accepts `comparator` which is
  26467. * invoked to compare elements of `arrays`. The order of result values is
  26468. * determined by the order they occur in the arrays. The comparator is invoked
  26469. * with two arguments: (arrVal, othVal).
  26470. *
  26471. * @static
  26472. * @memberOf _
  26473. * @since 4.0.0
  26474. * @category Array
  26475. * @param {...Array} [arrays] The arrays to inspect.
  26476. * @param {Function} [comparator] The comparator invoked per element.
  26477. * @returns {Array} Returns the new array of filtered values.
  26478. * @example
  26479. *
  26480. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26481. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26482. *
  26483. * _.xorWith(objects, others, _.isEqual);
  26484. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26485. */
  26486. var xorWith = baseRest(function(arrays) {
  26487. var comparator = last(arrays);
  26488. comparator = typeof comparator == 'function' ? comparator : undefined;
  26489. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26490. });
  26491. /**
  26492. * Creates an array of grouped elements, the first of which contains the
  26493. * first elements of the given arrays, the second of which contains the
  26494. * second elements of the given arrays, and so on.
  26495. *
  26496. * @static
  26497. * @memberOf _
  26498. * @since 0.1.0
  26499. * @category Array
  26500. * @param {...Array} [arrays] The arrays to process.
  26501. * @returns {Array} Returns the new array of grouped elements.
  26502. * @example
  26503. *
  26504. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26505. * // => [['a', 1, true], ['b', 2, false]]
  26506. */
  26507. var zip = baseRest(unzip);
  26508. /**
  26509. * This method is like `_.fromPairs` except that it accepts two arrays,
  26510. * one of property identifiers and one of corresponding values.
  26511. *
  26512. * @static
  26513. * @memberOf _
  26514. * @since 0.4.0
  26515. * @category Array
  26516. * @param {Array} [props=[]] The property identifiers.
  26517. * @param {Array} [values=[]] The property values.
  26518. * @returns {Object} Returns the new object.
  26519. * @example
  26520. *
  26521. * _.zipObject(['a', 'b'], [1, 2]);
  26522. * // => { 'a': 1, 'b': 2 }
  26523. */
  26524. function zipObject(props, values) {
  26525. return baseZipObject(props || [], values || [], assignValue);
  26526. }
  26527. /**
  26528. * This method is like `_.zipObject` except that it supports property paths.
  26529. *
  26530. * @static
  26531. * @memberOf _
  26532. * @since 4.1.0
  26533. * @category Array
  26534. * @param {Array} [props=[]] The property identifiers.
  26535. * @param {Array} [values=[]] The property values.
  26536. * @returns {Object} Returns the new object.
  26537. * @example
  26538. *
  26539. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26540. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26541. */
  26542. function zipObjectDeep(props, values) {
  26543. return baseZipObject(props || [], values || [], baseSet);
  26544. }
  26545. /**
  26546. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26547. * how grouped values should be combined. The iteratee is invoked with the
  26548. * elements of each group: (...group).
  26549. *
  26550. * @static
  26551. * @memberOf _
  26552. * @since 3.8.0
  26553. * @category Array
  26554. * @param {...Array} [arrays] The arrays to process.
  26555. * @param {Function} [iteratee=_.identity] The function to combine
  26556. * grouped values.
  26557. * @returns {Array} Returns the new array of grouped elements.
  26558. * @example
  26559. *
  26560. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26561. * return a + b + c;
  26562. * });
  26563. * // => [111, 222]
  26564. */
  26565. var zipWith = baseRest(function(arrays) {
  26566. var length = arrays.length,
  26567. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26568. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26569. return unzipWith(arrays, iteratee);
  26570. });
  26571. /*------------------------------------------------------------------------*/
  26572. /**
  26573. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26574. * chain sequences enabled. The result of such sequences must be unwrapped
  26575. * with `_#value`.
  26576. *
  26577. * @static
  26578. * @memberOf _
  26579. * @since 1.3.0
  26580. * @category Seq
  26581. * @param {*} value The value to wrap.
  26582. * @returns {Object} Returns the new `lodash` wrapper instance.
  26583. * @example
  26584. *
  26585. * var users = [
  26586. * { 'user': 'barney', 'age': 36 },
  26587. * { 'user': 'fred', 'age': 40 },
  26588. * { 'user': 'pebbles', 'age': 1 }
  26589. * ];
  26590. *
  26591. * var youngest = _
  26592. * .chain(users)
  26593. * .sortBy('age')
  26594. * .map(function(o) {
  26595. * return o.user + ' is ' + o.age;
  26596. * })
  26597. * .head()
  26598. * .value();
  26599. * // => 'pebbles is 1'
  26600. */
  26601. function chain(value) {
  26602. var result = lodash(value);
  26603. result.__chain__ = true;
  26604. return result;
  26605. }
  26606. /**
  26607. * This method invokes `interceptor` and returns `value`. The interceptor
  26608. * is invoked with one argument; (value). The purpose of this method is to
  26609. * "tap into" a method chain sequence in order to modify intermediate results.
  26610. *
  26611. * @static
  26612. * @memberOf _
  26613. * @since 0.1.0
  26614. * @category Seq
  26615. * @param {*} value The value to provide to `interceptor`.
  26616. * @param {Function} interceptor The function to invoke.
  26617. * @returns {*} Returns `value`.
  26618. * @example
  26619. *
  26620. * _([1, 2, 3])
  26621. * .tap(function(array) {
  26622. * // Mutate input array.
  26623. * array.pop();
  26624. * })
  26625. * .reverse()
  26626. * .value();
  26627. * // => [2, 1]
  26628. */
  26629. function tap(value, interceptor) {
  26630. interceptor(value);
  26631. return value;
  26632. }
  26633. /**
  26634. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26635. * The purpose of this method is to "pass thru" values replacing intermediate
  26636. * results in a method chain sequence.
  26637. *
  26638. * @static
  26639. * @memberOf _
  26640. * @since 3.0.0
  26641. * @category Seq
  26642. * @param {*} value The value to provide to `interceptor`.
  26643. * @param {Function} interceptor The function to invoke.
  26644. * @returns {*} Returns the result of `interceptor`.
  26645. * @example
  26646. *
  26647. * _(' abc ')
  26648. * .chain()
  26649. * .trim()
  26650. * .thru(function(value) {
  26651. * return [value];
  26652. * })
  26653. * .value();
  26654. * // => ['abc']
  26655. */
  26656. function thru(value, interceptor) {
  26657. return interceptor(value);
  26658. }
  26659. /**
  26660. * This method is the wrapper version of `_.at`.
  26661. *
  26662. * @name at
  26663. * @memberOf _
  26664. * @since 1.0.0
  26665. * @category Seq
  26666. * @param {...(string|string[])} [paths] The property paths to pick.
  26667. * @returns {Object} Returns the new `lodash` wrapper instance.
  26668. * @example
  26669. *
  26670. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26671. *
  26672. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26673. * // => [3, 4]
  26674. */
  26675. var wrapperAt = flatRest(function(paths) {
  26676. var length = paths.length,
  26677. start = length ? paths[0] : 0,
  26678. value = this.__wrapped__,
  26679. interceptor = function(object) { return baseAt(object, paths); };
  26680. if (length > 1 || this.__actions__.length ||
  26681. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26682. return this.thru(interceptor);
  26683. }
  26684. value = value.slice(start, +start + (length ? 1 : 0));
  26685. value.__actions__.push({
  26686. 'func': thru,
  26687. 'args': [interceptor],
  26688. 'thisArg': undefined
  26689. });
  26690. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26691. if (length && !array.length) {
  26692. array.push(undefined);
  26693. }
  26694. return array;
  26695. });
  26696. });
  26697. /**
  26698. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26699. *
  26700. * @name chain
  26701. * @memberOf _
  26702. * @since 0.1.0
  26703. * @category Seq
  26704. * @returns {Object} Returns the new `lodash` wrapper instance.
  26705. * @example
  26706. *
  26707. * var users = [
  26708. * { 'user': 'barney', 'age': 36 },
  26709. * { 'user': 'fred', 'age': 40 }
  26710. * ];
  26711. *
  26712. * // A sequence without explicit chaining.
  26713. * _(users).head();
  26714. * // => { 'user': 'barney', 'age': 36 }
  26715. *
  26716. * // A sequence with explicit chaining.
  26717. * _(users)
  26718. * .chain()
  26719. * .head()
  26720. * .pick('user')
  26721. * .value();
  26722. * // => { 'user': 'barney' }
  26723. */
  26724. function wrapperChain() {
  26725. return chain(this);
  26726. }
  26727. /**
  26728. * Executes the chain sequence and returns the wrapped result.
  26729. *
  26730. * @name commit
  26731. * @memberOf _
  26732. * @since 3.2.0
  26733. * @category Seq
  26734. * @returns {Object} Returns the new `lodash` wrapper instance.
  26735. * @example
  26736. *
  26737. * var array = [1, 2];
  26738. * var wrapped = _(array).push(3);
  26739. *
  26740. * console.log(array);
  26741. * // => [1, 2]
  26742. *
  26743. * wrapped = wrapped.commit();
  26744. * console.log(array);
  26745. * // => [1, 2, 3]
  26746. *
  26747. * wrapped.last();
  26748. * // => 3
  26749. *
  26750. * console.log(array);
  26751. * // => [1, 2, 3]
  26752. */
  26753. function wrapperCommit() {
  26754. return new LodashWrapper(this.value(), this.__chain__);
  26755. }
  26756. /**
  26757. * Gets the next value on a wrapped object following the
  26758. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26759. *
  26760. * @name next
  26761. * @memberOf _
  26762. * @since 4.0.0
  26763. * @category Seq
  26764. * @returns {Object} Returns the next iterator value.
  26765. * @example
  26766. *
  26767. * var wrapped = _([1, 2]);
  26768. *
  26769. * wrapped.next();
  26770. * // => { 'done': false, 'value': 1 }
  26771. *
  26772. * wrapped.next();
  26773. * // => { 'done': false, 'value': 2 }
  26774. *
  26775. * wrapped.next();
  26776. * // => { 'done': true, 'value': undefined }
  26777. */
  26778. function wrapperNext() {
  26779. if (this.__values__ === undefined) {
  26780. this.__values__ = toArray(this.value());
  26781. }
  26782. var done = this.__index__ >= this.__values__.length,
  26783. value = done ? undefined : this.__values__[this.__index__++];
  26784. return { 'done': done, 'value': value };
  26785. }
  26786. /**
  26787. * Enables the wrapper to be iterable.
  26788. *
  26789. * @name Symbol.iterator
  26790. * @memberOf _
  26791. * @since 4.0.0
  26792. * @category Seq
  26793. * @returns {Object} Returns the wrapper object.
  26794. * @example
  26795. *
  26796. * var wrapped = _([1, 2]);
  26797. *
  26798. * wrapped[Symbol.iterator]() === wrapped;
  26799. * // => true
  26800. *
  26801. * Array.from(wrapped);
  26802. * // => [1, 2]
  26803. */
  26804. function wrapperToIterator() {
  26805. return this;
  26806. }
  26807. /**
  26808. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26809. *
  26810. * @name plant
  26811. * @memberOf _
  26812. * @since 3.2.0
  26813. * @category Seq
  26814. * @param {*} value The value to plant.
  26815. * @returns {Object} Returns the new `lodash` wrapper instance.
  26816. * @example
  26817. *
  26818. * function square(n) {
  26819. * return n * n;
  26820. * }
  26821. *
  26822. * var wrapped = _([1, 2]).map(square);
  26823. * var other = wrapped.plant([3, 4]);
  26824. *
  26825. * other.value();
  26826. * // => [9, 16]
  26827. *
  26828. * wrapped.value();
  26829. * // => [1, 4]
  26830. */
  26831. function wrapperPlant(value) {
  26832. var result,
  26833. parent = this;
  26834. while (parent instanceof baseLodash) {
  26835. var clone = wrapperClone(parent);
  26836. clone.__index__ = 0;
  26837. clone.__values__ = undefined;
  26838. if (result) {
  26839. previous.__wrapped__ = clone;
  26840. } else {
  26841. result = clone;
  26842. }
  26843. var previous = clone;
  26844. parent = parent.__wrapped__;
  26845. }
  26846. previous.__wrapped__ = value;
  26847. return result;
  26848. }
  26849. /**
  26850. * This method is the wrapper version of `_.reverse`.
  26851. *
  26852. * **Note:** This method mutates the wrapped array.
  26853. *
  26854. * @name reverse
  26855. * @memberOf _
  26856. * @since 0.1.0
  26857. * @category Seq
  26858. * @returns {Object} Returns the new `lodash` wrapper instance.
  26859. * @example
  26860. *
  26861. * var array = [1, 2, 3];
  26862. *
  26863. * _(array).reverse().value()
  26864. * // => [3, 2, 1]
  26865. *
  26866. * console.log(array);
  26867. * // => [3, 2, 1]
  26868. */
  26869. function wrapperReverse() {
  26870. var value = this.__wrapped__;
  26871. if (value instanceof LazyWrapper) {
  26872. var wrapped = value;
  26873. if (this.__actions__.length) {
  26874. wrapped = new LazyWrapper(this);
  26875. }
  26876. wrapped = wrapped.reverse();
  26877. wrapped.__actions__.push({
  26878. 'func': thru,
  26879. 'args': [reverse],
  26880. 'thisArg': undefined
  26881. });
  26882. return new LodashWrapper(wrapped, this.__chain__);
  26883. }
  26884. return this.thru(reverse);
  26885. }
  26886. /**
  26887. * Executes the chain sequence to resolve the unwrapped value.
  26888. *
  26889. * @name value
  26890. * @memberOf _
  26891. * @since 0.1.0
  26892. * @alias toJSON, valueOf
  26893. * @category Seq
  26894. * @returns {*} Returns the resolved unwrapped value.
  26895. * @example
  26896. *
  26897. * _([1, 2, 3]).value();
  26898. * // => [1, 2, 3]
  26899. */
  26900. function wrapperValue() {
  26901. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26902. }
  26903. /*------------------------------------------------------------------------*/
  26904. /**
  26905. * Creates an object composed of keys generated from the results of running
  26906. * each element of `collection` thru `iteratee`. The corresponding value of
  26907. * each key is the number of times the key was returned by `iteratee`. The
  26908. * iteratee is invoked with one argument: (value).
  26909. *
  26910. * @static
  26911. * @memberOf _
  26912. * @since 0.5.0
  26913. * @category Collection
  26914. * @param {Array|Object} collection The collection to iterate over.
  26915. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26916. * @returns {Object} Returns the composed aggregate object.
  26917. * @example
  26918. *
  26919. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26920. * // => { '4': 1, '6': 2 }
  26921. *
  26922. * // The `_.property` iteratee shorthand.
  26923. * _.countBy(['one', 'two', 'three'], 'length');
  26924. * // => { '3': 2, '5': 1 }
  26925. */
  26926. var countBy = createAggregator(function(result, value, key) {
  26927. if (hasOwnProperty.call(result, key)) {
  26928. ++result[key];
  26929. } else {
  26930. baseAssignValue(result, key, 1);
  26931. }
  26932. });
  26933. /**
  26934. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26935. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26936. * invoked with three arguments: (value, index|key, collection).
  26937. *
  26938. * **Note:** This method returns `true` for
  26939. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26940. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26941. * elements of empty collections.
  26942. *
  26943. * @static
  26944. * @memberOf _
  26945. * @since 0.1.0
  26946. * @category Collection
  26947. * @param {Array|Object} collection The collection to iterate over.
  26948. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26949. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26950. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26951. * else `false`.
  26952. * @example
  26953. *
  26954. * _.every([true, 1, null, 'yes'], Boolean);
  26955. * // => false
  26956. *
  26957. * var users = [
  26958. * { 'user': 'barney', 'age': 36, 'active': false },
  26959. * { 'user': 'fred', 'age': 40, 'active': false }
  26960. * ];
  26961. *
  26962. * // The `_.matches` iteratee shorthand.
  26963. * _.every(users, { 'user': 'barney', 'active': false });
  26964. * // => false
  26965. *
  26966. * // The `_.matchesProperty` iteratee shorthand.
  26967. * _.every(users, ['active', false]);
  26968. * // => true
  26969. *
  26970. * // The `_.property` iteratee shorthand.
  26971. * _.every(users, 'active');
  26972. * // => false
  26973. */
  26974. function every(collection, predicate, guard) {
  26975. var func = isArray(collection) ? arrayEvery : baseEvery;
  26976. if (guard && isIterateeCall(collection, predicate, guard)) {
  26977. predicate = undefined;
  26978. }
  26979. return func(collection, getIteratee(predicate, 3));
  26980. }
  26981. /**
  26982. * Iterates over elements of `collection`, returning an array of all elements
  26983. * `predicate` returns truthy for. The predicate is invoked with three
  26984. * arguments: (value, index|key, collection).
  26985. *
  26986. * **Note:** Unlike `_.remove`, this method returns a new array.
  26987. *
  26988. * @static
  26989. * @memberOf _
  26990. * @since 0.1.0
  26991. * @category Collection
  26992. * @param {Array|Object} collection The collection to iterate over.
  26993. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26994. * @returns {Array} Returns the new filtered array.
  26995. * @see _.reject
  26996. * @example
  26997. *
  26998. * var users = [
  26999. * { 'user': 'barney', 'age': 36, 'active': true },
  27000. * { 'user': 'fred', 'age': 40, 'active': false }
  27001. * ];
  27002. *
  27003. * _.filter(users, function(o) { return !o.active; });
  27004. * // => objects for ['fred']
  27005. *
  27006. * // The `_.matches` iteratee shorthand.
  27007. * _.filter(users, { 'age': 36, 'active': true });
  27008. * // => objects for ['barney']
  27009. *
  27010. * // The `_.matchesProperty` iteratee shorthand.
  27011. * _.filter(users, ['active', false]);
  27012. * // => objects for ['fred']
  27013. *
  27014. * // The `_.property` iteratee shorthand.
  27015. * _.filter(users, 'active');
  27016. * // => objects for ['barney']
  27017. */
  27018. function filter(collection, predicate) {
  27019. var func = isArray(collection) ? arrayFilter : baseFilter;
  27020. return func(collection, getIteratee(predicate, 3));
  27021. }
  27022. /**
  27023. * Iterates over elements of `collection`, returning the first element
  27024. * `predicate` returns truthy for. The predicate is invoked with three
  27025. * arguments: (value, index|key, collection).
  27026. *
  27027. * @static
  27028. * @memberOf _
  27029. * @since 0.1.0
  27030. * @category Collection
  27031. * @param {Array|Object} collection The collection to inspect.
  27032. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27033. * @param {number} [fromIndex=0] The index to search from.
  27034. * @returns {*} Returns the matched element, else `undefined`.
  27035. * @example
  27036. *
  27037. * var users = [
  27038. * { 'user': 'barney', 'age': 36, 'active': true },
  27039. * { 'user': 'fred', 'age': 40, 'active': false },
  27040. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27041. * ];
  27042. *
  27043. * _.find(users, function(o) { return o.age < 40; });
  27044. * // => object for 'barney'
  27045. *
  27046. * // The `_.matches` iteratee shorthand.
  27047. * _.find(users, { 'age': 1, 'active': true });
  27048. * // => object for 'pebbles'
  27049. *
  27050. * // The `_.matchesProperty` iteratee shorthand.
  27051. * _.find(users, ['active', false]);
  27052. * // => object for 'fred'
  27053. *
  27054. * // The `_.property` iteratee shorthand.
  27055. * _.find(users, 'active');
  27056. * // => object for 'barney'
  27057. */
  27058. var find = createFind(findIndex);
  27059. /**
  27060. * This method is like `_.find` except that it iterates over elements of
  27061. * `collection` from right to left.
  27062. *
  27063. * @static
  27064. * @memberOf _
  27065. * @since 2.0.0
  27066. * @category Collection
  27067. * @param {Array|Object} collection The collection to inspect.
  27068. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27069. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27070. * @returns {*} Returns the matched element, else `undefined`.
  27071. * @example
  27072. *
  27073. * _.findLast([1, 2, 3, 4], function(n) {
  27074. * return n % 2 == 1;
  27075. * });
  27076. * // => 3
  27077. */
  27078. var findLast = createFind(findLastIndex);
  27079. /**
  27080. * Creates a flattened array of values by running each element in `collection`
  27081. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27082. * with three arguments: (value, index|key, collection).
  27083. *
  27084. * @static
  27085. * @memberOf _
  27086. * @since 4.0.0
  27087. * @category Collection
  27088. * @param {Array|Object} collection The collection to iterate over.
  27089. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27090. * @returns {Array} Returns the new flattened array.
  27091. * @example
  27092. *
  27093. * function duplicate(n) {
  27094. * return [n, n];
  27095. * }
  27096. *
  27097. * _.flatMap([1, 2], duplicate);
  27098. * // => [1, 1, 2, 2]
  27099. */
  27100. function flatMap(collection, iteratee) {
  27101. return baseFlatten(map(collection, iteratee), 1);
  27102. }
  27103. /**
  27104. * This method is like `_.flatMap` except that it recursively flattens the
  27105. * mapped results.
  27106. *
  27107. * @static
  27108. * @memberOf _
  27109. * @since 4.7.0
  27110. * @category Collection
  27111. * @param {Array|Object} collection The collection to iterate over.
  27112. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27113. * @returns {Array} Returns the new flattened array.
  27114. * @example
  27115. *
  27116. * function duplicate(n) {
  27117. * return [[[n, n]]];
  27118. * }
  27119. *
  27120. * _.flatMapDeep([1, 2], duplicate);
  27121. * // => [1, 1, 2, 2]
  27122. */
  27123. function flatMapDeep(collection, iteratee) {
  27124. return baseFlatten(map(collection, iteratee), INFINITY);
  27125. }
  27126. /**
  27127. * This method is like `_.flatMap` except that it recursively flattens the
  27128. * mapped results up to `depth` times.
  27129. *
  27130. * @static
  27131. * @memberOf _
  27132. * @since 4.7.0
  27133. * @category Collection
  27134. * @param {Array|Object} collection The collection to iterate over.
  27135. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27136. * @param {number} [depth=1] The maximum recursion depth.
  27137. * @returns {Array} Returns the new flattened array.
  27138. * @example
  27139. *
  27140. * function duplicate(n) {
  27141. * return [[[n, n]]];
  27142. * }
  27143. *
  27144. * _.flatMapDepth([1, 2], duplicate, 2);
  27145. * // => [[1, 1], [2, 2]]
  27146. */
  27147. function flatMapDepth(collection, iteratee, depth) {
  27148. depth = depth === undefined ? 1 : toInteger(depth);
  27149. return baseFlatten(map(collection, iteratee), depth);
  27150. }
  27151. /**
  27152. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27153. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27154. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27155. *
  27156. * **Note:** As with other "Collections" methods, objects with a "length"
  27157. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27158. * or `_.forOwn` for object iteration.
  27159. *
  27160. * @static
  27161. * @memberOf _
  27162. * @since 0.1.0
  27163. * @alias each
  27164. * @category Collection
  27165. * @param {Array|Object} collection The collection to iterate over.
  27166. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27167. * @returns {Array|Object} Returns `collection`.
  27168. * @see _.forEachRight
  27169. * @example
  27170. *
  27171. * _.forEach([1, 2], function(value) {
  27172. * console.log(value);
  27173. * });
  27174. * // => Logs `1` then `2`.
  27175. *
  27176. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27177. * console.log(key);
  27178. * });
  27179. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27180. */
  27181. function forEach(collection, iteratee) {
  27182. var func = isArray(collection) ? arrayEach : baseEach;
  27183. return func(collection, getIteratee(iteratee, 3));
  27184. }
  27185. /**
  27186. * This method is like `_.forEach` except that it iterates over elements of
  27187. * `collection` from right to left.
  27188. *
  27189. * @static
  27190. * @memberOf _
  27191. * @since 2.0.0
  27192. * @alias eachRight
  27193. * @category Collection
  27194. * @param {Array|Object} collection The collection to iterate over.
  27195. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27196. * @returns {Array|Object} Returns `collection`.
  27197. * @see _.forEach
  27198. * @example
  27199. *
  27200. * _.forEachRight([1, 2], function(value) {
  27201. * console.log(value);
  27202. * });
  27203. * // => Logs `2` then `1`.
  27204. */
  27205. function forEachRight(collection, iteratee) {
  27206. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27207. return func(collection, getIteratee(iteratee, 3));
  27208. }
  27209. /**
  27210. * Creates an object composed of keys generated from the results of running
  27211. * each element of `collection` thru `iteratee`. The order of grouped values
  27212. * is determined by the order they occur in `collection`. The corresponding
  27213. * value of each key is an array of elements responsible for generating the
  27214. * key. The iteratee is invoked with one argument: (value).
  27215. *
  27216. * @static
  27217. * @memberOf _
  27218. * @since 0.1.0
  27219. * @category Collection
  27220. * @param {Array|Object} collection The collection to iterate over.
  27221. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27222. * @returns {Object} Returns the composed aggregate object.
  27223. * @example
  27224. *
  27225. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27226. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27227. *
  27228. * // The `_.property` iteratee shorthand.
  27229. * _.groupBy(['one', 'two', 'three'], 'length');
  27230. * // => { '3': ['one', 'two'], '5': ['three'] }
  27231. */
  27232. var groupBy = createAggregator(function(result, value, key) {
  27233. if (hasOwnProperty.call(result, key)) {
  27234. result[key].push(value);
  27235. } else {
  27236. baseAssignValue(result, key, [value]);
  27237. }
  27238. });
  27239. /**
  27240. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27241. * checked for a substring of `value`, otherwise
  27242. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27243. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27244. * the offset from the end of `collection`.
  27245. *
  27246. * @static
  27247. * @memberOf _
  27248. * @since 0.1.0
  27249. * @category Collection
  27250. * @param {Array|Object|string} collection The collection to inspect.
  27251. * @param {*} value The value to search for.
  27252. * @param {number} [fromIndex=0] The index to search from.
  27253. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27254. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27255. * @example
  27256. *
  27257. * _.includes([1, 2, 3], 1);
  27258. * // => true
  27259. *
  27260. * _.includes([1, 2, 3], 1, 2);
  27261. * // => false
  27262. *
  27263. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27264. * // => true
  27265. *
  27266. * _.includes('abcd', 'bc');
  27267. * // => true
  27268. */
  27269. function includes(collection, value, fromIndex, guard) {
  27270. collection = isArrayLike(collection) ? collection : values(collection);
  27271. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27272. var length = collection.length;
  27273. if (fromIndex < 0) {
  27274. fromIndex = nativeMax(length + fromIndex, 0);
  27275. }
  27276. return isString(collection)
  27277. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27278. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27279. }
  27280. /**
  27281. * Invokes the method at `path` of each element in `collection`, returning
  27282. * an array of the results of each invoked method. Any additional arguments
  27283. * are provided to each invoked method. If `path` is a function, it's invoked
  27284. * for, and `this` bound to, each element in `collection`.
  27285. *
  27286. * @static
  27287. * @memberOf _
  27288. * @since 4.0.0
  27289. * @category Collection
  27290. * @param {Array|Object} collection The collection to iterate over.
  27291. * @param {Array|Function|string} path The path of the method to invoke or
  27292. * the function invoked per iteration.
  27293. * @param {...*} [args] The arguments to invoke each method with.
  27294. * @returns {Array} Returns the array of results.
  27295. * @example
  27296. *
  27297. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27298. * // => [[1, 5, 7], [1, 2, 3]]
  27299. *
  27300. * _.invokeMap([123, 456], String.prototype.split, '');
  27301. * // => [['1', '2', '3'], ['4', '5', '6']]
  27302. */
  27303. var invokeMap = baseRest(function(collection, path, args) {
  27304. var index = -1,
  27305. isFunc = typeof path == 'function',
  27306. result = isArrayLike(collection) ? Array(collection.length) : [];
  27307. baseEach(collection, function(value) {
  27308. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27309. });
  27310. return result;
  27311. });
  27312. /**
  27313. * Creates an object composed of keys generated from the results of running
  27314. * each element of `collection` thru `iteratee`. The corresponding value of
  27315. * each key is the last element responsible for generating the key. The
  27316. * iteratee is invoked with one argument: (value).
  27317. *
  27318. * @static
  27319. * @memberOf _
  27320. * @since 4.0.0
  27321. * @category Collection
  27322. * @param {Array|Object} collection The collection to iterate over.
  27323. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27324. * @returns {Object} Returns the composed aggregate object.
  27325. * @example
  27326. *
  27327. * var array = [
  27328. * { 'dir': 'left', 'code': 97 },
  27329. * { 'dir': 'right', 'code': 100 }
  27330. * ];
  27331. *
  27332. * _.keyBy(array, function(o) {
  27333. * return String.fromCharCode(o.code);
  27334. * });
  27335. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27336. *
  27337. * _.keyBy(array, 'dir');
  27338. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27339. */
  27340. var keyBy = createAggregator(function(result, value, key) {
  27341. baseAssignValue(result, key, value);
  27342. });
  27343. /**
  27344. * Creates an array of values by running each element in `collection` thru
  27345. * `iteratee`. The iteratee is invoked with three arguments:
  27346. * (value, index|key, collection).
  27347. *
  27348. * Many lodash methods are guarded to work as iteratees for methods like
  27349. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27350. *
  27351. * The guarded methods are:
  27352. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27353. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27354. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27355. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27356. *
  27357. * @static
  27358. * @memberOf _
  27359. * @since 0.1.0
  27360. * @category Collection
  27361. * @param {Array|Object} collection The collection to iterate over.
  27362. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27363. * @returns {Array} Returns the new mapped array.
  27364. * @example
  27365. *
  27366. * function square(n) {
  27367. * return n * n;
  27368. * }
  27369. *
  27370. * _.map([4, 8], square);
  27371. * // => [16, 64]
  27372. *
  27373. * _.map({ 'a': 4, 'b': 8 }, square);
  27374. * // => [16, 64] (iteration order is not guaranteed)
  27375. *
  27376. * var users = [
  27377. * { 'user': 'barney' },
  27378. * { 'user': 'fred' }
  27379. * ];
  27380. *
  27381. * // The `_.property` iteratee shorthand.
  27382. * _.map(users, 'user');
  27383. * // => ['barney', 'fred']
  27384. */
  27385. function map(collection, iteratee) {
  27386. var func = isArray(collection) ? arrayMap : baseMap;
  27387. return func(collection, getIteratee(iteratee, 3));
  27388. }
  27389. /**
  27390. * This method is like `_.sortBy` except that it allows specifying the sort
  27391. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27392. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27393. * descending or "asc" for ascending sort order of corresponding values.
  27394. *
  27395. * @static
  27396. * @memberOf _
  27397. * @since 4.0.0
  27398. * @category Collection
  27399. * @param {Array|Object} collection The collection to iterate over.
  27400. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27401. * The iteratees to sort by.
  27402. * @param {string[]} [orders] The sort orders of `iteratees`.
  27403. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27404. * @returns {Array} Returns the new sorted array.
  27405. * @example
  27406. *
  27407. * var users = [
  27408. * { 'user': 'fred', 'age': 48 },
  27409. * { 'user': 'barney', 'age': 34 },
  27410. * { 'user': 'fred', 'age': 40 },
  27411. * { 'user': 'barney', 'age': 36 }
  27412. * ];
  27413. *
  27414. * // Sort by `user` in ascending order and by `age` in descending order.
  27415. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27416. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27417. */
  27418. function orderBy(collection, iteratees, orders, guard) {
  27419. if (collection == null) {
  27420. return [];
  27421. }
  27422. if (!isArray(iteratees)) {
  27423. iteratees = iteratees == null ? [] : [iteratees];
  27424. }
  27425. orders = guard ? undefined : orders;
  27426. if (!isArray(orders)) {
  27427. orders = orders == null ? [] : [orders];
  27428. }
  27429. return baseOrderBy(collection, iteratees, orders);
  27430. }
  27431. /**
  27432. * Creates an array of elements split into two groups, the first of which
  27433. * contains elements `predicate` returns truthy for, the second of which
  27434. * contains elements `predicate` returns falsey for. The predicate is
  27435. * invoked with one argument: (value).
  27436. *
  27437. * @static
  27438. * @memberOf _
  27439. * @since 3.0.0
  27440. * @category Collection
  27441. * @param {Array|Object} collection The collection to iterate over.
  27442. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27443. * @returns {Array} Returns the array of grouped elements.
  27444. * @example
  27445. *
  27446. * var users = [
  27447. * { 'user': 'barney', 'age': 36, 'active': false },
  27448. * { 'user': 'fred', 'age': 40, 'active': true },
  27449. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27450. * ];
  27451. *
  27452. * _.partition(users, function(o) { return o.active; });
  27453. * // => objects for [['fred'], ['barney', 'pebbles']]
  27454. *
  27455. * // The `_.matches` iteratee shorthand.
  27456. * _.partition(users, { 'age': 1, 'active': false });
  27457. * // => objects for [['pebbles'], ['barney', 'fred']]
  27458. *
  27459. * // The `_.matchesProperty` iteratee shorthand.
  27460. * _.partition(users, ['active', false]);
  27461. * // => objects for [['barney', 'pebbles'], ['fred']]
  27462. *
  27463. * // The `_.property` iteratee shorthand.
  27464. * _.partition(users, 'active');
  27465. * // => objects for [['fred'], ['barney', 'pebbles']]
  27466. */
  27467. var partition = createAggregator(function(result, value, key) {
  27468. result[key ? 0 : 1].push(value);
  27469. }, function() { return [[], []]; });
  27470. /**
  27471. * Reduces `collection` to a value which is the accumulated result of running
  27472. * each element in `collection` thru `iteratee`, where each successive
  27473. * invocation is supplied the return value of the previous. If `accumulator`
  27474. * is not given, the first element of `collection` is used as the initial
  27475. * value. The iteratee is invoked with four arguments:
  27476. * (accumulator, value, index|key, collection).
  27477. *
  27478. * Many lodash methods are guarded to work as iteratees for methods like
  27479. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27480. *
  27481. * The guarded methods are:
  27482. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27483. * and `sortBy`
  27484. *
  27485. * @static
  27486. * @memberOf _
  27487. * @since 0.1.0
  27488. * @category Collection
  27489. * @param {Array|Object} collection The collection to iterate over.
  27490. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27491. * @param {*} [accumulator] The initial value.
  27492. * @returns {*} Returns the accumulated value.
  27493. * @see _.reduceRight
  27494. * @example
  27495. *
  27496. * _.reduce([1, 2], function(sum, n) {
  27497. * return sum + n;
  27498. * }, 0);
  27499. * // => 3
  27500. *
  27501. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27502. * (result[value] || (result[value] = [])).push(key);
  27503. * return result;
  27504. * }, {});
  27505. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27506. */
  27507. function reduce(collection, iteratee, accumulator) {
  27508. var func = isArray(collection) ? arrayReduce : baseReduce,
  27509. initAccum = arguments.length < 3;
  27510. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27511. }
  27512. /**
  27513. * This method is like `_.reduce` except that it iterates over elements of
  27514. * `collection` from right to left.
  27515. *
  27516. * @static
  27517. * @memberOf _
  27518. * @since 0.1.0
  27519. * @category Collection
  27520. * @param {Array|Object} collection The collection to iterate over.
  27521. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27522. * @param {*} [accumulator] The initial value.
  27523. * @returns {*} Returns the accumulated value.
  27524. * @see _.reduce
  27525. * @example
  27526. *
  27527. * var array = [[0, 1], [2, 3], [4, 5]];
  27528. *
  27529. * _.reduceRight(array, function(flattened, other) {
  27530. * return flattened.concat(other);
  27531. * }, []);
  27532. * // => [4, 5, 2, 3, 0, 1]
  27533. */
  27534. function reduceRight(collection, iteratee, accumulator) {
  27535. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27536. initAccum = arguments.length < 3;
  27537. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27538. }
  27539. /**
  27540. * The opposite of `_.filter`; this method returns the elements of `collection`
  27541. * that `predicate` does **not** return truthy for.
  27542. *
  27543. * @static
  27544. * @memberOf _
  27545. * @since 0.1.0
  27546. * @category Collection
  27547. * @param {Array|Object} collection The collection to iterate over.
  27548. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27549. * @returns {Array} Returns the new filtered array.
  27550. * @see _.filter
  27551. * @example
  27552. *
  27553. * var users = [
  27554. * { 'user': 'barney', 'age': 36, 'active': false },
  27555. * { 'user': 'fred', 'age': 40, 'active': true }
  27556. * ];
  27557. *
  27558. * _.reject(users, function(o) { return !o.active; });
  27559. * // => objects for ['fred']
  27560. *
  27561. * // The `_.matches` iteratee shorthand.
  27562. * _.reject(users, { 'age': 40, 'active': true });
  27563. * // => objects for ['barney']
  27564. *
  27565. * // The `_.matchesProperty` iteratee shorthand.
  27566. * _.reject(users, ['active', false]);
  27567. * // => objects for ['fred']
  27568. *
  27569. * // The `_.property` iteratee shorthand.
  27570. * _.reject(users, 'active');
  27571. * // => objects for ['barney']
  27572. */
  27573. function reject(collection, predicate) {
  27574. var func = isArray(collection) ? arrayFilter : baseFilter;
  27575. return func(collection, negate(getIteratee(predicate, 3)));
  27576. }
  27577. /**
  27578. * Gets a random element from `collection`.
  27579. *
  27580. * @static
  27581. * @memberOf _
  27582. * @since 2.0.0
  27583. * @category Collection
  27584. * @param {Array|Object} collection The collection to sample.
  27585. * @returns {*} Returns the random element.
  27586. * @example
  27587. *
  27588. * _.sample([1, 2, 3, 4]);
  27589. * // => 2
  27590. */
  27591. function sample(collection) {
  27592. var func = isArray(collection) ? arraySample : baseSample;
  27593. return func(collection);
  27594. }
  27595. /**
  27596. * Gets `n` random elements at unique keys from `collection` up to the
  27597. * size of `collection`.
  27598. *
  27599. * @static
  27600. * @memberOf _
  27601. * @since 4.0.0
  27602. * @category Collection
  27603. * @param {Array|Object} collection The collection to sample.
  27604. * @param {number} [n=1] The number of elements to sample.
  27605. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27606. * @returns {Array} Returns the random elements.
  27607. * @example
  27608. *
  27609. * _.sampleSize([1, 2, 3], 2);
  27610. * // => [3, 1]
  27611. *
  27612. * _.sampleSize([1, 2, 3], 4);
  27613. * // => [2, 3, 1]
  27614. */
  27615. function sampleSize(collection, n, guard) {
  27616. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27617. n = 1;
  27618. } else {
  27619. n = toInteger(n);
  27620. }
  27621. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27622. return func(collection, n);
  27623. }
  27624. /**
  27625. * Creates an array of shuffled values, using a version of the
  27626. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27627. *
  27628. * @static
  27629. * @memberOf _
  27630. * @since 0.1.0
  27631. * @category Collection
  27632. * @param {Array|Object} collection The collection to shuffle.
  27633. * @returns {Array} Returns the new shuffled array.
  27634. * @example
  27635. *
  27636. * _.shuffle([1, 2, 3, 4]);
  27637. * // => [4, 1, 3, 2]
  27638. */
  27639. function shuffle(collection) {
  27640. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27641. return func(collection);
  27642. }
  27643. /**
  27644. * Gets the size of `collection` by returning its length for array-like
  27645. * values or the number of own enumerable string keyed properties for objects.
  27646. *
  27647. * @static
  27648. * @memberOf _
  27649. * @since 0.1.0
  27650. * @category Collection
  27651. * @param {Array|Object|string} collection The collection to inspect.
  27652. * @returns {number} Returns the collection size.
  27653. * @example
  27654. *
  27655. * _.size([1, 2, 3]);
  27656. * // => 3
  27657. *
  27658. * _.size({ 'a': 1, 'b': 2 });
  27659. * // => 2
  27660. *
  27661. * _.size('pebbles');
  27662. * // => 7
  27663. */
  27664. function size(collection) {
  27665. if (collection == null) {
  27666. return 0;
  27667. }
  27668. if (isArrayLike(collection)) {
  27669. return isString(collection) ? stringSize(collection) : collection.length;
  27670. }
  27671. var tag = getTag(collection);
  27672. if (tag == mapTag || tag == setTag) {
  27673. return collection.size;
  27674. }
  27675. return baseKeys(collection).length;
  27676. }
  27677. /**
  27678. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27679. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27680. * invoked with three arguments: (value, index|key, collection).
  27681. *
  27682. * @static
  27683. * @memberOf _
  27684. * @since 0.1.0
  27685. * @category Collection
  27686. * @param {Array|Object} collection The collection to iterate over.
  27687. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27688. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27689. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27690. * else `false`.
  27691. * @example
  27692. *
  27693. * _.some([null, 0, 'yes', false], Boolean);
  27694. * // => true
  27695. *
  27696. * var users = [
  27697. * { 'user': 'barney', 'active': true },
  27698. * { 'user': 'fred', 'active': false }
  27699. * ];
  27700. *
  27701. * // The `_.matches` iteratee shorthand.
  27702. * _.some(users, { 'user': 'barney', 'active': false });
  27703. * // => false
  27704. *
  27705. * // The `_.matchesProperty` iteratee shorthand.
  27706. * _.some(users, ['active', false]);
  27707. * // => true
  27708. *
  27709. * // The `_.property` iteratee shorthand.
  27710. * _.some(users, 'active');
  27711. * // => true
  27712. */
  27713. function some(collection, predicate, guard) {
  27714. var func = isArray(collection) ? arraySome : baseSome;
  27715. if (guard && isIterateeCall(collection, predicate, guard)) {
  27716. predicate = undefined;
  27717. }
  27718. return func(collection, getIteratee(predicate, 3));
  27719. }
  27720. /**
  27721. * Creates an array of elements, sorted in ascending order by the results of
  27722. * running each element in a collection thru each iteratee. This method
  27723. * performs a stable sort, that is, it preserves the original sort order of
  27724. * equal elements. The iteratees are invoked with one argument: (value).
  27725. *
  27726. * @static
  27727. * @memberOf _
  27728. * @since 0.1.0
  27729. * @category Collection
  27730. * @param {Array|Object} collection The collection to iterate over.
  27731. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27732. * The iteratees to sort by.
  27733. * @returns {Array} Returns the new sorted array.
  27734. * @example
  27735. *
  27736. * var users = [
  27737. * { 'user': 'fred', 'age': 48 },
  27738. * { 'user': 'barney', 'age': 36 },
  27739. * { 'user': 'fred', 'age': 40 },
  27740. * { 'user': 'barney', 'age': 34 }
  27741. * ];
  27742. *
  27743. * _.sortBy(users, [function(o) { return o.user; }]);
  27744. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27745. *
  27746. * _.sortBy(users, ['user', 'age']);
  27747. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27748. */
  27749. var sortBy = baseRest(function(collection, iteratees) {
  27750. if (collection == null) {
  27751. return [];
  27752. }
  27753. var length = iteratees.length;
  27754. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27755. iteratees = [];
  27756. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27757. iteratees = [iteratees[0]];
  27758. }
  27759. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27760. });
  27761. /*------------------------------------------------------------------------*/
  27762. /**
  27763. * Gets the timestamp of the number of milliseconds that have elapsed since
  27764. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27765. *
  27766. * @static
  27767. * @memberOf _
  27768. * @since 2.4.0
  27769. * @category Date
  27770. * @returns {number} Returns the timestamp.
  27771. * @example
  27772. *
  27773. * _.defer(function(stamp) {
  27774. * console.log(_.now() - stamp);
  27775. * }, _.now());
  27776. * // => Logs the number of milliseconds it took for the deferred invocation.
  27777. */
  27778. var now = ctxNow || function() {
  27779. return root.Date.now();
  27780. };
  27781. /*------------------------------------------------------------------------*/
  27782. /**
  27783. * The opposite of `_.before`; this method creates a function that invokes
  27784. * `func` once it's called `n` or more times.
  27785. *
  27786. * @static
  27787. * @memberOf _
  27788. * @since 0.1.0
  27789. * @category Function
  27790. * @param {number} n The number of calls before `func` is invoked.
  27791. * @param {Function} func The function to restrict.
  27792. * @returns {Function} Returns the new restricted function.
  27793. * @example
  27794. *
  27795. * var saves = ['profile', 'settings'];
  27796. *
  27797. * var done = _.after(saves.length, function() {
  27798. * console.log('done saving!');
  27799. * });
  27800. *
  27801. * _.forEach(saves, function(type) {
  27802. * asyncSave({ 'type': type, 'complete': done });
  27803. * });
  27804. * // => Logs 'done saving!' after the two async saves have completed.
  27805. */
  27806. function after(n, func) {
  27807. if (typeof func != 'function') {
  27808. throw new TypeError(FUNC_ERROR_TEXT);
  27809. }
  27810. n = toInteger(n);
  27811. return function() {
  27812. if (--n < 1) {
  27813. return func.apply(this, arguments);
  27814. }
  27815. };
  27816. }
  27817. /**
  27818. * Creates a function that invokes `func`, with up to `n` arguments,
  27819. * ignoring any additional arguments.
  27820. *
  27821. * @static
  27822. * @memberOf _
  27823. * @since 3.0.0
  27824. * @category Function
  27825. * @param {Function} func The function to cap arguments for.
  27826. * @param {number} [n=func.length] The arity cap.
  27827. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27828. * @returns {Function} Returns the new capped function.
  27829. * @example
  27830. *
  27831. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27832. * // => [6, 8, 10]
  27833. */
  27834. function ary(func, n, guard) {
  27835. n = guard ? undefined : n;
  27836. n = (func && n == null) ? func.length : n;
  27837. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27838. }
  27839. /**
  27840. * Creates a function that invokes `func`, with the `this` binding and arguments
  27841. * of the created function, while it's called less than `n` times. Subsequent
  27842. * calls to the created function return the result of the last `func` invocation.
  27843. *
  27844. * @static
  27845. * @memberOf _
  27846. * @since 3.0.0
  27847. * @category Function
  27848. * @param {number} n The number of calls at which `func` is no longer invoked.
  27849. * @param {Function} func The function to restrict.
  27850. * @returns {Function} Returns the new restricted function.
  27851. * @example
  27852. *
  27853. * jQuery(element).on('click', _.before(5, addContactToList));
  27854. * // => Allows adding up to 4 contacts to the list.
  27855. */
  27856. function before(n, func) {
  27857. var result;
  27858. if (typeof func != 'function') {
  27859. throw new TypeError(FUNC_ERROR_TEXT);
  27860. }
  27861. n = toInteger(n);
  27862. return function() {
  27863. if (--n > 0) {
  27864. result = func.apply(this, arguments);
  27865. }
  27866. if (n <= 1) {
  27867. func = undefined;
  27868. }
  27869. return result;
  27870. };
  27871. }
  27872. /**
  27873. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27874. * and `partials` prepended to the arguments it receives.
  27875. *
  27876. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27877. * may be used as a placeholder for partially applied arguments.
  27878. *
  27879. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27880. * property of bound functions.
  27881. *
  27882. * @static
  27883. * @memberOf _
  27884. * @since 0.1.0
  27885. * @category Function
  27886. * @param {Function} func The function to bind.
  27887. * @param {*} thisArg The `this` binding of `func`.
  27888. * @param {...*} [partials] The arguments to be partially applied.
  27889. * @returns {Function} Returns the new bound function.
  27890. * @example
  27891. *
  27892. * function greet(greeting, punctuation) {
  27893. * return greeting + ' ' + this.user + punctuation;
  27894. * }
  27895. *
  27896. * var object = { 'user': 'fred' };
  27897. *
  27898. * var bound = _.bind(greet, object, 'hi');
  27899. * bound('!');
  27900. * // => 'hi fred!'
  27901. *
  27902. * // Bound with placeholders.
  27903. * var bound = _.bind(greet, object, _, '!');
  27904. * bound('hi');
  27905. * // => 'hi fred!'
  27906. */
  27907. var bind = baseRest(function(func, thisArg, partials) {
  27908. var bitmask = WRAP_BIND_FLAG;
  27909. if (partials.length) {
  27910. var holders = replaceHolders(partials, getHolder(bind));
  27911. bitmask |= WRAP_PARTIAL_FLAG;
  27912. }
  27913. return createWrap(func, bitmask, thisArg, partials, holders);
  27914. });
  27915. /**
  27916. * Creates a function that invokes the method at `object[key]` with `partials`
  27917. * prepended to the arguments it receives.
  27918. *
  27919. * This method differs from `_.bind` by allowing bound functions to reference
  27920. * methods that may be redefined or don't yet exist. See
  27921. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27922. * for more details.
  27923. *
  27924. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27925. * builds, may be used as a placeholder for partially applied arguments.
  27926. *
  27927. * @static
  27928. * @memberOf _
  27929. * @since 0.10.0
  27930. * @category Function
  27931. * @param {Object} object The object to invoke the method on.
  27932. * @param {string} key The key of the method.
  27933. * @param {...*} [partials] The arguments to be partially applied.
  27934. * @returns {Function} Returns the new bound function.
  27935. * @example
  27936. *
  27937. * var object = {
  27938. * 'user': 'fred',
  27939. * 'greet': function(greeting, punctuation) {
  27940. * return greeting + ' ' + this.user + punctuation;
  27941. * }
  27942. * };
  27943. *
  27944. * var bound = _.bindKey(object, 'greet', 'hi');
  27945. * bound('!');
  27946. * // => 'hi fred!'
  27947. *
  27948. * object.greet = function(greeting, punctuation) {
  27949. * return greeting + 'ya ' + this.user + punctuation;
  27950. * };
  27951. *
  27952. * bound('!');
  27953. * // => 'hiya fred!'
  27954. *
  27955. * // Bound with placeholders.
  27956. * var bound = _.bindKey(object, 'greet', _, '!');
  27957. * bound('hi');
  27958. * // => 'hiya fred!'
  27959. */
  27960. var bindKey = baseRest(function(object, key, partials) {
  27961. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27962. if (partials.length) {
  27963. var holders = replaceHolders(partials, getHolder(bindKey));
  27964. bitmask |= WRAP_PARTIAL_FLAG;
  27965. }
  27966. return createWrap(key, bitmask, object, partials, holders);
  27967. });
  27968. /**
  27969. * Creates a function that accepts arguments of `func` and either invokes
  27970. * `func` returning its result, if at least `arity` number of arguments have
  27971. * been provided, or returns a function that accepts the remaining `func`
  27972. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27973. * is not sufficient.
  27974. *
  27975. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27976. * may be used as a placeholder for provided arguments.
  27977. *
  27978. * **Note:** This method doesn't set the "length" property of curried functions.
  27979. *
  27980. * @static
  27981. * @memberOf _
  27982. * @since 2.0.0
  27983. * @category Function
  27984. * @param {Function} func The function to curry.
  27985. * @param {number} [arity=func.length] The arity of `func`.
  27986. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27987. * @returns {Function} Returns the new curried function.
  27988. * @example
  27989. *
  27990. * var abc = function(a, b, c) {
  27991. * return [a, b, c];
  27992. * };
  27993. *
  27994. * var curried = _.curry(abc);
  27995. *
  27996. * curried(1)(2)(3);
  27997. * // => [1, 2, 3]
  27998. *
  27999. * curried(1, 2)(3);
  28000. * // => [1, 2, 3]
  28001. *
  28002. * curried(1, 2, 3);
  28003. * // => [1, 2, 3]
  28004. *
  28005. * // Curried with placeholders.
  28006. * curried(1)(_, 3)(2);
  28007. * // => [1, 2, 3]
  28008. */
  28009. function curry(func, arity, guard) {
  28010. arity = guard ? undefined : arity;
  28011. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28012. result.placeholder = curry.placeholder;
  28013. return result;
  28014. }
  28015. /**
  28016. * This method is like `_.curry` except that arguments are applied to `func`
  28017. * in the manner of `_.partialRight` instead of `_.partial`.
  28018. *
  28019. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28020. * builds, may be used as a placeholder for provided arguments.
  28021. *
  28022. * **Note:** This method doesn't set the "length" property of curried functions.
  28023. *
  28024. * @static
  28025. * @memberOf _
  28026. * @since 3.0.0
  28027. * @category Function
  28028. * @param {Function} func The function to curry.
  28029. * @param {number} [arity=func.length] The arity of `func`.
  28030. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28031. * @returns {Function} Returns the new curried function.
  28032. * @example
  28033. *
  28034. * var abc = function(a, b, c) {
  28035. * return [a, b, c];
  28036. * };
  28037. *
  28038. * var curried = _.curryRight(abc);
  28039. *
  28040. * curried(3)(2)(1);
  28041. * // => [1, 2, 3]
  28042. *
  28043. * curried(2, 3)(1);
  28044. * // => [1, 2, 3]
  28045. *
  28046. * curried(1, 2, 3);
  28047. * // => [1, 2, 3]
  28048. *
  28049. * // Curried with placeholders.
  28050. * curried(3)(1, _)(2);
  28051. * // => [1, 2, 3]
  28052. */
  28053. function curryRight(func, arity, guard) {
  28054. arity = guard ? undefined : arity;
  28055. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28056. result.placeholder = curryRight.placeholder;
  28057. return result;
  28058. }
  28059. /**
  28060. * Creates a debounced function that delays invoking `func` until after `wait`
  28061. * milliseconds have elapsed since the last time the debounced function was
  28062. * invoked. The debounced function comes with a `cancel` method to cancel
  28063. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28064. * Provide `options` to indicate whether `func` should be invoked on the
  28065. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28066. * with the last arguments provided to the debounced function. Subsequent
  28067. * calls to the debounced function return the result of the last `func`
  28068. * invocation.
  28069. *
  28070. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28071. * invoked on the trailing edge of the timeout only if the debounced function
  28072. * is invoked more than once during the `wait` timeout.
  28073. *
  28074. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28075. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28076. *
  28077. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28078. * for details over the differences between `_.debounce` and `_.throttle`.
  28079. *
  28080. * @static
  28081. * @memberOf _
  28082. * @since 0.1.0
  28083. * @category Function
  28084. * @param {Function} func The function to debounce.
  28085. * @param {number} [wait=0] The number of milliseconds to delay.
  28086. * @param {Object} [options={}] The options object.
  28087. * @param {boolean} [options.leading=false]
  28088. * Specify invoking on the leading edge of the timeout.
  28089. * @param {number} [options.maxWait]
  28090. * The maximum time `func` is allowed to be delayed before it's invoked.
  28091. * @param {boolean} [options.trailing=true]
  28092. * Specify invoking on the trailing edge of the timeout.
  28093. * @returns {Function} Returns the new debounced function.
  28094. * @example
  28095. *
  28096. * // Avoid costly calculations while the window size is in flux.
  28097. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28098. *
  28099. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28100. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28101. * 'leading': true,
  28102. * 'trailing': false
  28103. * }));
  28104. *
  28105. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28106. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28107. * var source = new EventSource('/stream');
  28108. * jQuery(source).on('message', debounced);
  28109. *
  28110. * // Cancel the trailing debounced invocation.
  28111. * jQuery(window).on('popstate', debounced.cancel);
  28112. */
  28113. function debounce(func, wait, options) {
  28114. var lastArgs,
  28115. lastThis,
  28116. maxWait,
  28117. result,
  28118. timerId,
  28119. lastCallTime,
  28120. lastInvokeTime = 0,
  28121. leading = false,
  28122. maxing = false,
  28123. trailing = true;
  28124. if (typeof func != 'function') {
  28125. throw new TypeError(FUNC_ERROR_TEXT);
  28126. }
  28127. wait = toNumber(wait) || 0;
  28128. if (isObject(options)) {
  28129. leading = !!options.leading;
  28130. maxing = 'maxWait' in options;
  28131. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28132. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28133. }
  28134. function invokeFunc(time) {
  28135. var args = lastArgs,
  28136. thisArg = lastThis;
  28137. lastArgs = lastThis = undefined;
  28138. lastInvokeTime = time;
  28139. result = func.apply(thisArg, args);
  28140. return result;
  28141. }
  28142. function leadingEdge(time) {
  28143. // Reset any `maxWait` timer.
  28144. lastInvokeTime = time;
  28145. // Start the timer for the trailing edge.
  28146. timerId = setTimeout(timerExpired, wait);
  28147. // Invoke the leading edge.
  28148. return leading ? invokeFunc(time) : result;
  28149. }
  28150. function remainingWait(time) {
  28151. var timeSinceLastCall = time - lastCallTime,
  28152. timeSinceLastInvoke = time - lastInvokeTime,
  28153. timeWaiting = wait - timeSinceLastCall;
  28154. return maxing
  28155. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28156. : timeWaiting;
  28157. }
  28158. function shouldInvoke(time) {
  28159. var timeSinceLastCall = time - lastCallTime,
  28160. timeSinceLastInvoke = time - lastInvokeTime;
  28161. // Either this is the first call, activity has stopped and we're at the
  28162. // trailing edge, the system time has gone backwards and we're treating
  28163. // it as the trailing edge, or we've hit the `maxWait` limit.
  28164. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28165. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28166. }
  28167. function timerExpired() {
  28168. var time = now();
  28169. if (shouldInvoke(time)) {
  28170. return trailingEdge(time);
  28171. }
  28172. // Restart the timer.
  28173. timerId = setTimeout(timerExpired, remainingWait(time));
  28174. }
  28175. function trailingEdge(time) {
  28176. timerId = undefined;
  28177. // Only invoke if we have `lastArgs` which means `func` has been
  28178. // debounced at least once.
  28179. if (trailing && lastArgs) {
  28180. return invokeFunc(time);
  28181. }
  28182. lastArgs = lastThis = undefined;
  28183. return result;
  28184. }
  28185. function cancel() {
  28186. if (timerId !== undefined) {
  28187. clearTimeout(timerId);
  28188. }
  28189. lastInvokeTime = 0;
  28190. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28191. }
  28192. function flush() {
  28193. return timerId === undefined ? result : trailingEdge(now());
  28194. }
  28195. function debounced() {
  28196. var time = now(),
  28197. isInvoking = shouldInvoke(time);
  28198. lastArgs = arguments;
  28199. lastThis = this;
  28200. lastCallTime = time;
  28201. if (isInvoking) {
  28202. if (timerId === undefined) {
  28203. return leadingEdge(lastCallTime);
  28204. }
  28205. if (maxing) {
  28206. // Handle invocations in a tight loop.
  28207. clearTimeout(timerId);
  28208. timerId = setTimeout(timerExpired, wait);
  28209. return invokeFunc(lastCallTime);
  28210. }
  28211. }
  28212. if (timerId === undefined) {
  28213. timerId = setTimeout(timerExpired, wait);
  28214. }
  28215. return result;
  28216. }
  28217. debounced.cancel = cancel;
  28218. debounced.flush = flush;
  28219. return debounced;
  28220. }
  28221. /**
  28222. * Defers invoking the `func` until the current call stack has cleared. Any
  28223. * additional arguments are provided to `func` when it's invoked.
  28224. *
  28225. * @static
  28226. * @memberOf _
  28227. * @since 0.1.0
  28228. * @category Function
  28229. * @param {Function} func The function to defer.
  28230. * @param {...*} [args] The arguments to invoke `func` with.
  28231. * @returns {number} Returns the timer id.
  28232. * @example
  28233. *
  28234. * _.defer(function(text) {
  28235. * console.log(text);
  28236. * }, 'deferred');
  28237. * // => Logs 'deferred' after one millisecond.
  28238. */
  28239. var defer = baseRest(function(func, args) {
  28240. return baseDelay(func, 1, args);
  28241. });
  28242. /**
  28243. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28244. * provided to `func` when it's invoked.
  28245. *
  28246. * @static
  28247. * @memberOf _
  28248. * @since 0.1.0
  28249. * @category Function
  28250. * @param {Function} func The function to delay.
  28251. * @param {number} wait The number of milliseconds to delay invocation.
  28252. * @param {...*} [args] The arguments to invoke `func` with.
  28253. * @returns {number} Returns the timer id.
  28254. * @example
  28255. *
  28256. * _.delay(function(text) {
  28257. * console.log(text);
  28258. * }, 1000, 'later');
  28259. * // => Logs 'later' after one second.
  28260. */
  28261. var delay = baseRest(function(func, wait, args) {
  28262. return baseDelay(func, toNumber(wait) || 0, args);
  28263. });
  28264. /**
  28265. * Creates a function that invokes `func` with arguments reversed.
  28266. *
  28267. * @static
  28268. * @memberOf _
  28269. * @since 4.0.0
  28270. * @category Function
  28271. * @param {Function} func The function to flip arguments for.
  28272. * @returns {Function} Returns the new flipped function.
  28273. * @example
  28274. *
  28275. * var flipped = _.flip(function() {
  28276. * return _.toArray(arguments);
  28277. * });
  28278. *
  28279. * flipped('a', 'b', 'c', 'd');
  28280. * // => ['d', 'c', 'b', 'a']
  28281. */
  28282. function flip(func) {
  28283. return createWrap(func, WRAP_FLIP_FLAG);
  28284. }
  28285. /**
  28286. * Creates a function that memoizes the result of `func`. If `resolver` is
  28287. * provided, it determines the cache key for storing the result based on the
  28288. * arguments provided to the memoized function. By default, the first argument
  28289. * provided to the memoized function is used as the map cache key. The `func`
  28290. * is invoked with the `this` binding of the memoized function.
  28291. *
  28292. * **Note:** The cache is exposed as the `cache` property on the memoized
  28293. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28294. * constructor with one whose instances implement the
  28295. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28296. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28297. *
  28298. * @static
  28299. * @memberOf _
  28300. * @since 0.1.0
  28301. * @category Function
  28302. * @param {Function} func The function to have its output memoized.
  28303. * @param {Function} [resolver] The function to resolve the cache key.
  28304. * @returns {Function} Returns the new memoized function.
  28305. * @example
  28306. *
  28307. * var object = { 'a': 1, 'b': 2 };
  28308. * var other = { 'c': 3, 'd': 4 };
  28309. *
  28310. * var values = _.memoize(_.values);
  28311. * values(object);
  28312. * // => [1, 2]
  28313. *
  28314. * values(other);
  28315. * // => [3, 4]
  28316. *
  28317. * object.a = 2;
  28318. * values(object);
  28319. * // => [1, 2]
  28320. *
  28321. * // Modify the result cache.
  28322. * values.cache.set(object, ['a', 'b']);
  28323. * values(object);
  28324. * // => ['a', 'b']
  28325. *
  28326. * // Replace `_.memoize.Cache`.
  28327. * _.memoize.Cache = WeakMap;
  28328. */
  28329. function memoize(func, resolver) {
  28330. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28331. throw new TypeError(FUNC_ERROR_TEXT);
  28332. }
  28333. var memoized = function() {
  28334. var args = arguments,
  28335. key = resolver ? resolver.apply(this, args) : args[0],
  28336. cache = memoized.cache;
  28337. if (cache.has(key)) {
  28338. return cache.get(key);
  28339. }
  28340. var result = func.apply(this, args);
  28341. memoized.cache = cache.set(key, result) || cache;
  28342. return result;
  28343. };
  28344. memoized.cache = new (memoize.Cache || MapCache);
  28345. return memoized;
  28346. }
  28347. // Expose `MapCache`.
  28348. memoize.Cache = MapCache;
  28349. /**
  28350. * Creates a function that negates the result of the predicate `func`. The
  28351. * `func` predicate is invoked with the `this` binding and arguments of the
  28352. * created function.
  28353. *
  28354. * @static
  28355. * @memberOf _
  28356. * @since 3.0.0
  28357. * @category Function
  28358. * @param {Function} predicate The predicate to negate.
  28359. * @returns {Function} Returns the new negated function.
  28360. * @example
  28361. *
  28362. * function isEven(n) {
  28363. * return n % 2 == 0;
  28364. * }
  28365. *
  28366. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28367. * // => [1, 3, 5]
  28368. */
  28369. function negate(predicate) {
  28370. if (typeof predicate != 'function') {
  28371. throw new TypeError(FUNC_ERROR_TEXT);
  28372. }
  28373. return function() {
  28374. var args = arguments;
  28375. switch (args.length) {
  28376. case 0: return !predicate.call(this);
  28377. case 1: return !predicate.call(this, args[0]);
  28378. case 2: return !predicate.call(this, args[0], args[1]);
  28379. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28380. }
  28381. return !predicate.apply(this, args);
  28382. };
  28383. }
  28384. /**
  28385. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28386. * to the function return the value of the first invocation. The `func` is
  28387. * invoked with the `this` binding and arguments of the created function.
  28388. *
  28389. * @static
  28390. * @memberOf _
  28391. * @since 0.1.0
  28392. * @category Function
  28393. * @param {Function} func The function to restrict.
  28394. * @returns {Function} Returns the new restricted function.
  28395. * @example
  28396. *
  28397. * var initialize = _.once(createApplication);
  28398. * initialize();
  28399. * initialize();
  28400. * // => `createApplication` is invoked once
  28401. */
  28402. function once(func) {
  28403. return before(2, func);
  28404. }
  28405. /**
  28406. * Creates a function that invokes `func` with its arguments transformed.
  28407. *
  28408. * @static
  28409. * @since 4.0.0
  28410. * @memberOf _
  28411. * @category Function
  28412. * @param {Function} func The function to wrap.
  28413. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28414. * The argument transforms.
  28415. * @returns {Function} Returns the new function.
  28416. * @example
  28417. *
  28418. * function doubled(n) {
  28419. * return n * 2;
  28420. * }
  28421. *
  28422. * function square(n) {
  28423. * return n * n;
  28424. * }
  28425. *
  28426. * var func = _.overArgs(function(x, y) {
  28427. * return [x, y];
  28428. * }, [square, doubled]);
  28429. *
  28430. * func(9, 3);
  28431. * // => [81, 6]
  28432. *
  28433. * func(10, 5);
  28434. * // => [100, 10]
  28435. */
  28436. var overArgs = castRest(function(func, transforms) {
  28437. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28438. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28439. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28440. var funcsLength = transforms.length;
  28441. return baseRest(function(args) {
  28442. var index = -1,
  28443. length = nativeMin(args.length, funcsLength);
  28444. while (++index < length) {
  28445. args[index] = transforms[index].call(this, args[index]);
  28446. }
  28447. return apply(func, this, args);
  28448. });
  28449. });
  28450. /**
  28451. * Creates a function that invokes `func` with `partials` prepended to the
  28452. * arguments it receives. This method is like `_.bind` except it does **not**
  28453. * alter the `this` binding.
  28454. *
  28455. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28456. * builds, may be used as a placeholder for partially applied arguments.
  28457. *
  28458. * **Note:** This method doesn't set the "length" property of partially
  28459. * applied functions.
  28460. *
  28461. * @static
  28462. * @memberOf _
  28463. * @since 0.2.0
  28464. * @category Function
  28465. * @param {Function} func The function to partially apply arguments to.
  28466. * @param {...*} [partials] The arguments to be partially applied.
  28467. * @returns {Function} Returns the new partially applied function.
  28468. * @example
  28469. *
  28470. * function greet(greeting, name) {
  28471. * return greeting + ' ' + name;
  28472. * }
  28473. *
  28474. * var sayHelloTo = _.partial(greet, 'hello');
  28475. * sayHelloTo('fred');
  28476. * // => 'hello fred'
  28477. *
  28478. * // Partially applied with placeholders.
  28479. * var greetFred = _.partial(greet, _, 'fred');
  28480. * greetFred('hi');
  28481. * // => 'hi fred'
  28482. */
  28483. var partial = baseRest(function(func, partials) {
  28484. var holders = replaceHolders(partials, getHolder(partial));
  28485. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28486. });
  28487. /**
  28488. * This method is like `_.partial` except that partially applied arguments
  28489. * are appended to the arguments it receives.
  28490. *
  28491. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28492. * builds, may be used as a placeholder for partially applied arguments.
  28493. *
  28494. * **Note:** This method doesn't set the "length" property of partially
  28495. * applied functions.
  28496. *
  28497. * @static
  28498. * @memberOf _
  28499. * @since 1.0.0
  28500. * @category Function
  28501. * @param {Function} func The function to partially apply arguments to.
  28502. * @param {...*} [partials] The arguments to be partially applied.
  28503. * @returns {Function} Returns the new partially applied function.
  28504. * @example
  28505. *
  28506. * function greet(greeting, name) {
  28507. * return greeting + ' ' + name;
  28508. * }
  28509. *
  28510. * var greetFred = _.partialRight(greet, 'fred');
  28511. * greetFred('hi');
  28512. * // => 'hi fred'
  28513. *
  28514. * // Partially applied with placeholders.
  28515. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28516. * sayHelloTo('fred');
  28517. * // => 'hello fred'
  28518. */
  28519. var partialRight = baseRest(function(func, partials) {
  28520. var holders = replaceHolders(partials, getHolder(partialRight));
  28521. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28522. });
  28523. /**
  28524. * Creates a function that invokes `func` with arguments arranged according
  28525. * to the specified `indexes` where the argument value at the first index is
  28526. * provided as the first argument, the argument value at the second index is
  28527. * provided as the second argument, and so on.
  28528. *
  28529. * @static
  28530. * @memberOf _
  28531. * @since 3.0.0
  28532. * @category Function
  28533. * @param {Function} func The function to rearrange arguments for.
  28534. * @param {...(number|number[])} indexes The arranged argument indexes.
  28535. * @returns {Function} Returns the new function.
  28536. * @example
  28537. *
  28538. * var rearged = _.rearg(function(a, b, c) {
  28539. * return [a, b, c];
  28540. * }, [2, 0, 1]);
  28541. *
  28542. * rearged('b', 'c', 'a')
  28543. * // => ['a', 'b', 'c']
  28544. */
  28545. var rearg = flatRest(function(func, indexes) {
  28546. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28547. });
  28548. /**
  28549. * Creates a function that invokes `func` with the `this` binding of the
  28550. * created function and arguments from `start` and beyond provided as
  28551. * an array.
  28552. *
  28553. * **Note:** This method is based on the
  28554. * [rest parameter](https://mdn.io/rest_parameters).
  28555. *
  28556. * @static
  28557. * @memberOf _
  28558. * @since 4.0.0
  28559. * @category Function
  28560. * @param {Function} func The function to apply a rest parameter to.
  28561. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28562. * @returns {Function} Returns the new function.
  28563. * @example
  28564. *
  28565. * var say = _.rest(function(what, names) {
  28566. * return what + ' ' + _.initial(names).join(', ') +
  28567. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28568. * });
  28569. *
  28570. * say('hello', 'fred', 'barney', 'pebbles');
  28571. * // => 'hello fred, barney, & pebbles'
  28572. */
  28573. function rest(func, start) {
  28574. if (typeof func != 'function') {
  28575. throw new TypeError(FUNC_ERROR_TEXT);
  28576. }
  28577. start = start === undefined ? start : toInteger(start);
  28578. return baseRest(func, start);
  28579. }
  28580. /**
  28581. * Creates a function that invokes `func` with the `this` binding of the
  28582. * create function and an array of arguments much like
  28583. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28584. *
  28585. * **Note:** This method is based on the
  28586. * [spread operator](https://mdn.io/spread_operator).
  28587. *
  28588. * @static
  28589. * @memberOf _
  28590. * @since 3.2.0
  28591. * @category Function
  28592. * @param {Function} func The function to spread arguments over.
  28593. * @param {number} [start=0] The start position of the spread.
  28594. * @returns {Function} Returns the new function.
  28595. * @example
  28596. *
  28597. * var say = _.spread(function(who, what) {
  28598. * return who + ' says ' + what;
  28599. * });
  28600. *
  28601. * say(['fred', 'hello']);
  28602. * // => 'fred says hello'
  28603. *
  28604. * var numbers = Promise.all([
  28605. * Promise.resolve(40),
  28606. * Promise.resolve(36)
  28607. * ]);
  28608. *
  28609. * numbers.then(_.spread(function(x, y) {
  28610. * return x + y;
  28611. * }));
  28612. * // => a Promise of 76
  28613. */
  28614. function spread(func, start) {
  28615. if (typeof func != 'function') {
  28616. throw new TypeError(FUNC_ERROR_TEXT);
  28617. }
  28618. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28619. return baseRest(function(args) {
  28620. var array = args[start],
  28621. otherArgs = castSlice(args, 0, start);
  28622. if (array) {
  28623. arrayPush(otherArgs, array);
  28624. }
  28625. return apply(func, this, otherArgs);
  28626. });
  28627. }
  28628. /**
  28629. * Creates a throttled function that only invokes `func` at most once per
  28630. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28631. * method to cancel delayed `func` invocations and a `flush` method to
  28632. * immediately invoke them. Provide `options` to indicate whether `func`
  28633. * should be invoked on the leading and/or trailing edge of the `wait`
  28634. * timeout. The `func` is invoked with the last arguments provided to the
  28635. * throttled function. Subsequent calls to the throttled function return the
  28636. * result of the last `func` invocation.
  28637. *
  28638. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28639. * invoked on the trailing edge of the timeout only if the throttled function
  28640. * is invoked more than once during the `wait` timeout.
  28641. *
  28642. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28643. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28644. *
  28645. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28646. * for details over the differences between `_.throttle` and `_.debounce`.
  28647. *
  28648. * @static
  28649. * @memberOf _
  28650. * @since 0.1.0
  28651. * @category Function
  28652. * @param {Function} func The function to throttle.
  28653. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28654. * @param {Object} [options={}] The options object.
  28655. * @param {boolean} [options.leading=true]
  28656. * Specify invoking on the leading edge of the timeout.
  28657. * @param {boolean} [options.trailing=true]
  28658. * Specify invoking on the trailing edge of the timeout.
  28659. * @returns {Function} Returns the new throttled function.
  28660. * @example
  28661. *
  28662. * // Avoid excessively updating the position while scrolling.
  28663. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28664. *
  28665. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28666. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28667. * jQuery(element).on('click', throttled);
  28668. *
  28669. * // Cancel the trailing throttled invocation.
  28670. * jQuery(window).on('popstate', throttled.cancel);
  28671. */
  28672. function throttle(func, wait, options) {
  28673. var leading = true,
  28674. trailing = true;
  28675. if (typeof func != 'function') {
  28676. throw new TypeError(FUNC_ERROR_TEXT);
  28677. }
  28678. if (isObject(options)) {
  28679. leading = 'leading' in options ? !!options.leading : leading;
  28680. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28681. }
  28682. return debounce(func, wait, {
  28683. 'leading': leading,
  28684. 'maxWait': wait,
  28685. 'trailing': trailing
  28686. });
  28687. }
  28688. /**
  28689. * Creates a function that accepts up to one argument, ignoring any
  28690. * additional arguments.
  28691. *
  28692. * @static
  28693. * @memberOf _
  28694. * @since 4.0.0
  28695. * @category Function
  28696. * @param {Function} func The function to cap arguments for.
  28697. * @returns {Function} Returns the new capped function.
  28698. * @example
  28699. *
  28700. * _.map(['6', '8', '10'], _.unary(parseInt));
  28701. * // => [6, 8, 10]
  28702. */
  28703. function unary(func) {
  28704. return ary(func, 1);
  28705. }
  28706. /**
  28707. * Creates a function that provides `value` to `wrapper` as its first
  28708. * argument. Any additional arguments provided to the function are appended
  28709. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28710. * binding of the created function.
  28711. *
  28712. * @static
  28713. * @memberOf _
  28714. * @since 0.1.0
  28715. * @category Function
  28716. * @param {*} value The value to wrap.
  28717. * @param {Function} [wrapper=identity] The wrapper function.
  28718. * @returns {Function} Returns the new function.
  28719. * @example
  28720. *
  28721. * var p = _.wrap(_.escape, function(func, text) {
  28722. * return '<p>' + func(text) + '</p>';
  28723. * });
  28724. *
  28725. * p('fred, barney, & pebbles');
  28726. * // => '<p>fred, barney, &amp; pebbles</p>'
  28727. */
  28728. function wrap(value, wrapper) {
  28729. return partial(castFunction(wrapper), value);
  28730. }
  28731. /*------------------------------------------------------------------------*/
  28732. /**
  28733. * Casts `value` as an array if it's not one.
  28734. *
  28735. * @static
  28736. * @memberOf _
  28737. * @since 4.4.0
  28738. * @category Lang
  28739. * @param {*} value The value to inspect.
  28740. * @returns {Array} Returns the cast array.
  28741. * @example
  28742. *
  28743. * _.castArray(1);
  28744. * // => [1]
  28745. *
  28746. * _.castArray({ 'a': 1 });
  28747. * // => [{ 'a': 1 }]
  28748. *
  28749. * _.castArray('abc');
  28750. * // => ['abc']
  28751. *
  28752. * _.castArray(null);
  28753. * // => [null]
  28754. *
  28755. * _.castArray(undefined);
  28756. * // => [undefined]
  28757. *
  28758. * _.castArray();
  28759. * // => []
  28760. *
  28761. * var array = [1, 2, 3];
  28762. * console.log(_.castArray(array) === array);
  28763. * // => true
  28764. */
  28765. function castArray() {
  28766. if (!arguments.length) {
  28767. return [];
  28768. }
  28769. var value = arguments[0];
  28770. return isArray(value) ? value : [value];
  28771. }
  28772. /**
  28773. * Creates a shallow clone of `value`.
  28774. *
  28775. * **Note:** This method is loosely based on the
  28776. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28777. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28778. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28779. * arrays. The own enumerable properties of `arguments` objects are cloned
  28780. * as plain objects. An empty object is returned for uncloneable values such
  28781. * as error objects, functions, DOM nodes, and WeakMaps.
  28782. *
  28783. * @static
  28784. * @memberOf _
  28785. * @since 0.1.0
  28786. * @category Lang
  28787. * @param {*} value The value to clone.
  28788. * @returns {*} Returns the cloned value.
  28789. * @see _.cloneDeep
  28790. * @example
  28791. *
  28792. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28793. *
  28794. * var shallow = _.clone(objects);
  28795. * console.log(shallow[0] === objects[0]);
  28796. * // => true
  28797. */
  28798. function clone(value) {
  28799. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28800. }
  28801. /**
  28802. * This method is like `_.clone` except that it accepts `customizer` which
  28803. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28804. * cloning is handled by the method instead. The `customizer` is invoked with
  28805. * up to four arguments; (value [, index|key, object, stack]).
  28806. *
  28807. * @static
  28808. * @memberOf _
  28809. * @since 4.0.0
  28810. * @category Lang
  28811. * @param {*} value The value to clone.
  28812. * @param {Function} [customizer] The function to customize cloning.
  28813. * @returns {*} Returns the cloned value.
  28814. * @see _.cloneDeepWith
  28815. * @example
  28816. *
  28817. * function customizer(value) {
  28818. * if (_.isElement(value)) {
  28819. * return value.cloneNode(false);
  28820. * }
  28821. * }
  28822. *
  28823. * var el = _.cloneWith(document.body, customizer);
  28824. *
  28825. * console.log(el === document.body);
  28826. * // => false
  28827. * console.log(el.nodeName);
  28828. * // => 'BODY'
  28829. * console.log(el.childNodes.length);
  28830. * // => 0
  28831. */
  28832. function cloneWith(value, customizer) {
  28833. customizer = typeof customizer == 'function' ? customizer : undefined;
  28834. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28835. }
  28836. /**
  28837. * This method is like `_.clone` except that it recursively clones `value`.
  28838. *
  28839. * @static
  28840. * @memberOf _
  28841. * @since 1.0.0
  28842. * @category Lang
  28843. * @param {*} value The value to recursively clone.
  28844. * @returns {*} Returns the deep cloned value.
  28845. * @see _.clone
  28846. * @example
  28847. *
  28848. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28849. *
  28850. * var deep = _.cloneDeep(objects);
  28851. * console.log(deep[0] === objects[0]);
  28852. * // => false
  28853. */
  28854. function cloneDeep(value) {
  28855. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28856. }
  28857. /**
  28858. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28859. *
  28860. * @static
  28861. * @memberOf _
  28862. * @since 4.0.0
  28863. * @category Lang
  28864. * @param {*} value The value to recursively clone.
  28865. * @param {Function} [customizer] The function to customize cloning.
  28866. * @returns {*} Returns the deep cloned value.
  28867. * @see _.cloneWith
  28868. * @example
  28869. *
  28870. * function customizer(value) {
  28871. * if (_.isElement(value)) {
  28872. * return value.cloneNode(true);
  28873. * }
  28874. * }
  28875. *
  28876. * var el = _.cloneDeepWith(document.body, customizer);
  28877. *
  28878. * console.log(el === document.body);
  28879. * // => false
  28880. * console.log(el.nodeName);
  28881. * // => 'BODY'
  28882. * console.log(el.childNodes.length);
  28883. * // => 20
  28884. */
  28885. function cloneDeepWith(value, customizer) {
  28886. customizer = typeof customizer == 'function' ? customizer : undefined;
  28887. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28888. }
  28889. /**
  28890. * Checks if `object` conforms to `source` by invoking the predicate
  28891. * properties of `source` with the corresponding property values of `object`.
  28892. *
  28893. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28894. * partially applied.
  28895. *
  28896. * @static
  28897. * @memberOf _
  28898. * @since 4.14.0
  28899. * @category Lang
  28900. * @param {Object} object The object to inspect.
  28901. * @param {Object} source The object of property predicates to conform to.
  28902. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28903. * @example
  28904. *
  28905. * var object = { 'a': 1, 'b': 2 };
  28906. *
  28907. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28908. * // => true
  28909. *
  28910. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28911. * // => false
  28912. */
  28913. function conformsTo(object, source) {
  28914. return source == null || baseConformsTo(object, source, keys(source));
  28915. }
  28916. /**
  28917. * Performs a
  28918. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28919. * comparison between two values to determine if they are equivalent.
  28920. *
  28921. * @static
  28922. * @memberOf _
  28923. * @since 4.0.0
  28924. * @category Lang
  28925. * @param {*} value The value to compare.
  28926. * @param {*} other The other value to compare.
  28927. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28928. * @example
  28929. *
  28930. * var object = { 'a': 1 };
  28931. * var other = { 'a': 1 };
  28932. *
  28933. * _.eq(object, object);
  28934. * // => true
  28935. *
  28936. * _.eq(object, other);
  28937. * // => false
  28938. *
  28939. * _.eq('a', 'a');
  28940. * // => true
  28941. *
  28942. * _.eq('a', Object('a'));
  28943. * // => false
  28944. *
  28945. * _.eq(NaN, NaN);
  28946. * // => true
  28947. */
  28948. function eq(value, other) {
  28949. return value === other || (value !== value && other !== other);
  28950. }
  28951. /**
  28952. * Checks if `value` is greater than `other`.
  28953. *
  28954. * @static
  28955. * @memberOf _
  28956. * @since 3.9.0
  28957. * @category Lang
  28958. * @param {*} value The value to compare.
  28959. * @param {*} other The other value to compare.
  28960. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28961. * else `false`.
  28962. * @see _.lt
  28963. * @example
  28964. *
  28965. * _.gt(3, 1);
  28966. * // => true
  28967. *
  28968. * _.gt(3, 3);
  28969. * // => false
  28970. *
  28971. * _.gt(1, 3);
  28972. * // => false
  28973. */
  28974. var gt = createRelationalOperation(baseGt);
  28975. /**
  28976. * Checks if `value` is greater than or equal to `other`.
  28977. *
  28978. * @static
  28979. * @memberOf _
  28980. * @since 3.9.0
  28981. * @category Lang
  28982. * @param {*} value The value to compare.
  28983. * @param {*} other The other value to compare.
  28984. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28985. * `other`, else `false`.
  28986. * @see _.lte
  28987. * @example
  28988. *
  28989. * _.gte(3, 1);
  28990. * // => true
  28991. *
  28992. * _.gte(3, 3);
  28993. * // => true
  28994. *
  28995. * _.gte(1, 3);
  28996. * // => false
  28997. */
  28998. var gte = createRelationalOperation(function(value, other) {
  28999. return value >= other;
  29000. });
  29001. /**
  29002. * Checks if `value` is likely an `arguments` object.
  29003. *
  29004. * @static
  29005. * @memberOf _
  29006. * @since 0.1.0
  29007. * @category Lang
  29008. * @param {*} value The value to check.
  29009. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29010. * else `false`.
  29011. * @example
  29012. *
  29013. * _.isArguments(function() { return arguments; }());
  29014. * // => true
  29015. *
  29016. * _.isArguments([1, 2, 3]);
  29017. * // => false
  29018. */
  29019. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29020. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29021. !propertyIsEnumerable.call(value, 'callee');
  29022. };
  29023. /**
  29024. * Checks if `value` is classified as an `Array` object.
  29025. *
  29026. * @static
  29027. * @memberOf _
  29028. * @since 0.1.0
  29029. * @category Lang
  29030. * @param {*} value The value to check.
  29031. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29032. * @example
  29033. *
  29034. * _.isArray([1, 2, 3]);
  29035. * // => true
  29036. *
  29037. * _.isArray(document.body.children);
  29038. * // => false
  29039. *
  29040. * _.isArray('abc');
  29041. * // => false
  29042. *
  29043. * _.isArray(_.noop);
  29044. * // => false
  29045. */
  29046. var isArray = Array.isArray;
  29047. /**
  29048. * Checks if `value` is classified as an `ArrayBuffer` object.
  29049. *
  29050. * @static
  29051. * @memberOf _
  29052. * @since 4.3.0
  29053. * @category Lang
  29054. * @param {*} value The value to check.
  29055. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29056. * @example
  29057. *
  29058. * _.isArrayBuffer(new ArrayBuffer(2));
  29059. * // => true
  29060. *
  29061. * _.isArrayBuffer(new Array(2));
  29062. * // => false
  29063. */
  29064. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29065. /**
  29066. * Checks if `value` is array-like. A value is considered array-like if it's
  29067. * not a function and has a `value.length` that's an integer greater than or
  29068. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29069. *
  29070. * @static
  29071. * @memberOf _
  29072. * @since 4.0.0
  29073. * @category Lang
  29074. * @param {*} value The value to check.
  29075. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29076. * @example
  29077. *
  29078. * _.isArrayLike([1, 2, 3]);
  29079. * // => true
  29080. *
  29081. * _.isArrayLike(document.body.children);
  29082. * // => true
  29083. *
  29084. * _.isArrayLike('abc');
  29085. * // => true
  29086. *
  29087. * _.isArrayLike(_.noop);
  29088. * // => false
  29089. */
  29090. function isArrayLike(value) {
  29091. return value != null && isLength(value.length) && !isFunction(value);
  29092. }
  29093. /**
  29094. * This method is like `_.isArrayLike` except that it also checks if `value`
  29095. * is an object.
  29096. *
  29097. * @static
  29098. * @memberOf _
  29099. * @since 4.0.0
  29100. * @category Lang
  29101. * @param {*} value The value to check.
  29102. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29103. * else `false`.
  29104. * @example
  29105. *
  29106. * _.isArrayLikeObject([1, 2, 3]);
  29107. * // => true
  29108. *
  29109. * _.isArrayLikeObject(document.body.children);
  29110. * // => true
  29111. *
  29112. * _.isArrayLikeObject('abc');
  29113. * // => false
  29114. *
  29115. * _.isArrayLikeObject(_.noop);
  29116. * // => false
  29117. */
  29118. function isArrayLikeObject(value) {
  29119. return isObjectLike(value) && isArrayLike(value);
  29120. }
  29121. /**
  29122. * Checks if `value` is classified as a boolean primitive or object.
  29123. *
  29124. * @static
  29125. * @memberOf _
  29126. * @since 0.1.0
  29127. * @category Lang
  29128. * @param {*} value The value to check.
  29129. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29130. * @example
  29131. *
  29132. * _.isBoolean(false);
  29133. * // => true
  29134. *
  29135. * _.isBoolean(null);
  29136. * // => false
  29137. */
  29138. function isBoolean(value) {
  29139. return value === true || value === false ||
  29140. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29141. }
  29142. /**
  29143. * Checks if `value` is a buffer.
  29144. *
  29145. * @static
  29146. * @memberOf _
  29147. * @since 4.3.0
  29148. * @category Lang
  29149. * @param {*} value The value to check.
  29150. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29151. * @example
  29152. *
  29153. * _.isBuffer(new Buffer(2));
  29154. * // => true
  29155. *
  29156. * _.isBuffer(new Uint8Array(2));
  29157. * // => false
  29158. */
  29159. var isBuffer = nativeIsBuffer || stubFalse;
  29160. /**
  29161. * Checks if `value` is classified as a `Date` object.
  29162. *
  29163. * @static
  29164. * @memberOf _
  29165. * @since 0.1.0
  29166. * @category Lang
  29167. * @param {*} value The value to check.
  29168. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29169. * @example
  29170. *
  29171. * _.isDate(new Date);
  29172. * // => true
  29173. *
  29174. * _.isDate('Mon April 23 2012');
  29175. * // => false
  29176. */
  29177. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29178. /**
  29179. * Checks if `value` is likely a DOM element.
  29180. *
  29181. * @static
  29182. * @memberOf _
  29183. * @since 0.1.0
  29184. * @category Lang
  29185. * @param {*} value The value to check.
  29186. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29187. * @example
  29188. *
  29189. * _.isElement(document.body);
  29190. * // => true
  29191. *
  29192. * _.isElement('<body>');
  29193. * // => false
  29194. */
  29195. function isElement(value) {
  29196. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29197. }
  29198. /**
  29199. * Checks if `value` is an empty object, collection, map, or set.
  29200. *
  29201. * Objects are considered empty if they have no own enumerable string keyed
  29202. * properties.
  29203. *
  29204. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29205. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29206. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29207. *
  29208. * @static
  29209. * @memberOf _
  29210. * @since 0.1.0
  29211. * @category Lang
  29212. * @param {*} value The value to check.
  29213. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29214. * @example
  29215. *
  29216. * _.isEmpty(null);
  29217. * // => true
  29218. *
  29219. * _.isEmpty(true);
  29220. * // => true
  29221. *
  29222. * _.isEmpty(1);
  29223. * // => true
  29224. *
  29225. * _.isEmpty([1, 2, 3]);
  29226. * // => false
  29227. *
  29228. * _.isEmpty({ 'a': 1 });
  29229. * // => false
  29230. */
  29231. function isEmpty(value) {
  29232. if (value == null) {
  29233. return true;
  29234. }
  29235. if (isArrayLike(value) &&
  29236. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29237. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29238. return !value.length;
  29239. }
  29240. var tag = getTag(value);
  29241. if (tag == mapTag || tag == setTag) {
  29242. return !value.size;
  29243. }
  29244. if (isPrototype(value)) {
  29245. return !baseKeys(value).length;
  29246. }
  29247. for (var key in value) {
  29248. if (hasOwnProperty.call(value, key)) {
  29249. return false;
  29250. }
  29251. }
  29252. return true;
  29253. }
  29254. /**
  29255. * Performs a deep comparison between two values to determine if they are
  29256. * equivalent.
  29257. *
  29258. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29259. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29260. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29261. * by their own, not inherited, enumerable properties. Functions and DOM
  29262. * nodes are compared by strict equality, i.e. `===`.
  29263. *
  29264. * @static
  29265. * @memberOf _
  29266. * @since 0.1.0
  29267. * @category Lang
  29268. * @param {*} value The value to compare.
  29269. * @param {*} other The other value to compare.
  29270. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29271. * @example
  29272. *
  29273. * var object = { 'a': 1 };
  29274. * var other = { 'a': 1 };
  29275. *
  29276. * _.isEqual(object, other);
  29277. * // => true
  29278. *
  29279. * object === other;
  29280. * // => false
  29281. */
  29282. function isEqual(value, other) {
  29283. return baseIsEqual(value, other);
  29284. }
  29285. /**
  29286. * This method is like `_.isEqual` except that it accepts `customizer` which
  29287. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29288. * are handled by the method instead. The `customizer` is invoked with up to
  29289. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29290. *
  29291. * @static
  29292. * @memberOf _
  29293. * @since 4.0.0
  29294. * @category Lang
  29295. * @param {*} value The value to compare.
  29296. * @param {*} other The other value to compare.
  29297. * @param {Function} [customizer] The function to customize comparisons.
  29298. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29299. * @example
  29300. *
  29301. * function isGreeting(value) {
  29302. * return /^h(?:i|ello)$/.test(value);
  29303. * }
  29304. *
  29305. * function customizer(objValue, othValue) {
  29306. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29307. * return true;
  29308. * }
  29309. * }
  29310. *
  29311. * var array = ['hello', 'goodbye'];
  29312. * var other = ['hi', 'goodbye'];
  29313. *
  29314. * _.isEqualWith(array, other, customizer);
  29315. * // => true
  29316. */
  29317. function isEqualWith(value, other, customizer) {
  29318. customizer = typeof customizer == 'function' ? customizer : undefined;
  29319. var result = customizer ? customizer(value, other) : undefined;
  29320. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29321. }
  29322. /**
  29323. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29324. * `SyntaxError`, `TypeError`, or `URIError` object.
  29325. *
  29326. * @static
  29327. * @memberOf _
  29328. * @since 3.0.0
  29329. * @category Lang
  29330. * @param {*} value The value to check.
  29331. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29332. * @example
  29333. *
  29334. * _.isError(new Error);
  29335. * // => true
  29336. *
  29337. * _.isError(Error);
  29338. * // => false
  29339. */
  29340. function isError(value) {
  29341. if (!isObjectLike(value)) {
  29342. return false;
  29343. }
  29344. var tag = baseGetTag(value);
  29345. return tag == errorTag || tag == domExcTag ||
  29346. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29347. }
  29348. /**
  29349. * Checks if `value` is a finite primitive number.
  29350. *
  29351. * **Note:** This method is based on
  29352. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29353. *
  29354. * @static
  29355. * @memberOf _
  29356. * @since 0.1.0
  29357. * @category Lang
  29358. * @param {*} value The value to check.
  29359. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29360. * @example
  29361. *
  29362. * _.isFinite(3);
  29363. * // => true
  29364. *
  29365. * _.isFinite(Number.MIN_VALUE);
  29366. * // => true
  29367. *
  29368. * _.isFinite(Infinity);
  29369. * // => false
  29370. *
  29371. * _.isFinite('3');
  29372. * // => false
  29373. */
  29374. function isFinite(value) {
  29375. return typeof value == 'number' && nativeIsFinite(value);
  29376. }
  29377. /**
  29378. * Checks if `value` is classified as a `Function` object.
  29379. *
  29380. * @static
  29381. * @memberOf _
  29382. * @since 0.1.0
  29383. * @category Lang
  29384. * @param {*} value The value to check.
  29385. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29386. * @example
  29387. *
  29388. * _.isFunction(_);
  29389. * // => true
  29390. *
  29391. * _.isFunction(/abc/);
  29392. * // => false
  29393. */
  29394. function isFunction(value) {
  29395. if (!isObject(value)) {
  29396. return false;
  29397. }
  29398. // The use of `Object#toString` avoids issues with the `typeof` operator
  29399. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29400. var tag = baseGetTag(value);
  29401. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29402. }
  29403. /**
  29404. * Checks if `value` is an integer.
  29405. *
  29406. * **Note:** This method is based on
  29407. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29408. *
  29409. * @static
  29410. * @memberOf _
  29411. * @since 4.0.0
  29412. * @category Lang
  29413. * @param {*} value The value to check.
  29414. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29415. * @example
  29416. *
  29417. * _.isInteger(3);
  29418. * // => true
  29419. *
  29420. * _.isInteger(Number.MIN_VALUE);
  29421. * // => false
  29422. *
  29423. * _.isInteger(Infinity);
  29424. * // => false
  29425. *
  29426. * _.isInteger('3');
  29427. * // => false
  29428. */
  29429. function isInteger(value) {
  29430. return typeof value == 'number' && value == toInteger(value);
  29431. }
  29432. /**
  29433. * Checks if `value` is a valid array-like length.
  29434. *
  29435. * **Note:** This method is loosely based on
  29436. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29437. *
  29438. * @static
  29439. * @memberOf _
  29440. * @since 4.0.0
  29441. * @category Lang
  29442. * @param {*} value The value to check.
  29443. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29444. * @example
  29445. *
  29446. * _.isLength(3);
  29447. * // => true
  29448. *
  29449. * _.isLength(Number.MIN_VALUE);
  29450. * // => false
  29451. *
  29452. * _.isLength(Infinity);
  29453. * // => false
  29454. *
  29455. * _.isLength('3');
  29456. * // => false
  29457. */
  29458. function isLength(value) {
  29459. return typeof value == 'number' &&
  29460. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29461. }
  29462. /**
  29463. * Checks if `value` is the
  29464. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29465. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29466. *
  29467. * @static
  29468. * @memberOf _
  29469. * @since 0.1.0
  29470. * @category Lang
  29471. * @param {*} value The value to check.
  29472. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29473. * @example
  29474. *
  29475. * _.isObject({});
  29476. * // => true
  29477. *
  29478. * _.isObject([1, 2, 3]);
  29479. * // => true
  29480. *
  29481. * _.isObject(_.noop);
  29482. * // => true
  29483. *
  29484. * _.isObject(null);
  29485. * // => false
  29486. */
  29487. function isObject(value) {
  29488. var type = typeof value;
  29489. return value != null && (type == 'object' || type == 'function');
  29490. }
  29491. /**
  29492. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29493. * and has a `typeof` result of "object".
  29494. *
  29495. * @static
  29496. * @memberOf _
  29497. * @since 4.0.0
  29498. * @category Lang
  29499. * @param {*} value The value to check.
  29500. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29501. * @example
  29502. *
  29503. * _.isObjectLike({});
  29504. * // => true
  29505. *
  29506. * _.isObjectLike([1, 2, 3]);
  29507. * // => true
  29508. *
  29509. * _.isObjectLike(_.noop);
  29510. * // => false
  29511. *
  29512. * _.isObjectLike(null);
  29513. * // => false
  29514. */
  29515. function isObjectLike(value) {
  29516. return value != null && typeof value == 'object';
  29517. }
  29518. /**
  29519. * Checks if `value` is classified as a `Map` object.
  29520. *
  29521. * @static
  29522. * @memberOf _
  29523. * @since 4.3.0
  29524. * @category Lang
  29525. * @param {*} value The value to check.
  29526. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29527. * @example
  29528. *
  29529. * _.isMap(new Map);
  29530. * // => true
  29531. *
  29532. * _.isMap(new WeakMap);
  29533. * // => false
  29534. */
  29535. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29536. /**
  29537. * Performs a partial deep comparison between `object` and `source` to
  29538. * determine if `object` contains equivalent property values.
  29539. *
  29540. * **Note:** This method is equivalent to `_.matches` when `source` is
  29541. * partially applied.
  29542. *
  29543. * Partial comparisons will match empty array and empty object `source`
  29544. * values against any array or object value, respectively. See `_.isEqual`
  29545. * for a list of supported value comparisons.
  29546. *
  29547. * @static
  29548. * @memberOf _
  29549. * @since 3.0.0
  29550. * @category Lang
  29551. * @param {Object} object The object to inspect.
  29552. * @param {Object} source The object of property values to match.
  29553. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29554. * @example
  29555. *
  29556. * var object = { 'a': 1, 'b': 2 };
  29557. *
  29558. * _.isMatch(object, { 'b': 2 });
  29559. * // => true
  29560. *
  29561. * _.isMatch(object, { 'b': 1 });
  29562. * // => false
  29563. */
  29564. function isMatch(object, source) {
  29565. return object === source || baseIsMatch(object, source, getMatchData(source));
  29566. }
  29567. /**
  29568. * This method is like `_.isMatch` except that it accepts `customizer` which
  29569. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29570. * are handled by the method instead. The `customizer` is invoked with five
  29571. * arguments: (objValue, srcValue, index|key, object, source).
  29572. *
  29573. * @static
  29574. * @memberOf _
  29575. * @since 4.0.0
  29576. * @category Lang
  29577. * @param {Object} object The object to inspect.
  29578. * @param {Object} source The object of property values to match.
  29579. * @param {Function} [customizer] The function to customize comparisons.
  29580. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29581. * @example
  29582. *
  29583. * function isGreeting(value) {
  29584. * return /^h(?:i|ello)$/.test(value);
  29585. * }
  29586. *
  29587. * function customizer(objValue, srcValue) {
  29588. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29589. * return true;
  29590. * }
  29591. * }
  29592. *
  29593. * var object = { 'greeting': 'hello' };
  29594. * var source = { 'greeting': 'hi' };
  29595. *
  29596. * _.isMatchWith(object, source, customizer);
  29597. * // => true
  29598. */
  29599. function isMatchWith(object, source, customizer) {
  29600. customizer = typeof customizer == 'function' ? customizer : undefined;
  29601. return baseIsMatch(object, source, getMatchData(source), customizer);
  29602. }
  29603. /**
  29604. * Checks if `value` is `NaN`.
  29605. *
  29606. * **Note:** This method is based on
  29607. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29608. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29609. * `undefined` and other non-number values.
  29610. *
  29611. * @static
  29612. * @memberOf _
  29613. * @since 0.1.0
  29614. * @category Lang
  29615. * @param {*} value The value to check.
  29616. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29617. * @example
  29618. *
  29619. * _.isNaN(NaN);
  29620. * // => true
  29621. *
  29622. * _.isNaN(new Number(NaN));
  29623. * // => true
  29624. *
  29625. * isNaN(undefined);
  29626. * // => true
  29627. *
  29628. * _.isNaN(undefined);
  29629. * // => false
  29630. */
  29631. function isNaN(value) {
  29632. // An `NaN` primitive is the only value that is not equal to itself.
  29633. // Perform the `toStringTag` check first to avoid errors with some
  29634. // ActiveX objects in IE.
  29635. return isNumber(value) && value != +value;
  29636. }
  29637. /**
  29638. * Checks if `value` is a pristine native function.
  29639. *
  29640. * **Note:** This method can't reliably detect native functions in the presence
  29641. * of the core-js package because core-js circumvents this kind of detection.
  29642. * Despite multiple requests, the core-js maintainer has made it clear: any
  29643. * attempt to fix the detection will be obstructed. As a result, we're left
  29644. * with little choice but to throw an error. Unfortunately, this also affects
  29645. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29646. * which rely on core-js.
  29647. *
  29648. * @static
  29649. * @memberOf _
  29650. * @since 3.0.0
  29651. * @category Lang
  29652. * @param {*} value The value to check.
  29653. * @returns {boolean} Returns `true` if `value` is a native function,
  29654. * else `false`.
  29655. * @example
  29656. *
  29657. * _.isNative(Array.prototype.push);
  29658. * // => true
  29659. *
  29660. * _.isNative(_);
  29661. * // => false
  29662. */
  29663. function isNative(value) {
  29664. if (isMaskable(value)) {
  29665. throw new Error(CORE_ERROR_TEXT);
  29666. }
  29667. return baseIsNative(value);
  29668. }
  29669. /**
  29670. * Checks if `value` is `null`.
  29671. *
  29672. * @static
  29673. * @memberOf _
  29674. * @since 0.1.0
  29675. * @category Lang
  29676. * @param {*} value The value to check.
  29677. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29678. * @example
  29679. *
  29680. * _.isNull(null);
  29681. * // => true
  29682. *
  29683. * _.isNull(void 0);
  29684. * // => false
  29685. */
  29686. function isNull(value) {
  29687. return value === null;
  29688. }
  29689. /**
  29690. * Checks if `value` is `null` or `undefined`.
  29691. *
  29692. * @static
  29693. * @memberOf _
  29694. * @since 4.0.0
  29695. * @category Lang
  29696. * @param {*} value The value to check.
  29697. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29698. * @example
  29699. *
  29700. * _.isNil(null);
  29701. * // => true
  29702. *
  29703. * _.isNil(void 0);
  29704. * // => true
  29705. *
  29706. * _.isNil(NaN);
  29707. * // => false
  29708. */
  29709. function isNil(value) {
  29710. return value == null;
  29711. }
  29712. /**
  29713. * Checks if `value` is classified as a `Number` primitive or object.
  29714. *
  29715. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29716. * classified as numbers, use the `_.isFinite` method.
  29717. *
  29718. * @static
  29719. * @memberOf _
  29720. * @since 0.1.0
  29721. * @category Lang
  29722. * @param {*} value The value to check.
  29723. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29724. * @example
  29725. *
  29726. * _.isNumber(3);
  29727. * // => true
  29728. *
  29729. * _.isNumber(Number.MIN_VALUE);
  29730. * // => true
  29731. *
  29732. * _.isNumber(Infinity);
  29733. * // => true
  29734. *
  29735. * _.isNumber('3');
  29736. * // => false
  29737. */
  29738. function isNumber(value) {
  29739. return typeof value == 'number' ||
  29740. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29741. }
  29742. /**
  29743. * Checks if `value` is a plain object, that is, an object created by the
  29744. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29745. *
  29746. * @static
  29747. * @memberOf _
  29748. * @since 0.8.0
  29749. * @category Lang
  29750. * @param {*} value The value to check.
  29751. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29752. * @example
  29753. *
  29754. * function Foo() {
  29755. * this.a = 1;
  29756. * }
  29757. *
  29758. * _.isPlainObject(new Foo);
  29759. * // => false
  29760. *
  29761. * _.isPlainObject([1, 2, 3]);
  29762. * // => false
  29763. *
  29764. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29765. * // => true
  29766. *
  29767. * _.isPlainObject(Object.create(null));
  29768. * // => true
  29769. */
  29770. function isPlainObject(value) {
  29771. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29772. return false;
  29773. }
  29774. var proto = getPrototype(value);
  29775. if (proto === null) {
  29776. return true;
  29777. }
  29778. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29779. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29780. funcToString.call(Ctor) == objectCtorString;
  29781. }
  29782. /**
  29783. * Checks if `value` is classified as a `RegExp` object.
  29784. *
  29785. * @static
  29786. * @memberOf _
  29787. * @since 0.1.0
  29788. * @category Lang
  29789. * @param {*} value The value to check.
  29790. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29791. * @example
  29792. *
  29793. * _.isRegExp(/abc/);
  29794. * // => true
  29795. *
  29796. * _.isRegExp('/abc/');
  29797. * // => false
  29798. */
  29799. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29800. /**
  29801. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29802. * double precision number which isn't the result of a rounded unsafe integer.
  29803. *
  29804. * **Note:** This method is based on
  29805. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29806. *
  29807. * @static
  29808. * @memberOf _
  29809. * @since 4.0.0
  29810. * @category Lang
  29811. * @param {*} value The value to check.
  29812. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29813. * @example
  29814. *
  29815. * _.isSafeInteger(3);
  29816. * // => true
  29817. *
  29818. * _.isSafeInteger(Number.MIN_VALUE);
  29819. * // => false
  29820. *
  29821. * _.isSafeInteger(Infinity);
  29822. * // => false
  29823. *
  29824. * _.isSafeInteger('3');
  29825. * // => false
  29826. */
  29827. function isSafeInteger(value) {
  29828. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29829. }
  29830. /**
  29831. * Checks if `value` is classified as a `Set` object.
  29832. *
  29833. * @static
  29834. * @memberOf _
  29835. * @since 4.3.0
  29836. * @category Lang
  29837. * @param {*} value The value to check.
  29838. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29839. * @example
  29840. *
  29841. * _.isSet(new Set);
  29842. * // => true
  29843. *
  29844. * _.isSet(new WeakSet);
  29845. * // => false
  29846. */
  29847. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29848. /**
  29849. * Checks if `value` is classified as a `String` primitive or object.
  29850. *
  29851. * @static
  29852. * @since 0.1.0
  29853. * @memberOf _
  29854. * @category Lang
  29855. * @param {*} value The value to check.
  29856. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29857. * @example
  29858. *
  29859. * _.isString('abc');
  29860. * // => true
  29861. *
  29862. * _.isString(1);
  29863. * // => false
  29864. */
  29865. function isString(value) {
  29866. return typeof value == 'string' ||
  29867. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29868. }
  29869. /**
  29870. * Checks if `value` is classified as a `Symbol` primitive or object.
  29871. *
  29872. * @static
  29873. * @memberOf _
  29874. * @since 4.0.0
  29875. * @category Lang
  29876. * @param {*} value The value to check.
  29877. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29878. * @example
  29879. *
  29880. * _.isSymbol(Symbol.iterator);
  29881. * // => true
  29882. *
  29883. * _.isSymbol('abc');
  29884. * // => false
  29885. */
  29886. function isSymbol(value) {
  29887. return typeof value == 'symbol' ||
  29888. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29889. }
  29890. /**
  29891. * Checks if `value` is classified as a typed array.
  29892. *
  29893. * @static
  29894. * @memberOf _
  29895. * @since 3.0.0
  29896. * @category Lang
  29897. * @param {*} value The value to check.
  29898. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29899. * @example
  29900. *
  29901. * _.isTypedArray(new Uint8Array);
  29902. * // => true
  29903. *
  29904. * _.isTypedArray([]);
  29905. * // => false
  29906. */
  29907. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29908. /**
  29909. * Checks if `value` is `undefined`.
  29910. *
  29911. * @static
  29912. * @since 0.1.0
  29913. * @memberOf _
  29914. * @category Lang
  29915. * @param {*} value The value to check.
  29916. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29917. * @example
  29918. *
  29919. * _.isUndefined(void 0);
  29920. * // => true
  29921. *
  29922. * _.isUndefined(null);
  29923. * // => false
  29924. */
  29925. function isUndefined(value) {
  29926. return value === undefined;
  29927. }
  29928. /**
  29929. * Checks if `value` is classified as a `WeakMap` object.
  29930. *
  29931. * @static
  29932. * @memberOf _
  29933. * @since 4.3.0
  29934. * @category Lang
  29935. * @param {*} value The value to check.
  29936. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29937. * @example
  29938. *
  29939. * _.isWeakMap(new WeakMap);
  29940. * // => true
  29941. *
  29942. * _.isWeakMap(new Map);
  29943. * // => false
  29944. */
  29945. function isWeakMap(value) {
  29946. return isObjectLike(value) && getTag(value) == weakMapTag;
  29947. }
  29948. /**
  29949. * Checks if `value` is classified as a `WeakSet` object.
  29950. *
  29951. * @static
  29952. * @memberOf _
  29953. * @since 4.3.0
  29954. * @category Lang
  29955. * @param {*} value The value to check.
  29956. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29957. * @example
  29958. *
  29959. * _.isWeakSet(new WeakSet);
  29960. * // => true
  29961. *
  29962. * _.isWeakSet(new Set);
  29963. * // => false
  29964. */
  29965. function isWeakSet(value) {
  29966. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29967. }
  29968. /**
  29969. * Checks if `value` is less than `other`.
  29970. *
  29971. * @static
  29972. * @memberOf _
  29973. * @since 3.9.0
  29974. * @category Lang
  29975. * @param {*} value The value to compare.
  29976. * @param {*} other The other value to compare.
  29977. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29978. * else `false`.
  29979. * @see _.gt
  29980. * @example
  29981. *
  29982. * _.lt(1, 3);
  29983. * // => true
  29984. *
  29985. * _.lt(3, 3);
  29986. * // => false
  29987. *
  29988. * _.lt(3, 1);
  29989. * // => false
  29990. */
  29991. var lt = createRelationalOperation(baseLt);
  29992. /**
  29993. * Checks if `value` is less than or equal to `other`.
  29994. *
  29995. * @static
  29996. * @memberOf _
  29997. * @since 3.9.0
  29998. * @category Lang
  29999. * @param {*} value The value to compare.
  30000. * @param {*} other The other value to compare.
  30001. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30002. * `other`, else `false`.
  30003. * @see _.gte
  30004. * @example
  30005. *
  30006. * _.lte(1, 3);
  30007. * // => true
  30008. *
  30009. * _.lte(3, 3);
  30010. * // => true
  30011. *
  30012. * _.lte(3, 1);
  30013. * // => false
  30014. */
  30015. var lte = createRelationalOperation(function(value, other) {
  30016. return value <= other;
  30017. });
  30018. /**
  30019. * Converts `value` to an array.
  30020. *
  30021. * @static
  30022. * @since 0.1.0
  30023. * @memberOf _
  30024. * @category Lang
  30025. * @param {*} value The value to convert.
  30026. * @returns {Array} Returns the converted array.
  30027. * @example
  30028. *
  30029. * _.toArray({ 'a': 1, 'b': 2 });
  30030. * // => [1, 2]
  30031. *
  30032. * _.toArray('abc');
  30033. * // => ['a', 'b', 'c']
  30034. *
  30035. * _.toArray(1);
  30036. * // => []
  30037. *
  30038. * _.toArray(null);
  30039. * // => []
  30040. */
  30041. function toArray(value) {
  30042. if (!value) {
  30043. return [];
  30044. }
  30045. if (isArrayLike(value)) {
  30046. return isString(value) ? stringToArray(value) : copyArray(value);
  30047. }
  30048. if (symIterator && value[symIterator]) {
  30049. return iteratorToArray(value[symIterator]());
  30050. }
  30051. var tag = getTag(value),
  30052. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30053. return func(value);
  30054. }
  30055. /**
  30056. * Converts `value` to a finite number.
  30057. *
  30058. * @static
  30059. * @memberOf _
  30060. * @since 4.12.0
  30061. * @category Lang
  30062. * @param {*} value The value to convert.
  30063. * @returns {number} Returns the converted number.
  30064. * @example
  30065. *
  30066. * _.toFinite(3.2);
  30067. * // => 3.2
  30068. *
  30069. * _.toFinite(Number.MIN_VALUE);
  30070. * // => 5e-324
  30071. *
  30072. * _.toFinite(Infinity);
  30073. * // => 1.7976931348623157e+308
  30074. *
  30075. * _.toFinite('3.2');
  30076. * // => 3.2
  30077. */
  30078. function toFinite(value) {
  30079. if (!value) {
  30080. return value === 0 ? value : 0;
  30081. }
  30082. value = toNumber(value);
  30083. if (value === INFINITY || value === -INFINITY) {
  30084. var sign = (value < 0 ? -1 : 1);
  30085. return sign * MAX_INTEGER;
  30086. }
  30087. return value === value ? value : 0;
  30088. }
  30089. /**
  30090. * Converts `value` to an integer.
  30091. *
  30092. * **Note:** This method is loosely based on
  30093. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30094. *
  30095. * @static
  30096. * @memberOf _
  30097. * @since 4.0.0
  30098. * @category Lang
  30099. * @param {*} value The value to convert.
  30100. * @returns {number} Returns the converted integer.
  30101. * @example
  30102. *
  30103. * _.toInteger(3.2);
  30104. * // => 3
  30105. *
  30106. * _.toInteger(Number.MIN_VALUE);
  30107. * // => 0
  30108. *
  30109. * _.toInteger(Infinity);
  30110. * // => 1.7976931348623157e+308
  30111. *
  30112. * _.toInteger('3.2');
  30113. * // => 3
  30114. */
  30115. function toInteger(value) {
  30116. var result = toFinite(value),
  30117. remainder = result % 1;
  30118. return result === result ? (remainder ? result - remainder : result) : 0;
  30119. }
  30120. /**
  30121. * Converts `value` to an integer suitable for use as the length of an
  30122. * array-like object.
  30123. *
  30124. * **Note:** This method is based on
  30125. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30126. *
  30127. * @static
  30128. * @memberOf _
  30129. * @since 4.0.0
  30130. * @category Lang
  30131. * @param {*} value The value to convert.
  30132. * @returns {number} Returns the converted integer.
  30133. * @example
  30134. *
  30135. * _.toLength(3.2);
  30136. * // => 3
  30137. *
  30138. * _.toLength(Number.MIN_VALUE);
  30139. * // => 0
  30140. *
  30141. * _.toLength(Infinity);
  30142. * // => 4294967295
  30143. *
  30144. * _.toLength('3.2');
  30145. * // => 3
  30146. */
  30147. function toLength(value) {
  30148. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30149. }
  30150. /**
  30151. * Converts `value` to a number.
  30152. *
  30153. * @static
  30154. * @memberOf _
  30155. * @since 4.0.0
  30156. * @category Lang
  30157. * @param {*} value The value to process.
  30158. * @returns {number} Returns the number.
  30159. * @example
  30160. *
  30161. * _.toNumber(3.2);
  30162. * // => 3.2
  30163. *
  30164. * _.toNumber(Number.MIN_VALUE);
  30165. * // => 5e-324
  30166. *
  30167. * _.toNumber(Infinity);
  30168. * // => Infinity
  30169. *
  30170. * _.toNumber('3.2');
  30171. * // => 3.2
  30172. */
  30173. function toNumber(value) {
  30174. if (typeof value == 'number') {
  30175. return value;
  30176. }
  30177. if (isSymbol(value)) {
  30178. return NAN;
  30179. }
  30180. if (isObject(value)) {
  30181. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30182. value = isObject(other) ? (other + '') : other;
  30183. }
  30184. if (typeof value != 'string') {
  30185. return value === 0 ? value : +value;
  30186. }
  30187. value = value.replace(reTrim, '');
  30188. var isBinary = reIsBinary.test(value);
  30189. return (isBinary || reIsOctal.test(value))
  30190. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30191. : (reIsBadHex.test(value) ? NAN : +value);
  30192. }
  30193. /**
  30194. * Converts `value` to a plain object flattening inherited enumerable string
  30195. * keyed properties of `value` to own properties of the plain object.
  30196. *
  30197. * @static
  30198. * @memberOf _
  30199. * @since 3.0.0
  30200. * @category Lang
  30201. * @param {*} value The value to convert.
  30202. * @returns {Object} Returns the converted plain object.
  30203. * @example
  30204. *
  30205. * function Foo() {
  30206. * this.b = 2;
  30207. * }
  30208. *
  30209. * Foo.prototype.c = 3;
  30210. *
  30211. * _.assign({ 'a': 1 }, new Foo);
  30212. * // => { 'a': 1, 'b': 2 }
  30213. *
  30214. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30215. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30216. */
  30217. function toPlainObject(value) {
  30218. return copyObject(value, keysIn(value));
  30219. }
  30220. /**
  30221. * Converts `value` to a safe integer. A safe integer can be compared and
  30222. * represented correctly.
  30223. *
  30224. * @static
  30225. * @memberOf _
  30226. * @since 4.0.0
  30227. * @category Lang
  30228. * @param {*} value The value to convert.
  30229. * @returns {number} Returns the converted integer.
  30230. * @example
  30231. *
  30232. * _.toSafeInteger(3.2);
  30233. * // => 3
  30234. *
  30235. * _.toSafeInteger(Number.MIN_VALUE);
  30236. * // => 0
  30237. *
  30238. * _.toSafeInteger(Infinity);
  30239. * // => 9007199254740991
  30240. *
  30241. * _.toSafeInteger('3.2');
  30242. * // => 3
  30243. */
  30244. function toSafeInteger(value) {
  30245. return value
  30246. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30247. : (value === 0 ? value : 0);
  30248. }
  30249. /**
  30250. * Converts `value` to a string. An empty string is returned for `null`
  30251. * and `undefined` values. The sign of `-0` is preserved.
  30252. *
  30253. * @static
  30254. * @memberOf _
  30255. * @since 4.0.0
  30256. * @category Lang
  30257. * @param {*} value The value to convert.
  30258. * @returns {string} Returns the converted string.
  30259. * @example
  30260. *
  30261. * _.toString(null);
  30262. * // => ''
  30263. *
  30264. * _.toString(-0);
  30265. * // => '-0'
  30266. *
  30267. * _.toString([1, 2, 3]);
  30268. * // => '1,2,3'
  30269. */
  30270. function toString(value) {
  30271. return value == null ? '' : baseToString(value);
  30272. }
  30273. /*------------------------------------------------------------------------*/
  30274. /**
  30275. * Assigns own enumerable string keyed properties of source objects to the
  30276. * destination object. Source objects are applied from left to right.
  30277. * Subsequent sources overwrite property assignments of previous sources.
  30278. *
  30279. * **Note:** This method mutates `object` and is loosely based on
  30280. * [`Object.assign`](https://mdn.io/Object/assign).
  30281. *
  30282. * @static
  30283. * @memberOf _
  30284. * @since 0.10.0
  30285. * @category Object
  30286. * @param {Object} object The destination object.
  30287. * @param {...Object} [sources] The source objects.
  30288. * @returns {Object} Returns `object`.
  30289. * @see _.assignIn
  30290. * @example
  30291. *
  30292. * function Foo() {
  30293. * this.a = 1;
  30294. * }
  30295. *
  30296. * function Bar() {
  30297. * this.c = 3;
  30298. * }
  30299. *
  30300. * Foo.prototype.b = 2;
  30301. * Bar.prototype.d = 4;
  30302. *
  30303. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30304. * // => { 'a': 1, 'c': 3 }
  30305. */
  30306. var assign = createAssigner(function(object, source) {
  30307. if (isPrototype(source) || isArrayLike(source)) {
  30308. copyObject(source, keys(source), object);
  30309. return;
  30310. }
  30311. for (var key in source) {
  30312. if (hasOwnProperty.call(source, key)) {
  30313. assignValue(object, key, source[key]);
  30314. }
  30315. }
  30316. });
  30317. /**
  30318. * This method is like `_.assign` except that it iterates over own and
  30319. * inherited source properties.
  30320. *
  30321. * **Note:** This method mutates `object`.
  30322. *
  30323. * @static
  30324. * @memberOf _
  30325. * @since 4.0.0
  30326. * @alias extend
  30327. * @category Object
  30328. * @param {Object} object The destination object.
  30329. * @param {...Object} [sources] The source objects.
  30330. * @returns {Object} Returns `object`.
  30331. * @see _.assign
  30332. * @example
  30333. *
  30334. * function Foo() {
  30335. * this.a = 1;
  30336. * }
  30337. *
  30338. * function Bar() {
  30339. * this.c = 3;
  30340. * }
  30341. *
  30342. * Foo.prototype.b = 2;
  30343. * Bar.prototype.d = 4;
  30344. *
  30345. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30346. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30347. */
  30348. var assignIn = createAssigner(function(object, source) {
  30349. copyObject(source, keysIn(source), object);
  30350. });
  30351. /**
  30352. * This method is like `_.assignIn` except that it accepts `customizer`
  30353. * which is invoked to produce the assigned values. If `customizer` returns
  30354. * `undefined`, assignment is handled by the method instead. The `customizer`
  30355. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30356. *
  30357. * **Note:** This method mutates `object`.
  30358. *
  30359. * @static
  30360. * @memberOf _
  30361. * @since 4.0.0
  30362. * @alias extendWith
  30363. * @category Object
  30364. * @param {Object} object The destination object.
  30365. * @param {...Object} sources The source objects.
  30366. * @param {Function} [customizer] The function to customize assigned values.
  30367. * @returns {Object} Returns `object`.
  30368. * @see _.assignWith
  30369. * @example
  30370. *
  30371. * function customizer(objValue, srcValue) {
  30372. * return _.isUndefined(objValue) ? srcValue : objValue;
  30373. * }
  30374. *
  30375. * var defaults = _.partialRight(_.assignInWith, customizer);
  30376. *
  30377. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30378. * // => { 'a': 1, 'b': 2 }
  30379. */
  30380. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30381. copyObject(source, keysIn(source), object, customizer);
  30382. });
  30383. /**
  30384. * This method is like `_.assign` except that it accepts `customizer`
  30385. * which is invoked to produce the assigned values. If `customizer` returns
  30386. * `undefined`, assignment is handled by the method instead. The `customizer`
  30387. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30388. *
  30389. * **Note:** This method mutates `object`.
  30390. *
  30391. * @static
  30392. * @memberOf _
  30393. * @since 4.0.0
  30394. * @category Object
  30395. * @param {Object} object The destination object.
  30396. * @param {...Object} sources The source objects.
  30397. * @param {Function} [customizer] The function to customize assigned values.
  30398. * @returns {Object} Returns `object`.
  30399. * @see _.assignInWith
  30400. * @example
  30401. *
  30402. * function customizer(objValue, srcValue) {
  30403. * return _.isUndefined(objValue) ? srcValue : objValue;
  30404. * }
  30405. *
  30406. * var defaults = _.partialRight(_.assignWith, customizer);
  30407. *
  30408. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30409. * // => { 'a': 1, 'b': 2 }
  30410. */
  30411. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30412. copyObject(source, keys(source), object, customizer);
  30413. });
  30414. /**
  30415. * Creates an array of values corresponding to `paths` of `object`.
  30416. *
  30417. * @static
  30418. * @memberOf _
  30419. * @since 1.0.0
  30420. * @category Object
  30421. * @param {Object} object The object to iterate over.
  30422. * @param {...(string|string[])} [paths] The property paths to pick.
  30423. * @returns {Array} Returns the picked values.
  30424. * @example
  30425. *
  30426. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30427. *
  30428. * _.at(object, ['a[0].b.c', 'a[1]']);
  30429. * // => [3, 4]
  30430. */
  30431. var at = flatRest(baseAt);
  30432. /**
  30433. * Creates an object that inherits from the `prototype` object. If a
  30434. * `properties` object is given, its own enumerable string keyed properties
  30435. * are assigned to the created object.
  30436. *
  30437. * @static
  30438. * @memberOf _
  30439. * @since 2.3.0
  30440. * @category Object
  30441. * @param {Object} prototype The object to inherit from.
  30442. * @param {Object} [properties] The properties to assign to the object.
  30443. * @returns {Object} Returns the new object.
  30444. * @example
  30445. *
  30446. * function Shape() {
  30447. * this.x = 0;
  30448. * this.y = 0;
  30449. * }
  30450. *
  30451. * function Circle() {
  30452. * Shape.call(this);
  30453. * }
  30454. *
  30455. * Circle.prototype = _.create(Shape.prototype, {
  30456. * 'constructor': Circle
  30457. * });
  30458. *
  30459. * var circle = new Circle;
  30460. * circle instanceof Circle;
  30461. * // => true
  30462. *
  30463. * circle instanceof Shape;
  30464. * // => true
  30465. */
  30466. function create(prototype, properties) {
  30467. var result = baseCreate(prototype);
  30468. return properties == null ? result : baseAssign(result, properties);
  30469. }
  30470. /**
  30471. * Assigns own and inherited enumerable string keyed properties of source
  30472. * objects to the destination object for all destination properties that
  30473. * resolve to `undefined`. Source objects are applied from left to right.
  30474. * Once a property is set, additional values of the same property are ignored.
  30475. *
  30476. * **Note:** This method mutates `object`.
  30477. *
  30478. * @static
  30479. * @since 0.1.0
  30480. * @memberOf _
  30481. * @category Object
  30482. * @param {Object} object The destination object.
  30483. * @param {...Object} [sources] The source objects.
  30484. * @returns {Object} Returns `object`.
  30485. * @see _.defaultsDeep
  30486. * @example
  30487. *
  30488. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30489. * // => { 'a': 1, 'b': 2 }
  30490. */
  30491. var defaults = baseRest(function(object, sources) {
  30492. object = Object(object);
  30493. var index = -1;
  30494. var length = sources.length;
  30495. var guard = length > 2 ? sources[2] : undefined;
  30496. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30497. length = 1;
  30498. }
  30499. while (++index < length) {
  30500. var source = sources[index];
  30501. var props = keysIn(source);
  30502. var propsIndex = -1;
  30503. var propsLength = props.length;
  30504. while (++propsIndex < propsLength) {
  30505. var key = props[propsIndex];
  30506. var value = object[key];
  30507. if (value === undefined ||
  30508. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30509. object[key] = source[key];
  30510. }
  30511. }
  30512. }
  30513. return object;
  30514. });
  30515. /**
  30516. * This method is like `_.defaults` except that it recursively assigns
  30517. * default properties.
  30518. *
  30519. * **Note:** This method mutates `object`.
  30520. *
  30521. * @static
  30522. * @memberOf _
  30523. * @since 3.10.0
  30524. * @category Object
  30525. * @param {Object} object The destination object.
  30526. * @param {...Object} [sources] The source objects.
  30527. * @returns {Object} Returns `object`.
  30528. * @see _.defaults
  30529. * @example
  30530. *
  30531. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30532. * // => { 'a': { 'b': 2, 'c': 3 } }
  30533. */
  30534. var defaultsDeep = baseRest(function(args) {
  30535. args.push(undefined, customDefaultsMerge);
  30536. return apply(mergeWith, undefined, args);
  30537. });
  30538. /**
  30539. * This method is like `_.find` except that it returns the key of the first
  30540. * element `predicate` returns truthy for instead of the element itself.
  30541. *
  30542. * @static
  30543. * @memberOf _
  30544. * @since 1.1.0
  30545. * @category Object
  30546. * @param {Object} object The object to inspect.
  30547. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30548. * @returns {string|undefined} Returns the key of the matched element,
  30549. * else `undefined`.
  30550. * @example
  30551. *
  30552. * var users = {
  30553. * 'barney': { 'age': 36, 'active': true },
  30554. * 'fred': { 'age': 40, 'active': false },
  30555. * 'pebbles': { 'age': 1, 'active': true }
  30556. * };
  30557. *
  30558. * _.findKey(users, function(o) { return o.age < 40; });
  30559. * // => 'barney' (iteration order is not guaranteed)
  30560. *
  30561. * // The `_.matches` iteratee shorthand.
  30562. * _.findKey(users, { 'age': 1, 'active': true });
  30563. * // => 'pebbles'
  30564. *
  30565. * // The `_.matchesProperty` iteratee shorthand.
  30566. * _.findKey(users, ['active', false]);
  30567. * // => 'fred'
  30568. *
  30569. * // The `_.property` iteratee shorthand.
  30570. * _.findKey(users, 'active');
  30571. * // => 'barney'
  30572. */
  30573. function findKey(object, predicate) {
  30574. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30575. }
  30576. /**
  30577. * This method is like `_.findKey` except that it iterates over elements of
  30578. * a collection in the opposite order.
  30579. *
  30580. * @static
  30581. * @memberOf _
  30582. * @since 2.0.0
  30583. * @category Object
  30584. * @param {Object} object The object to inspect.
  30585. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30586. * @returns {string|undefined} Returns the key of the matched element,
  30587. * else `undefined`.
  30588. * @example
  30589. *
  30590. * var users = {
  30591. * 'barney': { 'age': 36, 'active': true },
  30592. * 'fred': { 'age': 40, 'active': false },
  30593. * 'pebbles': { 'age': 1, 'active': true }
  30594. * };
  30595. *
  30596. * _.findLastKey(users, function(o) { return o.age < 40; });
  30597. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30598. *
  30599. * // The `_.matches` iteratee shorthand.
  30600. * _.findLastKey(users, { 'age': 36, 'active': true });
  30601. * // => 'barney'
  30602. *
  30603. * // The `_.matchesProperty` iteratee shorthand.
  30604. * _.findLastKey(users, ['active', false]);
  30605. * // => 'fred'
  30606. *
  30607. * // The `_.property` iteratee shorthand.
  30608. * _.findLastKey(users, 'active');
  30609. * // => 'pebbles'
  30610. */
  30611. function findLastKey(object, predicate) {
  30612. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30613. }
  30614. /**
  30615. * Iterates over own and inherited enumerable string keyed properties of an
  30616. * object and invokes `iteratee` for each property. The iteratee is invoked
  30617. * with three arguments: (value, key, object). Iteratee functions may exit
  30618. * iteration early by explicitly returning `false`.
  30619. *
  30620. * @static
  30621. * @memberOf _
  30622. * @since 0.3.0
  30623. * @category Object
  30624. * @param {Object} object The object to iterate over.
  30625. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30626. * @returns {Object} Returns `object`.
  30627. * @see _.forInRight
  30628. * @example
  30629. *
  30630. * function Foo() {
  30631. * this.a = 1;
  30632. * this.b = 2;
  30633. * }
  30634. *
  30635. * Foo.prototype.c = 3;
  30636. *
  30637. * _.forIn(new Foo, function(value, key) {
  30638. * console.log(key);
  30639. * });
  30640. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30641. */
  30642. function forIn(object, iteratee) {
  30643. return object == null
  30644. ? object
  30645. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30646. }
  30647. /**
  30648. * This method is like `_.forIn` except that it iterates over properties of
  30649. * `object` in the opposite order.
  30650. *
  30651. * @static
  30652. * @memberOf _
  30653. * @since 2.0.0
  30654. * @category Object
  30655. * @param {Object} object The object to iterate over.
  30656. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30657. * @returns {Object} Returns `object`.
  30658. * @see _.forIn
  30659. * @example
  30660. *
  30661. * function Foo() {
  30662. * this.a = 1;
  30663. * this.b = 2;
  30664. * }
  30665. *
  30666. * Foo.prototype.c = 3;
  30667. *
  30668. * _.forInRight(new Foo, function(value, key) {
  30669. * console.log(key);
  30670. * });
  30671. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30672. */
  30673. function forInRight(object, iteratee) {
  30674. return object == null
  30675. ? object
  30676. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30677. }
  30678. /**
  30679. * Iterates over own enumerable string keyed properties of an object and
  30680. * invokes `iteratee` for each property. The iteratee is invoked with three
  30681. * arguments: (value, key, object). Iteratee functions may exit iteration
  30682. * early by explicitly returning `false`.
  30683. *
  30684. * @static
  30685. * @memberOf _
  30686. * @since 0.3.0
  30687. * @category Object
  30688. * @param {Object} object The object to iterate over.
  30689. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30690. * @returns {Object} Returns `object`.
  30691. * @see _.forOwnRight
  30692. * @example
  30693. *
  30694. * function Foo() {
  30695. * this.a = 1;
  30696. * this.b = 2;
  30697. * }
  30698. *
  30699. * Foo.prototype.c = 3;
  30700. *
  30701. * _.forOwn(new Foo, function(value, key) {
  30702. * console.log(key);
  30703. * });
  30704. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30705. */
  30706. function forOwn(object, iteratee) {
  30707. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30708. }
  30709. /**
  30710. * This method is like `_.forOwn` except that it iterates over properties of
  30711. * `object` in the opposite order.
  30712. *
  30713. * @static
  30714. * @memberOf _
  30715. * @since 2.0.0
  30716. * @category Object
  30717. * @param {Object} object The object to iterate over.
  30718. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30719. * @returns {Object} Returns `object`.
  30720. * @see _.forOwn
  30721. * @example
  30722. *
  30723. * function Foo() {
  30724. * this.a = 1;
  30725. * this.b = 2;
  30726. * }
  30727. *
  30728. * Foo.prototype.c = 3;
  30729. *
  30730. * _.forOwnRight(new Foo, function(value, key) {
  30731. * console.log(key);
  30732. * });
  30733. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30734. */
  30735. function forOwnRight(object, iteratee) {
  30736. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30737. }
  30738. /**
  30739. * Creates an array of function property names from own enumerable properties
  30740. * of `object`.
  30741. *
  30742. * @static
  30743. * @since 0.1.0
  30744. * @memberOf _
  30745. * @category Object
  30746. * @param {Object} object The object to inspect.
  30747. * @returns {Array} Returns the function names.
  30748. * @see _.functionsIn
  30749. * @example
  30750. *
  30751. * function Foo() {
  30752. * this.a = _.constant('a');
  30753. * this.b = _.constant('b');
  30754. * }
  30755. *
  30756. * Foo.prototype.c = _.constant('c');
  30757. *
  30758. * _.functions(new Foo);
  30759. * // => ['a', 'b']
  30760. */
  30761. function functions(object) {
  30762. return object == null ? [] : baseFunctions(object, keys(object));
  30763. }
  30764. /**
  30765. * Creates an array of function property names from own and inherited
  30766. * enumerable properties of `object`.
  30767. *
  30768. * @static
  30769. * @memberOf _
  30770. * @since 4.0.0
  30771. * @category Object
  30772. * @param {Object} object The object to inspect.
  30773. * @returns {Array} Returns the function names.
  30774. * @see _.functions
  30775. * @example
  30776. *
  30777. * function Foo() {
  30778. * this.a = _.constant('a');
  30779. * this.b = _.constant('b');
  30780. * }
  30781. *
  30782. * Foo.prototype.c = _.constant('c');
  30783. *
  30784. * _.functionsIn(new Foo);
  30785. * // => ['a', 'b', 'c']
  30786. */
  30787. function functionsIn(object) {
  30788. return object == null ? [] : baseFunctions(object, keysIn(object));
  30789. }
  30790. /**
  30791. * Gets the value at `path` of `object`. If the resolved value is
  30792. * `undefined`, the `defaultValue` is returned in its place.
  30793. *
  30794. * @static
  30795. * @memberOf _
  30796. * @since 3.7.0
  30797. * @category Object
  30798. * @param {Object} object The object to query.
  30799. * @param {Array|string} path The path of the property to get.
  30800. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30801. * @returns {*} Returns the resolved value.
  30802. * @example
  30803. *
  30804. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30805. *
  30806. * _.get(object, 'a[0].b.c');
  30807. * // => 3
  30808. *
  30809. * _.get(object, ['a', '0', 'b', 'c']);
  30810. * // => 3
  30811. *
  30812. * _.get(object, 'a.b.c', 'default');
  30813. * // => 'default'
  30814. */
  30815. function get(object, path, defaultValue) {
  30816. var result = object == null ? undefined : baseGet(object, path);
  30817. return result === undefined ? defaultValue : result;
  30818. }
  30819. /**
  30820. * Checks if `path` is a direct property of `object`.
  30821. *
  30822. * @static
  30823. * @since 0.1.0
  30824. * @memberOf _
  30825. * @category Object
  30826. * @param {Object} object The object to query.
  30827. * @param {Array|string} path The path to check.
  30828. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30829. * @example
  30830. *
  30831. * var object = { 'a': { 'b': 2 } };
  30832. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30833. *
  30834. * _.has(object, 'a');
  30835. * // => true
  30836. *
  30837. * _.has(object, 'a.b');
  30838. * // => true
  30839. *
  30840. * _.has(object, ['a', 'b']);
  30841. * // => true
  30842. *
  30843. * _.has(other, 'a');
  30844. * // => false
  30845. */
  30846. function has(object, path) {
  30847. return object != null && hasPath(object, path, baseHas);
  30848. }
  30849. /**
  30850. * Checks if `path` is a direct or inherited property of `object`.
  30851. *
  30852. * @static
  30853. * @memberOf _
  30854. * @since 4.0.0
  30855. * @category Object
  30856. * @param {Object} object The object to query.
  30857. * @param {Array|string} path The path to check.
  30858. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30859. * @example
  30860. *
  30861. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30862. *
  30863. * _.hasIn(object, 'a');
  30864. * // => true
  30865. *
  30866. * _.hasIn(object, 'a.b');
  30867. * // => true
  30868. *
  30869. * _.hasIn(object, ['a', 'b']);
  30870. * // => true
  30871. *
  30872. * _.hasIn(object, 'b');
  30873. * // => false
  30874. */
  30875. function hasIn(object, path) {
  30876. return object != null && hasPath(object, path, baseHasIn);
  30877. }
  30878. /**
  30879. * Creates an object composed of the inverted keys and values of `object`.
  30880. * If `object` contains duplicate values, subsequent values overwrite
  30881. * property assignments of previous values.
  30882. *
  30883. * @static
  30884. * @memberOf _
  30885. * @since 0.7.0
  30886. * @category Object
  30887. * @param {Object} object The object to invert.
  30888. * @returns {Object} Returns the new inverted object.
  30889. * @example
  30890. *
  30891. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30892. *
  30893. * _.invert(object);
  30894. * // => { '1': 'c', '2': 'b' }
  30895. */
  30896. var invert = createInverter(function(result, value, key) {
  30897. if (value != null &&
  30898. typeof value.toString != 'function') {
  30899. value = nativeObjectToString.call(value);
  30900. }
  30901. result[value] = key;
  30902. }, constant(identity));
  30903. /**
  30904. * This method is like `_.invert` except that the inverted object is generated
  30905. * from the results of running each element of `object` thru `iteratee`. The
  30906. * corresponding inverted value of each inverted key is an array of keys
  30907. * responsible for generating the inverted value. The iteratee is invoked
  30908. * with one argument: (value).
  30909. *
  30910. * @static
  30911. * @memberOf _
  30912. * @since 4.1.0
  30913. * @category Object
  30914. * @param {Object} object The object to invert.
  30915. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30916. * @returns {Object} Returns the new inverted object.
  30917. * @example
  30918. *
  30919. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30920. *
  30921. * _.invertBy(object);
  30922. * // => { '1': ['a', 'c'], '2': ['b'] }
  30923. *
  30924. * _.invertBy(object, function(value) {
  30925. * return 'group' + value;
  30926. * });
  30927. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30928. */
  30929. var invertBy = createInverter(function(result, value, key) {
  30930. if (value != null &&
  30931. typeof value.toString != 'function') {
  30932. value = nativeObjectToString.call(value);
  30933. }
  30934. if (hasOwnProperty.call(result, value)) {
  30935. result[value].push(key);
  30936. } else {
  30937. result[value] = [key];
  30938. }
  30939. }, getIteratee);
  30940. /**
  30941. * Invokes the method at `path` of `object`.
  30942. *
  30943. * @static
  30944. * @memberOf _
  30945. * @since 4.0.0
  30946. * @category Object
  30947. * @param {Object} object The object to query.
  30948. * @param {Array|string} path The path of the method to invoke.
  30949. * @param {...*} [args] The arguments to invoke the method with.
  30950. * @returns {*} Returns the result of the invoked method.
  30951. * @example
  30952. *
  30953. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30954. *
  30955. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30956. * // => [2, 3]
  30957. */
  30958. var invoke = baseRest(baseInvoke);
  30959. /**
  30960. * Creates an array of the own enumerable property names of `object`.
  30961. *
  30962. * **Note:** Non-object values are coerced to objects. See the
  30963. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30964. * for more details.
  30965. *
  30966. * @static
  30967. * @since 0.1.0
  30968. * @memberOf _
  30969. * @category Object
  30970. * @param {Object} object The object to query.
  30971. * @returns {Array} Returns the array of property names.
  30972. * @example
  30973. *
  30974. * function Foo() {
  30975. * this.a = 1;
  30976. * this.b = 2;
  30977. * }
  30978. *
  30979. * Foo.prototype.c = 3;
  30980. *
  30981. * _.keys(new Foo);
  30982. * // => ['a', 'b'] (iteration order is not guaranteed)
  30983. *
  30984. * _.keys('hi');
  30985. * // => ['0', '1']
  30986. */
  30987. function keys(object) {
  30988. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30989. }
  30990. /**
  30991. * Creates an array of the own and inherited enumerable property names of `object`.
  30992. *
  30993. * **Note:** Non-object values are coerced to objects.
  30994. *
  30995. * @static
  30996. * @memberOf _
  30997. * @since 3.0.0
  30998. * @category Object
  30999. * @param {Object} object The object to query.
  31000. * @returns {Array} Returns the array of property names.
  31001. * @example
  31002. *
  31003. * function Foo() {
  31004. * this.a = 1;
  31005. * this.b = 2;
  31006. * }
  31007. *
  31008. * Foo.prototype.c = 3;
  31009. *
  31010. * _.keysIn(new Foo);
  31011. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31012. */
  31013. function keysIn(object) {
  31014. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31015. }
  31016. /**
  31017. * The opposite of `_.mapValues`; this method creates an object with the
  31018. * same values as `object` and keys generated by running each own enumerable
  31019. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31020. * with three arguments: (value, key, object).
  31021. *
  31022. * @static
  31023. * @memberOf _
  31024. * @since 3.8.0
  31025. * @category Object
  31026. * @param {Object} object The object to iterate over.
  31027. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31028. * @returns {Object} Returns the new mapped object.
  31029. * @see _.mapValues
  31030. * @example
  31031. *
  31032. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31033. * return key + value;
  31034. * });
  31035. * // => { 'a1': 1, 'b2': 2 }
  31036. */
  31037. function mapKeys(object, iteratee) {
  31038. var result = {};
  31039. iteratee = getIteratee(iteratee, 3);
  31040. baseForOwn(object, function(value, key, object) {
  31041. baseAssignValue(result, iteratee(value, key, object), value);
  31042. });
  31043. return result;
  31044. }
  31045. /**
  31046. * Creates an object with the same keys as `object` and values generated
  31047. * by running each own enumerable string keyed property of `object` thru
  31048. * `iteratee`. The iteratee is invoked with three arguments:
  31049. * (value, key, object).
  31050. *
  31051. * @static
  31052. * @memberOf _
  31053. * @since 2.4.0
  31054. * @category Object
  31055. * @param {Object} object The object to iterate over.
  31056. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31057. * @returns {Object} Returns the new mapped object.
  31058. * @see _.mapKeys
  31059. * @example
  31060. *
  31061. * var users = {
  31062. * 'fred': { 'user': 'fred', 'age': 40 },
  31063. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31064. * };
  31065. *
  31066. * _.mapValues(users, function(o) { return o.age; });
  31067. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31068. *
  31069. * // The `_.property` iteratee shorthand.
  31070. * _.mapValues(users, 'age');
  31071. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31072. */
  31073. function mapValues(object, iteratee) {
  31074. var result = {};
  31075. iteratee = getIteratee(iteratee, 3);
  31076. baseForOwn(object, function(value, key, object) {
  31077. baseAssignValue(result, key, iteratee(value, key, object));
  31078. });
  31079. return result;
  31080. }
  31081. /**
  31082. * This method is like `_.assign` except that it recursively merges own and
  31083. * inherited enumerable string keyed properties of source objects into the
  31084. * destination object. Source properties that resolve to `undefined` are
  31085. * skipped if a destination value exists. Array and plain object properties
  31086. * are merged recursively. Other objects and value types are overridden by
  31087. * assignment. Source objects are applied from left to right. Subsequent
  31088. * sources overwrite property assignments of previous sources.
  31089. *
  31090. * **Note:** This method mutates `object`.
  31091. *
  31092. * @static
  31093. * @memberOf _
  31094. * @since 0.5.0
  31095. * @category Object
  31096. * @param {Object} object The destination object.
  31097. * @param {...Object} [sources] The source objects.
  31098. * @returns {Object} Returns `object`.
  31099. * @example
  31100. *
  31101. * var object = {
  31102. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31103. * };
  31104. *
  31105. * var other = {
  31106. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31107. * };
  31108. *
  31109. * _.merge(object, other);
  31110. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31111. */
  31112. var merge = createAssigner(function(object, source, srcIndex) {
  31113. baseMerge(object, source, srcIndex);
  31114. });
  31115. /**
  31116. * This method is like `_.merge` except that it accepts `customizer` which
  31117. * is invoked to produce the merged values of the destination and source
  31118. * properties. If `customizer` returns `undefined`, merging is handled by the
  31119. * method instead. The `customizer` is invoked with six arguments:
  31120. * (objValue, srcValue, key, object, source, stack).
  31121. *
  31122. * **Note:** This method mutates `object`.
  31123. *
  31124. * @static
  31125. * @memberOf _
  31126. * @since 4.0.0
  31127. * @category Object
  31128. * @param {Object} object The destination object.
  31129. * @param {...Object} sources The source objects.
  31130. * @param {Function} customizer The function to customize assigned values.
  31131. * @returns {Object} Returns `object`.
  31132. * @example
  31133. *
  31134. * function customizer(objValue, srcValue) {
  31135. * if (_.isArray(objValue)) {
  31136. * return objValue.concat(srcValue);
  31137. * }
  31138. * }
  31139. *
  31140. * var object = { 'a': [1], 'b': [2] };
  31141. * var other = { 'a': [3], 'b': [4] };
  31142. *
  31143. * _.mergeWith(object, other, customizer);
  31144. * // => { 'a': [1, 3], 'b': [2, 4] }
  31145. */
  31146. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31147. baseMerge(object, source, srcIndex, customizer);
  31148. });
  31149. /**
  31150. * The opposite of `_.pick`; this method creates an object composed of the
  31151. * own and inherited enumerable property paths of `object` that are not omitted.
  31152. *
  31153. * **Note:** This method is considerably slower than `_.pick`.
  31154. *
  31155. * @static
  31156. * @since 0.1.0
  31157. * @memberOf _
  31158. * @category Object
  31159. * @param {Object} object The source object.
  31160. * @param {...(string|string[])} [paths] The property paths to omit.
  31161. * @returns {Object} Returns the new object.
  31162. * @example
  31163. *
  31164. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31165. *
  31166. * _.omit(object, ['a', 'c']);
  31167. * // => { 'b': '2' }
  31168. */
  31169. var omit = flatRest(function(object, paths) {
  31170. var result = {};
  31171. if (object == null) {
  31172. return result;
  31173. }
  31174. var isDeep = false;
  31175. paths = arrayMap(paths, function(path) {
  31176. path = castPath(path, object);
  31177. isDeep || (isDeep = path.length > 1);
  31178. return path;
  31179. });
  31180. copyObject(object, getAllKeysIn(object), result);
  31181. if (isDeep) {
  31182. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31183. }
  31184. var length = paths.length;
  31185. while (length--) {
  31186. baseUnset(result, paths[length]);
  31187. }
  31188. return result;
  31189. });
  31190. /**
  31191. * The opposite of `_.pickBy`; this method creates an object composed of
  31192. * the own and inherited enumerable string keyed properties of `object` that
  31193. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31194. * arguments: (value, key).
  31195. *
  31196. * @static
  31197. * @memberOf _
  31198. * @since 4.0.0
  31199. * @category Object
  31200. * @param {Object} object The source object.
  31201. * @param {Function} [predicate=_.identity] The function invoked per property.
  31202. * @returns {Object} Returns the new object.
  31203. * @example
  31204. *
  31205. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31206. *
  31207. * _.omitBy(object, _.isNumber);
  31208. * // => { 'b': '2' }
  31209. */
  31210. function omitBy(object, predicate) {
  31211. return pickBy(object, negate(getIteratee(predicate)));
  31212. }
  31213. /**
  31214. * Creates an object composed of the picked `object` properties.
  31215. *
  31216. * @static
  31217. * @since 0.1.0
  31218. * @memberOf _
  31219. * @category Object
  31220. * @param {Object} object The source object.
  31221. * @param {...(string|string[])} [paths] The property paths to pick.
  31222. * @returns {Object} Returns the new object.
  31223. * @example
  31224. *
  31225. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31226. *
  31227. * _.pick(object, ['a', 'c']);
  31228. * // => { 'a': 1, 'c': 3 }
  31229. */
  31230. var pick = flatRest(function(object, paths) {
  31231. return object == null ? {} : basePick(object, paths);
  31232. });
  31233. /**
  31234. * Creates an object composed of the `object` properties `predicate` returns
  31235. * truthy for. The predicate is invoked with two arguments: (value, key).
  31236. *
  31237. * @static
  31238. * @memberOf _
  31239. * @since 4.0.0
  31240. * @category Object
  31241. * @param {Object} object The source object.
  31242. * @param {Function} [predicate=_.identity] The function invoked per property.
  31243. * @returns {Object} Returns the new object.
  31244. * @example
  31245. *
  31246. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31247. *
  31248. * _.pickBy(object, _.isNumber);
  31249. * // => { 'a': 1, 'c': 3 }
  31250. */
  31251. function pickBy(object, predicate) {
  31252. if (object == null) {
  31253. return {};
  31254. }
  31255. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31256. return [prop];
  31257. });
  31258. predicate = getIteratee(predicate);
  31259. return basePickBy(object, props, function(value, path) {
  31260. return predicate(value, path[0]);
  31261. });
  31262. }
  31263. /**
  31264. * This method is like `_.get` except that if the resolved value is a
  31265. * function it's invoked with the `this` binding of its parent object and
  31266. * its result is returned.
  31267. *
  31268. * @static
  31269. * @since 0.1.0
  31270. * @memberOf _
  31271. * @category Object
  31272. * @param {Object} object The object to query.
  31273. * @param {Array|string} path The path of the property to resolve.
  31274. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31275. * @returns {*} Returns the resolved value.
  31276. * @example
  31277. *
  31278. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31279. *
  31280. * _.result(object, 'a[0].b.c1');
  31281. * // => 3
  31282. *
  31283. * _.result(object, 'a[0].b.c2');
  31284. * // => 4
  31285. *
  31286. * _.result(object, 'a[0].b.c3', 'default');
  31287. * // => 'default'
  31288. *
  31289. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31290. * // => 'default'
  31291. */
  31292. function result(object, path, defaultValue) {
  31293. path = castPath(path, object);
  31294. var index = -1,
  31295. length = path.length;
  31296. // Ensure the loop is entered when path is empty.
  31297. if (!length) {
  31298. length = 1;
  31299. object = undefined;
  31300. }
  31301. while (++index < length) {
  31302. var value = object == null ? undefined : object[toKey(path[index])];
  31303. if (value === undefined) {
  31304. index = length;
  31305. value = defaultValue;
  31306. }
  31307. object = isFunction(value) ? value.call(object) : value;
  31308. }
  31309. return object;
  31310. }
  31311. /**
  31312. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31313. * it's created. Arrays are created for missing index properties while objects
  31314. * are created for all other missing properties. Use `_.setWith` to customize
  31315. * `path` creation.
  31316. *
  31317. * **Note:** This method mutates `object`.
  31318. *
  31319. * @static
  31320. * @memberOf _
  31321. * @since 3.7.0
  31322. * @category Object
  31323. * @param {Object} object The object to modify.
  31324. * @param {Array|string} path The path of the property to set.
  31325. * @param {*} value The value to set.
  31326. * @returns {Object} Returns `object`.
  31327. * @example
  31328. *
  31329. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31330. *
  31331. * _.set(object, 'a[0].b.c', 4);
  31332. * console.log(object.a[0].b.c);
  31333. * // => 4
  31334. *
  31335. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31336. * console.log(object.x[0].y.z);
  31337. * // => 5
  31338. */
  31339. function set(object, path, value) {
  31340. return object == null ? object : baseSet(object, path, value);
  31341. }
  31342. /**
  31343. * This method is like `_.set` except that it accepts `customizer` which is
  31344. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31345. * path creation is handled by the method instead. The `customizer` is invoked
  31346. * with three arguments: (nsValue, key, nsObject).
  31347. *
  31348. * **Note:** This method mutates `object`.
  31349. *
  31350. * @static
  31351. * @memberOf _
  31352. * @since 4.0.0
  31353. * @category Object
  31354. * @param {Object} object The object to modify.
  31355. * @param {Array|string} path The path of the property to set.
  31356. * @param {*} value The value to set.
  31357. * @param {Function} [customizer] The function to customize assigned values.
  31358. * @returns {Object} Returns `object`.
  31359. * @example
  31360. *
  31361. * var object = {};
  31362. *
  31363. * _.setWith(object, '[0][1]', 'a', Object);
  31364. * // => { '0': { '1': 'a' } }
  31365. */
  31366. function setWith(object, path, value, customizer) {
  31367. customizer = typeof customizer == 'function' ? customizer : undefined;
  31368. return object == null ? object : baseSet(object, path, value, customizer);
  31369. }
  31370. /**
  31371. * Creates an array of own enumerable string keyed-value pairs for `object`
  31372. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31373. * entries are returned.
  31374. *
  31375. * @static
  31376. * @memberOf _
  31377. * @since 4.0.0
  31378. * @alias entries
  31379. * @category Object
  31380. * @param {Object} object The object to query.
  31381. * @returns {Array} Returns the key-value pairs.
  31382. * @example
  31383. *
  31384. * function Foo() {
  31385. * this.a = 1;
  31386. * this.b = 2;
  31387. * }
  31388. *
  31389. * Foo.prototype.c = 3;
  31390. *
  31391. * _.toPairs(new Foo);
  31392. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31393. */
  31394. var toPairs = createToPairs(keys);
  31395. /**
  31396. * Creates an array of own and inherited enumerable string keyed-value pairs
  31397. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31398. * or set, its entries are returned.
  31399. *
  31400. * @static
  31401. * @memberOf _
  31402. * @since 4.0.0
  31403. * @alias entriesIn
  31404. * @category Object
  31405. * @param {Object} object The object to query.
  31406. * @returns {Array} Returns the key-value pairs.
  31407. * @example
  31408. *
  31409. * function Foo() {
  31410. * this.a = 1;
  31411. * this.b = 2;
  31412. * }
  31413. *
  31414. * Foo.prototype.c = 3;
  31415. *
  31416. * _.toPairsIn(new Foo);
  31417. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31418. */
  31419. var toPairsIn = createToPairs(keysIn);
  31420. /**
  31421. * An alternative to `_.reduce`; this method transforms `object` to a new
  31422. * `accumulator` object which is the result of running each of its own
  31423. * enumerable string keyed properties thru `iteratee`, with each invocation
  31424. * potentially mutating the `accumulator` object. If `accumulator` is not
  31425. * provided, a new object with the same `[[Prototype]]` will be used. The
  31426. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31427. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31428. *
  31429. * @static
  31430. * @memberOf _
  31431. * @since 1.3.0
  31432. * @category Object
  31433. * @param {Object} object The object to iterate over.
  31434. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31435. * @param {*} [accumulator] The custom accumulator value.
  31436. * @returns {*} Returns the accumulated value.
  31437. * @example
  31438. *
  31439. * _.transform([2, 3, 4], function(result, n) {
  31440. * result.push(n *= n);
  31441. * return n % 2 == 0;
  31442. * }, []);
  31443. * // => [4, 9]
  31444. *
  31445. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31446. * (result[value] || (result[value] = [])).push(key);
  31447. * }, {});
  31448. * // => { '1': ['a', 'c'], '2': ['b'] }
  31449. */
  31450. function transform(object, iteratee, accumulator) {
  31451. var isArr = isArray(object),
  31452. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31453. iteratee = getIteratee(iteratee, 4);
  31454. if (accumulator == null) {
  31455. var Ctor = object && object.constructor;
  31456. if (isArrLike) {
  31457. accumulator = isArr ? new Ctor : [];
  31458. }
  31459. else if (isObject(object)) {
  31460. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31461. }
  31462. else {
  31463. accumulator = {};
  31464. }
  31465. }
  31466. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31467. return iteratee(accumulator, value, index, object);
  31468. });
  31469. return accumulator;
  31470. }
  31471. /**
  31472. * Removes the property at `path` of `object`.
  31473. *
  31474. * **Note:** This method mutates `object`.
  31475. *
  31476. * @static
  31477. * @memberOf _
  31478. * @since 4.0.0
  31479. * @category Object
  31480. * @param {Object} object The object to modify.
  31481. * @param {Array|string} path The path of the property to unset.
  31482. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31483. * @example
  31484. *
  31485. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31486. * _.unset(object, 'a[0].b.c');
  31487. * // => true
  31488. *
  31489. * console.log(object);
  31490. * // => { 'a': [{ 'b': {} }] };
  31491. *
  31492. * _.unset(object, ['a', '0', 'b', 'c']);
  31493. * // => true
  31494. *
  31495. * console.log(object);
  31496. * // => { 'a': [{ 'b': {} }] };
  31497. */
  31498. function unset(object, path) {
  31499. return object == null ? true : baseUnset(object, path);
  31500. }
  31501. /**
  31502. * This method is like `_.set` except that accepts `updater` to produce the
  31503. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31504. * is invoked with one argument: (value).
  31505. *
  31506. * **Note:** This method mutates `object`.
  31507. *
  31508. * @static
  31509. * @memberOf _
  31510. * @since 4.6.0
  31511. * @category Object
  31512. * @param {Object} object The object to modify.
  31513. * @param {Array|string} path The path of the property to set.
  31514. * @param {Function} updater The function to produce the updated value.
  31515. * @returns {Object} Returns `object`.
  31516. * @example
  31517. *
  31518. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31519. *
  31520. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31521. * console.log(object.a[0].b.c);
  31522. * // => 9
  31523. *
  31524. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31525. * console.log(object.x[0].y.z);
  31526. * // => 0
  31527. */
  31528. function update(object, path, updater) {
  31529. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31530. }
  31531. /**
  31532. * This method is like `_.update` except that it accepts `customizer` which is
  31533. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31534. * path creation is handled by the method instead. The `customizer` is invoked
  31535. * with three arguments: (nsValue, key, nsObject).
  31536. *
  31537. * **Note:** This method mutates `object`.
  31538. *
  31539. * @static
  31540. * @memberOf _
  31541. * @since 4.6.0
  31542. * @category Object
  31543. * @param {Object} object The object to modify.
  31544. * @param {Array|string} path The path of the property to set.
  31545. * @param {Function} updater The function to produce the updated value.
  31546. * @param {Function} [customizer] The function to customize assigned values.
  31547. * @returns {Object} Returns `object`.
  31548. * @example
  31549. *
  31550. * var object = {};
  31551. *
  31552. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31553. * // => { '0': { '1': 'a' } }
  31554. */
  31555. function updateWith(object, path, updater, customizer) {
  31556. customizer = typeof customizer == 'function' ? customizer : undefined;
  31557. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31558. }
  31559. /**
  31560. * Creates an array of the own enumerable string keyed property values of `object`.
  31561. *
  31562. * **Note:** Non-object values are coerced to objects.
  31563. *
  31564. * @static
  31565. * @since 0.1.0
  31566. * @memberOf _
  31567. * @category Object
  31568. * @param {Object} object The object to query.
  31569. * @returns {Array} Returns the array of property values.
  31570. * @example
  31571. *
  31572. * function Foo() {
  31573. * this.a = 1;
  31574. * this.b = 2;
  31575. * }
  31576. *
  31577. * Foo.prototype.c = 3;
  31578. *
  31579. * _.values(new Foo);
  31580. * // => [1, 2] (iteration order is not guaranteed)
  31581. *
  31582. * _.values('hi');
  31583. * // => ['h', 'i']
  31584. */
  31585. function values(object) {
  31586. return object == null ? [] : baseValues(object, keys(object));
  31587. }
  31588. /**
  31589. * Creates an array of the own and inherited enumerable string keyed property
  31590. * values of `object`.
  31591. *
  31592. * **Note:** Non-object values are coerced to objects.
  31593. *
  31594. * @static
  31595. * @memberOf _
  31596. * @since 3.0.0
  31597. * @category Object
  31598. * @param {Object} object The object to query.
  31599. * @returns {Array} Returns the array of property values.
  31600. * @example
  31601. *
  31602. * function Foo() {
  31603. * this.a = 1;
  31604. * this.b = 2;
  31605. * }
  31606. *
  31607. * Foo.prototype.c = 3;
  31608. *
  31609. * _.valuesIn(new Foo);
  31610. * // => [1, 2, 3] (iteration order is not guaranteed)
  31611. */
  31612. function valuesIn(object) {
  31613. return object == null ? [] : baseValues(object, keysIn(object));
  31614. }
  31615. /*------------------------------------------------------------------------*/
  31616. /**
  31617. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31618. *
  31619. * @static
  31620. * @memberOf _
  31621. * @since 4.0.0
  31622. * @category Number
  31623. * @param {number} number The number to clamp.
  31624. * @param {number} [lower] The lower bound.
  31625. * @param {number} upper The upper bound.
  31626. * @returns {number} Returns the clamped number.
  31627. * @example
  31628. *
  31629. * _.clamp(-10, -5, 5);
  31630. * // => -5
  31631. *
  31632. * _.clamp(10, -5, 5);
  31633. * // => 5
  31634. */
  31635. function clamp(number, lower, upper) {
  31636. if (upper === undefined) {
  31637. upper = lower;
  31638. lower = undefined;
  31639. }
  31640. if (upper !== undefined) {
  31641. upper = toNumber(upper);
  31642. upper = upper === upper ? upper : 0;
  31643. }
  31644. if (lower !== undefined) {
  31645. lower = toNumber(lower);
  31646. lower = lower === lower ? lower : 0;
  31647. }
  31648. return baseClamp(toNumber(number), lower, upper);
  31649. }
  31650. /**
  31651. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31652. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31653. * If `start` is greater than `end` the params are swapped to support
  31654. * negative ranges.
  31655. *
  31656. * @static
  31657. * @memberOf _
  31658. * @since 3.3.0
  31659. * @category Number
  31660. * @param {number} number The number to check.
  31661. * @param {number} [start=0] The start of the range.
  31662. * @param {number} end The end of the range.
  31663. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31664. * @see _.range, _.rangeRight
  31665. * @example
  31666. *
  31667. * _.inRange(3, 2, 4);
  31668. * // => true
  31669. *
  31670. * _.inRange(4, 8);
  31671. * // => true
  31672. *
  31673. * _.inRange(4, 2);
  31674. * // => false
  31675. *
  31676. * _.inRange(2, 2);
  31677. * // => false
  31678. *
  31679. * _.inRange(1.2, 2);
  31680. * // => true
  31681. *
  31682. * _.inRange(5.2, 4);
  31683. * // => false
  31684. *
  31685. * _.inRange(-3, -2, -6);
  31686. * // => true
  31687. */
  31688. function inRange(number, start, end) {
  31689. start = toFinite(start);
  31690. if (end === undefined) {
  31691. end = start;
  31692. start = 0;
  31693. } else {
  31694. end = toFinite(end);
  31695. }
  31696. number = toNumber(number);
  31697. return baseInRange(number, start, end);
  31698. }
  31699. /**
  31700. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31701. * If only one argument is provided a number between `0` and the given number
  31702. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31703. * floats, a floating-point number is returned instead of an integer.
  31704. *
  31705. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31706. * floating-point values which can produce unexpected results.
  31707. *
  31708. * @static
  31709. * @memberOf _
  31710. * @since 0.7.0
  31711. * @category Number
  31712. * @param {number} [lower=0] The lower bound.
  31713. * @param {number} [upper=1] The upper bound.
  31714. * @param {boolean} [floating] Specify returning a floating-point number.
  31715. * @returns {number} Returns the random number.
  31716. * @example
  31717. *
  31718. * _.random(0, 5);
  31719. * // => an integer between 0 and 5
  31720. *
  31721. * _.random(5);
  31722. * // => also an integer between 0 and 5
  31723. *
  31724. * _.random(5, true);
  31725. * // => a floating-point number between 0 and 5
  31726. *
  31727. * _.random(1.2, 5.2);
  31728. * // => a floating-point number between 1.2 and 5.2
  31729. */
  31730. function random(lower, upper, floating) {
  31731. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31732. upper = floating = undefined;
  31733. }
  31734. if (floating === undefined) {
  31735. if (typeof upper == 'boolean') {
  31736. floating = upper;
  31737. upper = undefined;
  31738. }
  31739. else if (typeof lower == 'boolean') {
  31740. floating = lower;
  31741. lower = undefined;
  31742. }
  31743. }
  31744. if (lower === undefined && upper === undefined) {
  31745. lower = 0;
  31746. upper = 1;
  31747. }
  31748. else {
  31749. lower = toFinite(lower);
  31750. if (upper === undefined) {
  31751. upper = lower;
  31752. lower = 0;
  31753. } else {
  31754. upper = toFinite(upper);
  31755. }
  31756. }
  31757. if (lower > upper) {
  31758. var temp = lower;
  31759. lower = upper;
  31760. upper = temp;
  31761. }
  31762. if (floating || lower % 1 || upper % 1) {
  31763. var rand = nativeRandom();
  31764. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31765. }
  31766. return baseRandom(lower, upper);
  31767. }
  31768. /*------------------------------------------------------------------------*/
  31769. /**
  31770. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31771. *
  31772. * @static
  31773. * @memberOf _
  31774. * @since 3.0.0
  31775. * @category String
  31776. * @param {string} [string=''] The string to convert.
  31777. * @returns {string} Returns the camel cased string.
  31778. * @example
  31779. *
  31780. * _.camelCase('Foo Bar');
  31781. * // => 'fooBar'
  31782. *
  31783. * _.camelCase('--foo-bar--');
  31784. * // => 'fooBar'
  31785. *
  31786. * _.camelCase('__FOO_BAR__');
  31787. * // => 'fooBar'
  31788. */
  31789. var camelCase = createCompounder(function(result, word, index) {
  31790. word = word.toLowerCase();
  31791. return result + (index ? capitalize(word) : word);
  31792. });
  31793. /**
  31794. * Converts the first character of `string` to upper case and the remaining
  31795. * to lower case.
  31796. *
  31797. * @static
  31798. * @memberOf _
  31799. * @since 3.0.0
  31800. * @category String
  31801. * @param {string} [string=''] The string to capitalize.
  31802. * @returns {string} Returns the capitalized string.
  31803. * @example
  31804. *
  31805. * _.capitalize('FRED');
  31806. * // => 'Fred'
  31807. */
  31808. function capitalize(string) {
  31809. return upperFirst(toString(string).toLowerCase());
  31810. }
  31811. /**
  31812. * Deburrs `string` by converting
  31813. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31814. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31815. * letters to basic Latin letters and removing
  31816. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31817. *
  31818. * @static
  31819. * @memberOf _
  31820. * @since 3.0.0
  31821. * @category String
  31822. * @param {string} [string=''] The string to deburr.
  31823. * @returns {string} Returns the deburred string.
  31824. * @example
  31825. *
  31826. * _.deburr('déjà vu');
  31827. * // => 'deja vu'
  31828. */
  31829. function deburr(string) {
  31830. string = toString(string);
  31831. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31832. }
  31833. /**
  31834. * Checks if `string` ends with the given target string.
  31835. *
  31836. * @static
  31837. * @memberOf _
  31838. * @since 3.0.0
  31839. * @category String
  31840. * @param {string} [string=''] The string to inspect.
  31841. * @param {string} [target] The string to search for.
  31842. * @param {number} [position=string.length] The position to search up to.
  31843. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31844. * else `false`.
  31845. * @example
  31846. *
  31847. * _.endsWith('abc', 'c');
  31848. * // => true
  31849. *
  31850. * _.endsWith('abc', 'b');
  31851. * // => false
  31852. *
  31853. * _.endsWith('abc', 'b', 2);
  31854. * // => true
  31855. */
  31856. function endsWith(string, target, position) {
  31857. string = toString(string);
  31858. target = baseToString(target);
  31859. var length = string.length;
  31860. position = position === undefined
  31861. ? length
  31862. : baseClamp(toInteger(position), 0, length);
  31863. var end = position;
  31864. position -= target.length;
  31865. return position >= 0 && string.slice(position, end) == target;
  31866. }
  31867. /**
  31868. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31869. * corresponding HTML entities.
  31870. *
  31871. * **Note:** No other characters are escaped. To escape additional
  31872. * characters use a third-party library like [_he_](https://mths.be/he).
  31873. *
  31874. * Though the ">" character is escaped for symmetry, characters like
  31875. * ">" and "/" don't need escaping in HTML and have no special meaning
  31876. * unless they're part of a tag or unquoted attribute value. See
  31877. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31878. * (under "semi-related fun fact") for more details.
  31879. *
  31880. * When working with HTML you should always
  31881. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31882. * XSS vectors.
  31883. *
  31884. * @static
  31885. * @since 0.1.0
  31886. * @memberOf _
  31887. * @category String
  31888. * @param {string} [string=''] The string to escape.
  31889. * @returns {string} Returns the escaped string.
  31890. * @example
  31891. *
  31892. * _.escape('fred, barney, & pebbles');
  31893. * // => 'fred, barney, &amp; pebbles'
  31894. */
  31895. function escape(string) {
  31896. string = toString(string);
  31897. return (string && reHasUnescapedHtml.test(string))
  31898. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31899. : string;
  31900. }
  31901. /**
  31902. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31903. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31904. *
  31905. * @static
  31906. * @memberOf _
  31907. * @since 3.0.0
  31908. * @category String
  31909. * @param {string} [string=''] The string to escape.
  31910. * @returns {string} Returns the escaped string.
  31911. * @example
  31912. *
  31913. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31914. * // => '\[lodash\]\(https://lodash\.com/\)'
  31915. */
  31916. function escapeRegExp(string) {
  31917. string = toString(string);
  31918. return (string && reHasRegExpChar.test(string))
  31919. ? string.replace(reRegExpChar, '\\$&')
  31920. : string;
  31921. }
  31922. /**
  31923. * Converts `string` to
  31924. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31925. *
  31926. * @static
  31927. * @memberOf _
  31928. * @since 3.0.0
  31929. * @category String
  31930. * @param {string} [string=''] The string to convert.
  31931. * @returns {string} Returns the kebab cased string.
  31932. * @example
  31933. *
  31934. * _.kebabCase('Foo Bar');
  31935. * // => 'foo-bar'
  31936. *
  31937. * _.kebabCase('fooBar');
  31938. * // => 'foo-bar'
  31939. *
  31940. * _.kebabCase('__FOO_BAR__');
  31941. * // => 'foo-bar'
  31942. */
  31943. var kebabCase = createCompounder(function(result, word, index) {
  31944. return result + (index ? '-' : '') + word.toLowerCase();
  31945. });
  31946. /**
  31947. * Converts `string`, as space separated words, to lower case.
  31948. *
  31949. * @static
  31950. * @memberOf _
  31951. * @since 4.0.0
  31952. * @category String
  31953. * @param {string} [string=''] The string to convert.
  31954. * @returns {string} Returns the lower cased string.
  31955. * @example
  31956. *
  31957. * _.lowerCase('--Foo-Bar--');
  31958. * // => 'foo bar'
  31959. *
  31960. * _.lowerCase('fooBar');
  31961. * // => 'foo bar'
  31962. *
  31963. * _.lowerCase('__FOO_BAR__');
  31964. * // => 'foo bar'
  31965. */
  31966. var lowerCase = createCompounder(function(result, word, index) {
  31967. return result + (index ? ' ' : '') + word.toLowerCase();
  31968. });
  31969. /**
  31970. * Converts the first character of `string` to lower case.
  31971. *
  31972. * @static
  31973. * @memberOf _
  31974. * @since 4.0.0
  31975. * @category String
  31976. * @param {string} [string=''] The string to convert.
  31977. * @returns {string} Returns the converted string.
  31978. * @example
  31979. *
  31980. * _.lowerFirst('Fred');
  31981. * // => 'fred'
  31982. *
  31983. * _.lowerFirst('FRED');
  31984. * // => 'fRED'
  31985. */
  31986. var lowerFirst = createCaseFirst('toLowerCase');
  31987. /**
  31988. * Pads `string` on the left and right sides if it's shorter than `length`.
  31989. * Padding characters are truncated if they can't be evenly divided by `length`.
  31990. *
  31991. * @static
  31992. * @memberOf _
  31993. * @since 3.0.0
  31994. * @category String
  31995. * @param {string} [string=''] The string to pad.
  31996. * @param {number} [length=0] The padding length.
  31997. * @param {string} [chars=' '] The string used as padding.
  31998. * @returns {string} Returns the padded string.
  31999. * @example
  32000. *
  32001. * _.pad('abc', 8);
  32002. * // => ' abc '
  32003. *
  32004. * _.pad('abc', 8, '_-');
  32005. * // => '_-abc_-_'
  32006. *
  32007. * _.pad('abc', 3);
  32008. * // => 'abc'
  32009. */
  32010. function pad(string, length, chars) {
  32011. string = toString(string);
  32012. length = toInteger(length);
  32013. var strLength = length ? stringSize(string) : 0;
  32014. if (!length || strLength >= length) {
  32015. return string;
  32016. }
  32017. var mid = (length - strLength) / 2;
  32018. return (
  32019. createPadding(nativeFloor(mid), chars) +
  32020. string +
  32021. createPadding(nativeCeil(mid), chars)
  32022. );
  32023. }
  32024. /**
  32025. * Pads `string` on the right side if it's shorter than `length`. Padding
  32026. * characters are truncated if they exceed `length`.
  32027. *
  32028. * @static
  32029. * @memberOf _
  32030. * @since 4.0.0
  32031. * @category String
  32032. * @param {string} [string=''] The string to pad.
  32033. * @param {number} [length=0] The padding length.
  32034. * @param {string} [chars=' '] The string used as padding.
  32035. * @returns {string} Returns the padded string.
  32036. * @example
  32037. *
  32038. * _.padEnd('abc', 6);
  32039. * // => 'abc '
  32040. *
  32041. * _.padEnd('abc', 6, '_-');
  32042. * // => 'abc_-_'
  32043. *
  32044. * _.padEnd('abc', 3);
  32045. * // => 'abc'
  32046. */
  32047. function padEnd(string, length, chars) {
  32048. string = toString(string);
  32049. length = toInteger(length);
  32050. var strLength = length ? stringSize(string) : 0;
  32051. return (length && strLength < length)
  32052. ? (string + createPadding(length - strLength, chars))
  32053. : string;
  32054. }
  32055. /**
  32056. * Pads `string` on the left side if it's shorter than `length`. Padding
  32057. * characters are truncated if they exceed `length`.
  32058. *
  32059. * @static
  32060. * @memberOf _
  32061. * @since 4.0.0
  32062. * @category String
  32063. * @param {string} [string=''] The string to pad.
  32064. * @param {number} [length=0] The padding length.
  32065. * @param {string} [chars=' '] The string used as padding.
  32066. * @returns {string} Returns the padded string.
  32067. * @example
  32068. *
  32069. * _.padStart('abc', 6);
  32070. * // => ' abc'
  32071. *
  32072. * _.padStart('abc', 6, '_-');
  32073. * // => '_-_abc'
  32074. *
  32075. * _.padStart('abc', 3);
  32076. * // => 'abc'
  32077. */
  32078. function padStart(string, length, chars) {
  32079. string = toString(string);
  32080. length = toInteger(length);
  32081. var strLength = length ? stringSize(string) : 0;
  32082. return (length && strLength < length)
  32083. ? (createPadding(length - strLength, chars) + string)
  32084. : string;
  32085. }
  32086. /**
  32087. * Converts `string` to an integer of the specified radix. If `radix` is
  32088. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32089. * hexadecimal, in which case a `radix` of `16` is used.
  32090. *
  32091. * **Note:** This method aligns with the
  32092. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32093. *
  32094. * @static
  32095. * @memberOf _
  32096. * @since 1.1.0
  32097. * @category String
  32098. * @param {string} string The string to convert.
  32099. * @param {number} [radix=10] The radix to interpret `value` by.
  32100. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32101. * @returns {number} Returns the converted integer.
  32102. * @example
  32103. *
  32104. * _.parseInt('08');
  32105. * // => 8
  32106. *
  32107. * _.map(['6', '08', '10'], _.parseInt);
  32108. * // => [6, 8, 10]
  32109. */
  32110. function parseInt(string, radix, guard) {
  32111. if (guard || radix == null) {
  32112. radix = 0;
  32113. } else if (radix) {
  32114. radix = +radix;
  32115. }
  32116. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32117. }
  32118. /**
  32119. * Repeats the given string `n` times.
  32120. *
  32121. * @static
  32122. * @memberOf _
  32123. * @since 3.0.0
  32124. * @category String
  32125. * @param {string} [string=''] The string to repeat.
  32126. * @param {number} [n=1] The number of times to repeat the string.
  32127. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32128. * @returns {string} Returns the repeated string.
  32129. * @example
  32130. *
  32131. * _.repeat('*', 3);
  32132. * // => '***'
  32133. *
  32134. * _.repeat('abc', 2);
  32135. * // => 'abcabc'
  32136. *
  32137. * _.repeat('abc', 0);
  32138. * // => ''
  32139. */
  32140. function repeat(string, n, guard) {
  32141. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32142. n = 1;
  32143. } else {
  32144. n = toInteger(n);
  32145. }
  32146. return baseRepeat(toString(string), n);
  32147. }
  32148. /**
  32149. * Replaces matches for `pattern` in `string` with `replacement`.
  32150. *
  32151. * **Note:** This method is based on
  32152. * [`String#replace`](https://mdn.io/String/replace).
  32153. *
  32154. * @static
  32155. * @memberOf _
  32156. * @since 4.0.0
  32157. * @category String
  32158. * @param {string} [string=''] The string to modify.
  32159. * @param {RegExp|string} pattern The pattern to replace.
  32160. * @param {Function|string} replacement The match replacement.
  32161. * @returns {string} Returns the modified string.
  32162. * @example
  32163. *
  32164. * _.replace('Hi Fred', 'Fred', 'Barney');
  32165. * // => 'Hi Barney'
  32166. */
  32167. function replace() {
  32168. var args = arguments,
  32169. string = toString(args[0]);
  32170. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32171. }
  32172. /**
  32173. * Converts `string` to
  32174. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32175. *
  32176. * @static
  32177. * @memberOf _
  32178. * @since 3.0.0
  32179. * @category String
  32180. * @param {string} [string=''] The string to convert.
  32181. * @returns {string} Returns the snake cased string.
  32182. * @example
  32183. *
  32184. * _.snakeCase('Foo Bar');
  32185. * // => 'foo_bar'
  32186. *
  32187. * _.snakeCase('fooBar');
  32188. * // => 'foo_bar'
  32189. *
  32190. * _.snakeCase('--FOO-BAR--');
  32191. * // => 'foo_bar'
  32192. */
  32193. var snakeCase = createCompounder(function(result, word, index) {
  32194. return result + (index ? '_' : '') + word.toLowerCase();
  32195. });
  32196. /**
  32197. * Splits `string` by `separator`.
  32198. *
  32199. * **Note:** This method is based on
  32200. * [`String#split`](https://mdn.io/String/split).
  32201. *
  32202. * @static
  32203. * @memberOf _
  32204. * @since 4.0.0
  32205. * @category String
  32206. * @param {string} [string=''] The string to split.
  32207. * @param {RegExp|string} separator The separator pattern to split by.
  32208. * @param {number} [limit] The length to truncate results to.
  32209. * @returns {Array} Returns the string segments.
  32210. * @example
  32211. *
  32212. * _.split('a-b-c', '-', 2);
  32213. * // => ['a', 'b']
  32214. */
  32215. function split(string, separator, limit) {
  32216. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32217. separator = limit = undefined;
  32218. }
  32219. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32220. if (!limit) {
  32221. return [];
  32222. }
  32223. string = toString(string);
  32224. if (string && (
  32225. typeof separator == 'string' ||
  32226. (separator != null && !isRegExp(separator))
  32227. )) {
  32228. separator = baseToString(separator);
  32229. if (!separator && hasUnicode(string)) {
  32230. return castSlice(stringToArray(string), 0, limit);
  32231. }
  32232. }
  32233. return string.split(separator, limit);
  32234. }
  32235. /**
  32236. * Converts `string` to
  32237. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32238. *
  32239. * @static
  32240. * @memberOf _
  32241. * @since 3.1.0
  32242. * @category String
  32243. * @param {string} [string=''] The string to convert.
  32244. * @returns {string} Returns the start cased string.
  32245. * @example
  32246. *
  32247. * _.startCase('--foo-bar--');
  32248. * // => 'Foo Bar'
  32249. *
  32250. * _.startCase('fooBar');
  32251. * // => 'Foo Bar'
  32252. *
  32253. * _.startCase('__FOO_BAR__');
  32254. * // => 'FOO BAR'
  32255. */
  32256. var startCase = createCompounder(function(result, word, index) {
  32257. return result + (index ? ' ' : '') + upperFirst(word);
  32258. });
  32259. /**
  32260. * Checks if `string` starts with the given target string.
  32261. *
  32262. * @static
  32263. * @memberOf _
  32264. * @since 3.0.0
  32265. * @category String
  32266. * @param {string} [string=''] The string to inspect.
  32267. * @param {string} [target] The string to search for.
  32268. * @param {number} [position=0] The position to search from.
  32269. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32270. * else `false`.
  32271. * @example
  32272. *
  32273. * _.startsWith('abc', 'a');
  32274. * // => true
  32275. *
  32276. * _.startsWith('abc', 'b');
  32277. * // => false
  32278. *
  32279. * _.startsWith('abc', 'b', 1);
  32280. * // => true
  32281. */
  32282. function startsWith(string, target, position) {
  32283. string = toString(string);
  32284. position = position == null
  32285. ? 0
  32286. : baseClamp(toInteger(position), 0, string.length);
  32287. target = baseToString(target);
  32288. return string.slice(position, position + target.length) == target;
  32289. }
  32290. /**
  32291. * Creates a compiled template function that can interpolate data properties
  32292. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32293. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32294. * properties may be accessed as free variables in the template. If a setting
  32295. * object is given, it takes precedence over `_.templateSettings` values.
  32296. *
  32297. * **Note:** In the development build `_.template` utilizes
  32298. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32299. * for easier debugging.
  32300. *
  32301. * For more information on precompiling templates see
  32302. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32303. *
  32304. * For more information on Chrome extension sandboxes see
  32305. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32306. *
  32307. * @static
  32308. * @since 0.1.0
  32309. * @memberOf _
  32310. * @category String
  32311. * @param {string} [string=''] The template string.
  32312. * @param {Object} [options={}] The options object.
  32313. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32314. * The HTML "escape" delimiter.
  32315. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32316. * The "evaluate" delimiter.
  32317. * @param {Object} [options.imports=_.templateSettings.imports]
  32318. * An object to import into the template as free variables.
  32319. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32320. * The "interpolate" delimiter.
  32321. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32322. * The sourceURL of the compiled template.
  32323. * @param {string} [options.variable='obj']
  32324. * The data object variable name.
  32325. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32326. * @returns {Function} Returns the compiled template function.
  32327. * @example
  32328. *
  32329. * // Use the "interpolate" delimiter to create a compiled template.
  32330. * var compiled = _.template('hello <%= user %>!');
  32331. * compiled({ 'user': 'fred' });
  32332. * // => 'hello fred!'
  32333. *
  32334. * // Use the HTML "escape" delimiter to escape data property values.
  32335. * var compiled = _.template('<b><%- value %></b>');
  32336. * compiled({ 'value': '<script>' });
  32337. * // => '<b>&lt;script&gt;</b>'
  32338. *
  32339. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32340. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32341. * compiled({ 'users': ['fred', 'barney'] });
  32342. * // => '<li>fred</li><li>barney</li>'
  32343. *
  32344. * // Use the internal `print` function in "evaluate" delimiters.
  32345. * var compiled = _.template('<% print("hello " + user); %>!');
  32346. * compiled({ 'user': 'barney' });
  32347. * // => 'hello barney!'
  32348. *
  32349. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32350. * // Disable support by replacing the "interpolate" delimiter.
  32351. * var compiled = _.template('hello ${ user }!');
  32352. * compiled({ 'user': 'pebbles' });
  32353. * // => 'hello pebbles!'
  32354. *
  32355. * // Use backslashes to treat delimiters as plain text.
  32356. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32357. * compiled({ 'value': 'ignored' });
  32358. * // => '<%- value %>'
  32359. *
  32360. * // Use the `imports` option to import `jQuery` as `jq`.
  32361. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32362. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32363. * compiled({ 'users': ['fred', 'barney'] });
  32364. * // => '<li>fred</li><li>barney</li>'
  32365. *
  32366. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32367. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32368. * compiled(data);
  32369. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32370. *
  32371. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32372. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32373. * compiled.source;
  32374. * // => function(data) {
  32375. * // var __t, __p = '';
  32376. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32377. * // return __p;
  32378. * // }
  32379. *
  32380. * // Use custom template delimiters.
  32381. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32382. * var compiled = _.template('hello {{ user }}!');
  32383. * compiled({ 'user': 'mustache' });
  32384. * // => 'hello mustache!'
  32385. *
  32386. * // Use the `source` property to inline compiled templates for meaningful
  32387. * // line numbers in error messages and stack traces.
  32388. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32389. * var JST = {\
  32390. * "main": ' + _.template(mainText).source + '\
  32391. * };\
  32392. * ');
  32393. */
  32394. function template(string, options, guard) {
  32395. // Based on John Resig's `tmpl` implementation
  32396. // (http://ejohn.org/blog/javascript-micro-templating/)
  32397. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32398. var settings = lodash.templateSettings;
  32399. if (guard && isIterateeCall(string, options, guard)) {
  32400. options = undefined;
  32401. }
  32402. string = toString(string);
  32403. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32404. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32405. importsKeys = keys(imports),
  32406. importsValues = baseValues(imports, importsKeys);
  32407. var isEscaping,
  32408. isEvaluating,
  32409. index = 0,
  32410. interpolate = options.interpolate || reNoMatch,
  32411. source = "__p += '";
  32412. // Compile the regexp to match each delimiter.
  32413. var reDelimiters = RegExp(
  32414. (options.escape || reNoMatch).source + '|' +
  32415. interpolate.source + '|' +
  32416. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32417. (options.evaluate || reNoMatch).source + '|$'
  32418. , 'g');
  32419. // Use a sourceURL for easier debugging.
  32420. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32421. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32422. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32423. var sourceURL = '//# sourceURL=' +
  32424. (hasOwnProperty.call(options, 'sourceURL')
  32425. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32426. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32427. ) + '\n';
  32428. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32429. interpolateValue || (interpolateValue = esTemplateValue);
  32430. // Escape characters that can't be included in string literals.
  32431. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32432. // Replace delimiters with snippets.
  32433. if (escapeValue) {
  32434. isEscaping = true;
  32435. source += "' +\n__e(" + escapeValue + ") +\n'";
  32436. }
  32437. if (evaluateValue) {
  32438. isEvaluating = true;
  32439. source += "';\n" + evaluateValue + ";\n__p += '";
  32440. }
  32441. if (interpolateValue) {
  32442. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32443. }
  32444. index = offset + match.length;
  32445. // The JS engine embedded in Adobe products needs `match` returned in
  32446. // order to produce the correct `offset` value.
  32447. return match;
  32448. });
  32449. source += "';\n";
  32450. // If `variable` is not specified wrap a with-statement around the generated
  32451. // code to add the data object to the top of the scope chain.
  32452. // Like with sourceURL, we take care to not check the option's prototype,
  32453. // as this configuration is a code injection vector.
  32454. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32455. if (!variable) {
  32456. source = 'with (obj) {\n' + source + '\n}\n';
  32457. }
  32458. // Cleanup code by stripping empty strings.
  32459. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32460. .replace(reEmptyStringMiddle, '$1')
  32461. .replace(reEmptyStringTrailing, '$1;');
  32462. // Frame code as the function body.
  32463. source = 'function(' + (variable || 'obj') + ') {\n' +
  32464. (variable
  32465. ? ''
  32466. : 'obj || (obj = {});\n'
  32467. ) +
  32468. "var __t, __p = ''" +
  32469. (isEscaping
  32470. ? ', __e = _.escape'
  32471. : ''
  32472. ) +
  32473. (isEvaluating
  32474. ? ', __j = Array.prototype.join;\n' +
  32475. "function print() { __p += __j.call(arguments, '') }\n"
  32476. : ';\n'
  32477. ) +
  32478. source +
  32479. 'return __p\n}';
  32480. var result = attempt(function() {
  32481. return Function(importsKeys, sourceURL + 'return ' + source)
  32482. .apply(undefined, importsValues);
  32483. });
  32484. // Provide the compiled function's source by its `toString` method or
  32485. // the `source` property as a convenience for inlining compiled templates.
  32486. result.source = source;
  32487. if (isError(result)) {
  32488. throw result;
  32489. }
  32490. return result;
  32491. }
  32492. /**
  32493. * Converts `string`, as a whole, to lower case just like
  32494. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32495. *
  32496. * @static
  32497. * @memberOf _
  32498. * @since 4.0.0
  32499. * @category String
  32500. * @param {string} [string=''] The string to convert.
  32501. * @returns {string} Returns the lower cased string.
  32502. * @example
  32503. *
  32504. * _.toLower('--Foo-Bar--');
  32505. * // => '--foo-bar--'
  32506. *
  32507. * _.toLower('fooBar');
  32508. * // => 'foobar'
  32509. *
  32510. * _.toLower('__FOO_BAR__');
  32511. * // => '__foo_bar__'
  32512. */
  32513. function toLower(value) {
  32514. return toString(value).toLowerCase();
  32515. }
  32516. /**
  32517. * Converts `string`, as a whole, to upper case just like
  32518. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32519. *
  32520. * @static
  32521. * @memberOf _
  32522. * @since 4.0.0
  32523. * @category String
  32524. * @param {string} [string=''] The string to convert.
  32525. * @returns {string} Returns the upper cased string.
  32526. * @example
  32527. *
  32528. * _.toUpper('--foo-bar--');
  32529. * // => '--FOO-BAR--'
  32530. *
  32531. * _.toUpper('fooBar');
  32532. * // => 'FOOBAR'
  32533. *
  32534. * _.toUpper('__foo_bar__');
  32535. * // => '__FOO_BAR__'
  32536. */
  32537. function toUpper(value) {
  32538. return toString(value).toUpperCase();
  32539. }
  32540. /**
  32541. * Removes leading and trailing whitespace or specified characters from `string`.
  32542. *
  32543. * @static
  32544. * @memberOf _
  32545. * @since 3.0.0
  32546. * @category String
  32547. * @param {string} [string=''] The string to trim.
  32548. * @param {string} [chars=whitespace] The characters to trim.
  32549. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32550. * @returns {string} Returns the trimmed string.
  32551. * @example
  32552. *
  32553. * _.trim(' abc ');
  32554. * // => 'abc'
  32555. *
  32556. * _.trim('-_-abc-_-', '_-');
  32557. * // => 'abc'
  32558. *
  32559. * _.map([' foo ', ' bar '], _.trim);
  32560. * // => ['foo', 'bar']
  32561. */
  32562. function trim(string, chars, guard) {
  32563. string = toString(string);
  32564. if (string && (guard || chars === undefined)) {
  32565. return string.replace(reTrim, '');
  32566. }
  32567. if (!string || !(chars = baseToString(chars))) {
  32568. return string;
  32569. }
  32570. var strSymbols = stringToArray(string),
  32571. chrSymbols = stringToArray(chars),
  32572. start = charsStartIndex(strSymbols, chrSymbols),
  32573. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32574. return castSlice(strSymbols, start, end).join('');
  32575. }
  32576. /**
  32577. * Removes trailing whitespace or specified characters from `string`.
  32578. *
  32579. * @static
  32580. * @memberOf _
  32581. * @since 4.0.0
  32582. * @category String
  32583. * @param {string} [string=''] The string to trim.
  32584. * @param {string} [chars=whitespace] The characters to trim.
  32585. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32586. * @returns {string} Returns the trimmed string.
  32587. * @example
  32588. *
  32589. * _.trimEnd(' abc ');
  32590. * // => ' abc'
  32591. *
  32592. * _.trimEnd('-_-abc-_-', '_-');
  32593. * // => '-_-abc'
  32594. */
  32595. function trimEnd(string, chars, guard) {
  32596. string = toString(string);
  32597. if (string && (guard || chars === undefined)) {
  32598. return string.replace(reTrimEnd, '');
  32599. }
  32600. if (!string || !(chars = baseToString(chars))) {
  32601. return string;
  32602. }
  32603. var strSymbols = stringToArray(string),
  32604. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32605. return castSlice(strSymbols, 0, end).join('');
  32606. }
  32607. /**
  32608. * Removes leading whitespace or specified characters from `string`.
  32609. *
  32610. * @static
  32611. * @memberOf _
  32612. * @since 4.0.0
  32613. * @category String
  32614. * @param {string} [string=''] The string to trim.
  32615. * @param {string} [chars=whitespace] The characters to trim.
  32616. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32617. * @returns {string} Returns the trimmed string.
  32618. * @example
  32619. *
  32620. * _.trimStart(' abc ');
  32621. * // => 'abc '
  32622. *
  32623. * _.trimStart('-_-abc-_-', '_-');
  32624. * // => 'abc-_-'
  32625. */
  32626. function trimStart(string, chars, guard) {
  32627. string = toString(string);
  32628. if (string && (guard || chars === undefined)) {
  32629. return string.replace(reTrimStart, '');
  32630. }
  32631. if (!string || !(chars = baseToString(chars))) {
  32632. return string;
  32633. }
  32634. var strSymbols = stringToArray(string),
  32635. start = charsStartIndex(strSymbols, stringToArray(chars));
  32636. return castSlice(strSymbols, start).join('');
  32637. }
  32638. /**
  32639. * Truncates `string` if it's longer than the given maximum string length.
  32640. * The last characters of the truncated string are replaced with the omission
  32641. * string which defaults to "...".
  32642. *
  32643. * @static
  32644. * @memberOf _
  32645. * @since 4.0.0
  32646. * @category String
  32647. * @param {string} [string=''] The string to truncate.
  32648. * @param {Object} [options={}] The options object.
  32649. * @param {number} [options.length=30] The maximum string length.
  32650. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32651. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32652. * @returns {string} Returns the truncated string.
  32653. * @example
  32654. *
  32655. * _.truncate('hi-diddly-ho there, neighborino');
  32656. * // => 'hi-diddly-ho there, neighbo...'
  32657. *
  32658. * _.truncate('hi-diddly-ho there, neighborino', {
  32659. * 'length': 24,
  32660. * 'separator': ' '
  32661. * });
  32662. * // => 'hi-diddly-ho there,...'
  32663. *
  32664. * _.truncate('hi-diddly-ho there, neighborino', {
  32665. * 'length': 24,
  32666. * 'separator': /,? +/
  32667. * });
  32668. * // => 'hi-diddly-ho there...'
  32669. *
  32670. * _.truncate('hi-diddly-ho there, neighborino', {
  32671. * 'omission': ' [...]'
  32672. * });
  32673. * // => 'hi-diddly-ho there, neig [...]'
  32674. */
  32675. function truncate(string, options) {
  32676. var length = DEFAULT_TRUNC_LENGTH,
  32677. omission = DEFAULT_TRUNC_OMISSION;
  32678. if (isObject(options)) {
  32679. var separator = 'separator' in options ? options.separator : separator;
  32680. length = 'length' in options ? toInteger(options.length) : length;
  32681. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32682. }
  32683. string = toString(string);
  32684. var strLength = string.length;
  32685. if (hasUnicode(string)) {
  32686. var strSymbols = stringToArray(string);
  32687. strLength = strSymbols.length;
  32688. }
  32689. if (length >= strLength) {
  32690. return string;
  32691. }
  32692. var end = length - stringSize(omission);
  32693. if (end < 1) {
  32694. return omission;
  32695. }
  32696. var result = strSymbols
  32697. ? castSlice(strSymbols, 0, end).join('')
  32698. : string.slice(0, end);
  32699. if (separator === undefined) {
  32700. return result + omission;
  32701. }
  32702. if (strSymbols) {
  32703. end += (result.length - end);
  32704. }
  32705. if (isRegExp(separator)) {
  32706. if (string.slice(end).search(separator)) {
  32707. var match,
  32708. substring = result;
  32709. if (!separator.global) {
  32710. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32711. }
  32712. separator.lastIndex = 0;
  32713. while ((match = separator.exec(substring))) {
  32714. var newEnd = match.index;
  32715. }
  32716. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32717. }
  32718. } else if (string.indexOf(baseToString(separator), end) != end) {
  32719. var index = result.lastIndexOf(separator);
  32720. if (index > -1) {
  32721. result = result.slice(0, index);
  32722. }
  32723. }
  32724. return result + omission;
  32725. }
  32726. /**
  32727. * The inverse of `_.escape`; this method converts the HTML entities
  32728. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32729. * their corresponding characters.
  32730. *
  32731. * **Note:** No other HTML entities are unescaped. To unescape additional
  32732. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32733. *
  32734. * @static
  32735. * @memberOf _
  32736. * @since 0.6.0
  32737. * @category String
  32738. * @param {string} [string=''] The string to unescape.
  32739. * @returns {string} Returns the unescaped string.
  32740. * @example
  32741. *
  32742. * _.unescape('fred, barney, &amp; pebbles');
  32743. * // => 'fred, barney, & pebbles'
  32744. */
  32745. function unescape(string) {
  32746. string = toString(string);
  32747. return (string && reHasEscapedHtml.test(string))
  32748. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32749. : string;
  32750. }
  32751. /**
  32752. * Converts `string`, as space separated words, to upper case.
  32753. *
  32754. * @static
  32755. * @memberOf _
  32756. * @since 4.0.0
  32757. * @category String
  32758. * @param {string} [string=''] The string to convert.
  32759. * @returns {string} Returns the upper cased string.
  32760. * @example
  32761. *
  32762. * _.upperCase('--foo-bar');
  32763. * // => 'FOO BAR'
  32764. *
  32765. * _.upperCase('fooBar');
  32766. * // => 'FOO BAR'
  32767. *
  32768. * _.upperCase('__foo_bar__');
  32769. * // => 'FOO BAR'
  32770. */
  32771. var upperCase = createCompounder(function(result, word, index) {
  32772. return result + (index ? ' ' : '') + word.toUpperCase();
  32773. });
  32774. /**
  32775. * Converts the first character of `string` to upper case.
  32776. *
  32777. * @static
  32778. * @memberOf _
  32779. * @since 4.0.0
  32780. * @category String
  32781. * @param {string} [string=''] The string to convert.
  32782. * @returns {string} Returns the converted string.
  32783. * @example
  32784. *
  32785. * _.upperFirst('fred');
  32786. * // => 'Fred'
  32787. *
  32788. * _.upperFirst('FRED');
  32789. * // => 'FRED'
  32790. */
  32791. var upperFirst = createCaseFirst('toUpperCase');
  32792. /**
  32793. * Splits `string` into an array of its words.
  32794. *
  32795. * @static
  32796. * @memberOf _
  32797. * @since 3.0.0
  32798. * @category String
  32799. * @param {string} [string=''] The string to inspect.
  32800. * @param {RegExp|string} [pattern] The pattern to match words.
  32801. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32802. * @returns {Array} Returns the words of `string`.
  32803. * @example
  32804. *
  32805. * _.words('fred, barney, & pebbles');
  32806. * // => ['fred', 'barney', 'pebbles']
  32807. *
  32808. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32809. * // => ['fred', 'barney', '&', 'pebbles']
  32810. */
  32811. function words(string, pattern, guard) {
  32812. string = toString(string);
  32813. pattern = guard ? undefined : pattern;
  32814. if (pattern === undefined) {
  32815. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32816. }
  32817. return string.match(pattern) || [];
  32818. }
  32819. /*------------------------------------------------------------------------*/
  32820. /**
  32821. * Attempts to invoke `func`, returning either the result or the caught error
  32822. * object. Any additional arguments are provided to `func` when it's invoked.
  32823. *
  32824. * @static
  32825. * @memberOf _
  32826. * @since 3.0.0
  32827. * @category Util
  32828. * @param {Function} func The function to attempt.
  32829. * @param {...*} [args] The arguments to invoke `func` with.
  32830. * @returns {*} Returns the `func` result or error object.
  32831. * @example
  32832. *
  32833. * // Avoid throwing errors for invalid selectors.
  32834. * var elements = _.attempt(function(selector) {
  32835. * return document.querySelectorAll(selector);
  32836. * }, '>_>');
  32837. *
  32838. * if (_.isError(elements)) {
  32839. * elements = [];
  32840. * }
  32841. */
  32842. var attempt = baseRest(function(func, args) {
  32843. try {
  32844. return apply(func, undefined, args);
  32845. } catch (e) {
  32846. return isError(e) ? e : new Error(e);
  32847. }
  32848. });
  32849. /**
  32850. * Binds methods of an object to the object itself, overwriting the existing
  32851. * method.
  32852. *
  32853. * **Note:** This method doesn't set the "length" property of bound functions.
  32854. *
  32855. * @static
  32856. * @since 0.1.0
  32857. * @memberOf _
  32858. * @category Util
  32859. * @param {Object} object The object to bind and assign the bound methods to.
  32860. * @param {...(string|string[])} methodNames The object method names to bind.
  32861. * @returns {Object} Returns `object`.
  32862. * @example
  32863. *
  32864. * var view = {
  32865. * 'label': 'docs',
  32866. * 'click': function() {
  32867. * console.log('clicked ' + this.label);
  32868. * }
  32869. * };
  32870. *
  32871. * _.bindAll(view, ['click']);
  32872. * jQuery(element).on('click', view.click);
  32873. * // => Logs 'clicked docs' when clicked.
  32874. */
  32875. var bindAll = flatRest(function(object, methodNames) {
  32876. arrayEach(methodNames, function(key) {
  32877. key = toKey(key);
  32878. baseAssignValue(object, key, bind(object[key], object));
  32879. });
  32880. return object;
  32881. });
  32882. /**
  32883. * Creates a function that iterates over `pairs` and invokes the corresponding
  32884. * function of the first predicate to return truthy. The predicate-function
  32885. * pairs are invoked with the `this` binding and arguments of the created
  32886. * function.
  32887. *
  32888. * @static
  32889. * @memberOf _
  32890. * @since 4.0.0
  32891. * @category Util
  32892. * @param {Array} pairs The predicate-function pairs.
  32893. * @returns {Function} Returns the new composite function.
  32894. * @example
  32895. *
  32896. * var func = _.cond([
  32897. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32898. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32899. * [_.stubTrue, _.constant('no match')]
  32900. * ]);
  32901. *
  32902. * func({ 'a': 1, 'b': 2 });
  32903. * // => 'matches A'
  32904. *
  32905. * func({ 'a': 0, 'b': 1 });
  32906. * // => 'matches B'
  32907. *
  32908. * func({ 'a': '1', 'b': '2' });
  32909. * // => 'no match'
  32910. */
  32911. function cond(pairs) {
  32912. var length = pairs == null ? 0 : pairs.length,
  32913. toIteratee = getIteratee();
  32914. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32915. if (typeof pair[1] != 'function') {
  32916. throw new TypeError(FUNC_ERROR_TEXT);
  32917. }
  32918. return [toIteratee(pair[0]), pair[1]];
  32919. });
  32920. return baseRest(function(args) {
  32921. var index = -1;
  32922. while (++index < length) {
  32923. var pair = pairs[index];
  32924. if (apply(pair[0], this, args)) {
  32925. return apply(pair[1], this, args);
  32926. }
  32927. }
  32928. });
  32929. }
  32930. /**
  32931. * Creates a function that invokes the predicate properties of `source` with
  32932. * the corresponding property values of a given object, returning `true` if
  32933. * all predicates return truthy, else `false`.
  32934. *
  32935. * **Note:** The created function is equivalent to `_.conformsTo` with
  32936. * `source` partially applied.
  32937. *
  32938. * @static
  32939. * @memberOf _
  32940. * @since 4.0.0
  32941. * @category Util
  32942. * @param {Object} source The object of property predicates to conform to.
  32943. * @returns {Function} Returns the new spec function.
  32944. * @example
  32945. *
  32946. * var objects = [
  32947. * { 'a': 2, 'b': 1 },
  32948. * { 'a': 1, 'b': 2 }
  32949. * ];
  32950. *
  32951. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32952. * // => [{ 'a': 1, 'b': 2 }]
  32953. */
  32954. function conforms(source) {
  32955. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32956. }
  32957. /**
  32958. * Creates a function that returns `value`.
  32959. *
  32960. * @static
  32961. * @memberOf _
  32962. * @since 2.4.0
  32963. * @category Util
  32964. * @param {*} value The value to return from the new function.
  32965. * @returns {Function} Returns the new constant function.
  32966. * @example
  32967. *
  32968. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32969. *
  32970. * console.log(objects);
  32971. * // => [{ 'a': 1 }, { 'a': 1 }]
  32972. *
  32973. * console.log(objects[0] === objects[1]);
  32974. * // => true
  32975. */
  32976. function constant(value) {
  32977. return function() {
  32978. return value;
  32979. };
  32980. }
  32981. /**
  32982. * Checks `value` to determine whether a default value should be returned in
  32983. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32984. * or `undefined`.
  32985. *
  32986. * @static
  32987. * @memberOf _
  32988. * @since 4.14.0
  32989. * @category Util
  32990. * @param {*} value The value to check.
  32991. * @param {*} defaultValue The default value.
  32992. * @returns {*} Returns the resolved value.
  32993. * @example
  32994. *
  32995. * _.defaultTo(1, 10);
  32996. * // => 1
  32997. *
  32998. * _.defaultTo(undefined, 10);
  32999. * // => 10
  33000. */
  33001. function defaultTo(value, defaultValue) {
  33002. return (value == null || value !== value) ? defaultValue : value;
  33003. }
  33004. /**
  33005. * Creates a function that returns the result of invoking the given functions
  33006. * with the `this` binding of the created function, where each successive
  33007. * invocation is supplied the return value of the previous.
  33008. *
  33009. * @static
  33010. * @memberOf _
  33011. * @since 3.0.0
  33012. * @category Util
  33013. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33014. * @returns {Function} Returns the new composite function.
  33015. * @see _.flowRight
  33016. * @example
  33017. *
  33018. * function square(n) {
  33019. * return n * n;
  33020. * }
  33021. *
  33022. * var addSquare = _.flow([_.add, square]);
  33023. * addSquare(1, 2);
  33024. * // => 9
  33025. */
  33026. var flow = createFlow();
  33027. /**
  33028. * This method is like `_.flow` except that it creates a function that
  33029. * invokes the given functions from right to left.
  33030. *
  33031. * @static
  33032. * @since 3.0.0
  33033. * @memberOf _
  33034. * @category Util
  33035. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33036. * @returns {Function} Returns the new composite function.
  33037. * @see _.flow
  33038. * @example
  33039. *
  33040. * function square(n) {
  33041. * return n * n;
  33042. * }
  33043. *
  33044. * var addSquare = _.flowRight([square, _.add]);
  33045. * addSquare(1, 2);
  33046. * // => 9
  33047. */
  33048. var flowRight = createFlow(true);
  33049. /**
  33050. * This method returns the first argument it receives.
  33051. *
  33052. * @static
  33053. * @since 0.1.0
  33054. * @memberOf _
  33055. * @category Util
  33056. * @param {*} value Any value.
  33057. * @returns {*} Returns `value`.
  33058. * @example
  33059. *
  33060. * var object = { 'a': 1 };
  33061. *
  33062. * console.log(_.identity(object) === object);
  33063. * // => true
  33064. */
  33065. function identity(value) {
  33066. return value;
  33067. }
  33068. /**
  33069. * Creates a function that invokes `func` with the arguments of the created
  33070. * function. If `func` is a property name, the created function returns the
  33071. * property value for a given element. If `func` is an array or object, the
  33072. * created function returns `true` for elements that contain the equivalent
  33073. * source properties, otherwise it returns `false`.
  33074. *
  33075. * @static
  33076. * @since 4.0.0
  33077. * @memberOf _
  33078. * @category Util
  33079. * @param {*} [func=_.identity] The value to convert to a callback.
  33080. * @returns {Function} Returns the callback.
  33081. * @example
  33082. *
  33083. * var users = [
  33084. * { 'user': 'barney', 'age': 36, 'active': true },
  33085. * { 'user': 'fred', 'age': 40, 'active': false }
  33086. * ];
  33087. *
  33088. * // The `_.matches` iteratee shorthand.
  33089. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33090. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33091. *
  33092. * // The `_.matchesProperty` iteratee shorthand.
  33093. * _.filter(users, _.iteratee(['user', 'fred']));
  33094. * // => [{ 'user': 'fred', 'age': 40 }]
  33095. *
  33096. * // The `_.property` iteratee shorthand.
  33097. * _.map(users, _.iteratee('user'));
  33098. * // => ['barney', 'fred']
  33099. *
  33100. * // Create custom iteratee shorthands.
  33101. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33102. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33103. * return func.test(string);
  33104. * };
  33105. * });
  33106. *
  33107. * _.filter(['abc', 'def'], /ef/);
  33108. * // => ['def']
  33109. */
  33110. function iteratee(func) {
  33111. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33112. }
  33113. /**
  33114. * Creates a function that performs a partial deep comparison between a given
  33115. * object and `source`, returning `true` if the given object has equivalent
  33116. * property values, else `false`.
  33117. *
  33118. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33119. * partially applied.
  33120. *
  33121. * Partial comparisons will match empty array and empty object `source`
  33122. * values against any array or object value, respectively. See `_.isEqual`
  33123. * for a list of supported value comparisons.
  33124. *
  33125. * @static
  33126. * @memberOf _
  33127. * @since 3.0.0
  33128. * @category Util
  33129. * @param {Object} source The object of property values to match.
  33130. * @returns {Function} Returns the new spec function.
  33131. * @example
  33132. *
  33133. * var objects = [
  33134. * { 'a': 1, 'b': 2, 'c': 3 },
  33135. * { 'a': 4, 'b': 5, 'c': 6 }
  33136. * ];
  33137. *
  33138. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33139. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33140. */
  33141. function matches(source) {
  33142. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33143. }
  33144. /**
  33145. * Creates a function that performs a partial deep comparison between the
  33146. * value at `path` of a given object to `srcValue`, returning `true` if the
  33147. * object value is equivalent, else `false`.
  33148. *
  33149. * **Note:** Partial comparisons will match empty array and empty object
  33150. * `srcValue` values against any array or object value, respectively. See
  33151. * `_.isEqual` for a list of supported value comparisons.
  33152. *
  33153. * @static
  33154. * @memberOf _
  33155. * @since 3.2.0
  33156. * @category Util
  33157. * @param {Array|string} path The path of the property to get.
  33158. * @param {*} srcValue The value to match.
  33159. * @returns {Function} Returns the new spec function.
  33160. * @example
  33161. *
  33162. * var objects = [
  33163. * { 'a': 1, 'b': 2, 'c': 3 },
  33164. * { 'a': 4, 'b': 5, 'c': 6 }
  33165. * ];
  33166. *
  33167. * _.find(objects, _.matchesProperty('a', 4));
  33168. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33169. */
  33170. function matchesProperty(path, srcValue) {
  33171. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33172. }
  33173. /**
  33174. * Creates a function that invokes the method at `path` of a given object.
  33175. * Any additional arguments are provided to the invoked method.
  33176. *
  33177. * @static
  33178. * @memberOf _
  33179. * @since 3.7.0
  33180. * @category Util
  33181. * @param {Array|string} path The path of the method to invoke.
  33182. * @param {...*} [args] The arguments to invoke the method with.
  33183. * @returns {Function} Returns the new invoker function.
  33184. * @example
  33185. *
  33186. * var objects = [
  33187. * { 'a': { 'b': _.constant(2) } },
  33188. * { 'a': { 'b': _.constant(1) } }
  33189. * ];
  33190. *
  33191. * _.map(objects, _.method('a.b'));
  33192. * // => [2, 1]
  33193. *
  33194. * _.map(objects, _.method(['a', 'b']));
  33195. * // => [2, 1]
  33196. */
  33197. var method = baseRest(function(path, args) {
  33198. return function(object) {
  33199. return baseInvoke(object, path, args);
  33200. };
  33201. });
  33202. /**
  33203. * The opposite of `_.method`; this method creates a function that invokes
  33204. * the method at a given path of `object`. Any additional arguments are
  33205. * provided to the invoked method.
  33206. *
  33207. * @static
  33208. * @memberOf _
  33209. * @since 3.7.0
  33210. * @category Util
  33211. * @param {Object} object The object to query.
  33212. * @param {...*} [args] The arguments to invoke the method with.
  33213. * @returns {Function} Returns the new invoker function.
  33214. * @example
  33215. *
  33216. * var array = _.times(3, _.constant),
  33217. * object = { 'a': array, 'b': array, 'c': array };
  33218. *
  33219. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33220. * // => [2, 0]
  33221. *
  33222. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33223. * // => [2, 0]
  33224. */
  33225. var methodOf = baseRest(function(object, args) {
  33226. return function(path) {
  33227. return baseInvoke(object, path, args);
  33228. };
  33229. });
  33230. /**
  33231. * Adds all own enumerable string keyed function properties of a source
  33232. * object to the destination object. If `object` is a function, then methods
  33233. * are added to its prototype as well.
  33234. *
  33235. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33236. * avoid conflicts caused by modifying the original.
  33237. *
  33238. * @static
  33239. * @since 0.1.0
  33240. * @memberOf _
  33241. * @category Util
  33242. * @param {Function|Object} [object=lodash] The destination object.
  33243. * @param {Object} source The object of functions to add.
  33244. * @param {Object} [options={}] The options object.
  33245. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33246. * @returns {Function|Object} Returns `object`.
  33247. * @example
  33248. *
  33249. * function vowels(string) {
  33250. * return _.filter(string, function(v) {
  33251. * return /[aeiou]/i.test(v);
  33252. * });
  33253. * }
  33254. *
  33255. * _.mixin({ 'vowels': vowels });
  33256. * _.vowels('fred');
  33257. * // => ['e']
  33258. *
  33259. * _('fred').vowels().value();
  33260. * // => ['e']
  33261. *
  33262. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33263. * _('fred').vowels();
  33264. * // => ['e']
  33265. */
  33266. function mixin(object, source, options) {
  33267. var props = keys(source),
  33268. methodNames = baseFunctions(source, props);
  33269. if (options == null &&
  33270. !(isObject(source) && (methodNames.length || !props.length))) {
  33271. options = source;
  33272. source = object;
  33273. object = this;
  33274. methodNames = baseFunctions(source, keys(source));
  33275. }
  33276. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33277. isFunc = isFunction(object);
  33278. arrayEach(methodNames, function(methodName) {
  33279. var func = source[methodName];
  33280. object[methodName] = func;
  33281. if (isFunc) {
  33282. object.prototype[methodName] = function() {
  33283. var chainAll = this.__chain__;
  33284. if (chain || chainAll) {
  33285. var result = object(this.__wrapped__),
  33286. actions = result.__actions__ = copyArray(this.__actions__);
  33287. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33288. result.__chain__ = chainAll;
  33289. return result;
  33290. }
  33291. return func.apply(object, arrayPush([this.value()], arguments));
  33292. };
  33293. }
  33294. });
  33295. return object;
  33296. }
  33297. /**
  33298. * Reverts the `_` variable to its previous value and returns a reference to
  33299. * the `lodash` function.
  33300. *
  33301. * @static
  33302. * @since 0.1.0
  33303. * @memberOf _
  33304. * @category Util
  33305. * @returns {Function} Returns the `lodash` function.
  33306. * @example
  33307. *
  33308. * var lodash = _.noConflict();
  33309. */
  33310. function noConflict() {
  33311. if (root._ === this) {
  33312. root._ = oldDash;
  33313. }
  33314. return this;
  33315. }
  33316. /**
  33317. * This method returns `undefined`.
  33318. *
  33319. * @static
  33320. * @memberOf _
  33321. * @since 2.3.0
  33322. * @category Util
  33323. * @example
  33324. *
  33325. * _.times(2, _.noop);
  33326. * // => [undefined, undefined]
  33327. */
  33328. function noop() {
  33329. // No operation performed.
  33330. }
  33331. /**
  33332. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33333. * the nth argument from the end is returned.
  33334. *
  33335. * @static
  33336. * @memberOf _
  33337. * @since 4.0.0
  33338. * @category Util
  33339. * @param {number} [n=0] The index of the argument to return.
  33340. * @returns {Function} Returns the new pass-thru function.
  33341. * @example
  33342. *
  33343. * var func = _.nthArg(1);
  33344. * func('a', 'b', 'c', 'd');
  33345. * // => 'b'
  33346. *
  33347. * var func = _.nthArg(-2);
  33348. * func('a', 'b', 'c', 'd');
  33349. * // => 'c'
  33350. */
  33351. function nthArg(n) {
  33352. n = toInteger(n);
  33353. return baseRest(function(args) {
  33354. return baseNth(args, n);
  33355. });
  33356. }
  33357. /**
  33358. * Creates a function that invokes `iteratees` with the arguments it receives
  33359. * and returns their results.
  33360. *
  33361. * @static
  33362. * @memberOf _
  33363. * @since 4.0.0
  33364. * @category Util
  33365. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33366. * The iteratees to invoke.
  33367. * @returns {Function} Returns the new function.
  33368. * @example
  33369. *
  33370. * var func = _.over([Math.max, Math.min]);
  33371. *
  33372. * func(1, 2, 3, 4);
  33373. * // => [4, 1]
  33374. */
  33375. var over = createOver(arrayMap);
  33376. /**
  33377. * Creates a function that checks if **all** of the `predicates` return
  33378. * truthy when invoked with the arguments it receives.
  33379. *
  33380. * @static
  33381. * @memberOf _
  33382. * @since 4.0.0
  33383. * @category Util
  33384. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33385. * The predicates to check.
  33386. * @returns {Function} Returns the new function.
  33387. * @example
  33388. *
  33389. * var func = _.overEvery([Boolean, isFinite]);
  33390. *
  33391. * func('1');
  33392. * // => true
  33393. *
  33394. * func(null);
  33395. * // => false
  33396. *
  33397. * func(NaN);
  33398. * // => false
  33399. */
  33400. var overEvery = createOver(arrayEvery);
  33401. /**
  33402. * Creates a function that checks if **any** of the `predicates` return
  33403. * truthy when invoked with the arguments it receives.
  33404. *
  33405. * @static
  33406. * @memberOf _
  33407. * @since 4.0.0
  33408. * @category Util
  33409. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33410. * The predicates to check.
  33411. * @returns {Function} Returns the new function.
  33412. * @example
  33413. *
  33414. * var func = _.overSome([Boolean, isFinite]);
  33415. *
  33416. * func('1');
  33417. * // => true
  33418. *
  33419. * func(null);
  33420. * // => true
  33421. *
  33422. * func(NaN);
  33423. * // => false
  33424. */
  33425. var overSome = createOver(arraySome);
  33426. /**
  33427. * Creates a function that returns the value at `path` of a given object.
  33428. *
  33429. * @static
  33430. * @memberOf _
  33431. * @since 2.4.0
  33432. * @category Util
  33433. * @param {Array|string} path The path of the property to get.
  33434. * @returns {Function} Returns the new accessor function.
  33435. * @example
  33436. *
  33437. * var objects = [
  33438. * { 'a': { 'b': 2 } },
  33439. * { 'a': { 'b': 1 } }
  33440. * ];
  33441. *
  33442. * _.map(objects, _.property('a.b'));
  33443. * // => [2, 1]
  33444. *
  33445. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33446. * // => [1, 2]
  33447. */
  33448. function property(path) {
  33449. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33450. }
  33451. /**
  33452. * The opposite of `_.property`; this method creates a function that returns
  33453. * the value at a given path of `object`.
  33454. *
  33455. * @static
  33456. * @memberOf _
  33457. * @since 3.0.0
  33458. * @category Util
  33459. * @param {Object} object The object to query.
  33460. * @returns {Function} Returns the new accessor function.
  33461. * @example
  33462. *
  33463. * var array = [0, 1, 2],
  33464. * object = { 'a': array, 'b': array, 'c': array };
  33465. *
  33466. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33467. * // => [2, 0]
  33468. *
  33469. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33470. * // => [2, 0]
  33471. */
  33472. function propertyOf(object) {
  33473. return function(path) {
  33474. return object == null ? undefined : baseGet(object, path);
  33475. };
  33476. }
  33477. /**
  33478. * Creates an array of numbers (positive and/or negative) progressing from
  33479. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33480. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33481. * it's set to `start` with `start` then set to `0`.
  33482. *
  33483. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33484. * floating-point values which can produce unexpected results.
  33485. *
  33486. * @static
  33487. * @since 0.1.0
  33488. * @memberOf _
  33489. * @category Util
  33490. * @param {number} [start=0] The start of the range.
  33491. * @param {number} end The end of the range.
  33492. * @param {number} [step=1] The value to increment or decrement by.
  33493. * @returns {Array} Returns the range of numbers.
  33494. * @see _.inRange, _.rangeRight
  33495. * @example
  33496. *
  33497. * _.range(4);
  33498. * // => [0, 1, 2, 3]
  33499. *
  33500. * _.range(-4);
  33501. * // => [0, -1, -2, -3]
  33502. *
  33503. * _.range(1, 5);
  33504. * // => [1, 2, 3, 4]
  33505. *
  33506. * _.range(0, 20, 5);
  33507. * // => [0, 5, 10, 15]
  33508. *
  33509. * _.range(0, -4, -1);
  33510. * // => [0, -1, -2, -3]
  33511. *
  33512. * _.range(1, 4, 0);
  33513. * // => [1, 1, 1]
  33514. *
  33515. * _.range(0);
  33516. * // => []
  33517. */
  33518. var range = createRange();
  33519. /**
  33520. * This method is like `_.range` except that it populates values in
  33521. * descending order.
  33522. *
  33523. * @static
  33524. * @memberOf _
  33525. * @since 4.0.0
  33526. * @category Util
  33527. * @param {number} [start=0] The start of the range.
  33528. * @param {number} end The end of the range.
  33529. * @param {number} [step=1] The value to increment or decrement by.
  33530. * @returns {Array} Returns the range of numbers.
  33531. * @see _.inRange, _.range
  33532. * @example
  33533. *
  33534. * _.rangeRight(4);
  33535. * // => [3, 2, 1, 0]
  33536. *
  33537. * _.rangeRight(-4);
  33538. * // => [-3, -2, -1, 0]
  33539. *
  33540. * _.rangeRight(1, 5);
  33541. * // => [4, 3, 2, 1]
  33542. *
  33543. * _.rangeRight(0, 20, 5);
  33544. * // => [15, 10, 5, 0]
  33545. *
  33546. * _.rangeRight(0, -4, -1);
  33547. * // => [-3, -2, -1, 0]
  33548. *
  33549. * _.rangeRight(1, 4, 0);
  33550. * // => [1, 1, 1]
  33551. *
  33552. * _.rangeRight(0);
  33553. * // => []
  33554. */
  33555. var rangeRight = createRange(true);
  33556. /**
  33557. * This method returns a new empty array.
  33558. *
  33559. * @static
  33560. * @memberOf _
  33561. * @since 4.13.0
  33562. * @category Util
  33563. * @returns {Array} Returns the new empty array.
  33564. * @example
  33565. *
  33566. * var arrays = _.times(2, _.stubArray);
  33567. *
  33568. * console.log(arrays);
  33569. * // => [[], []]
  33570. *
  33571. * console.log(arrays[0] === arrays[1]);
  33572. * // => false
  33573. */
  33574. function stubArray() {
  33575. return [];
  33576. }
  33577. /**
  33578. * This method returns `false`.
  33579. *
  33580. * @static
  33581. * @memberOf _
  33582. * @since 4.13.0
  33583. * @category Util
  33584. * @returns {boolean} Returns `false`.
  33585. * @example
  33586. *
  33587. * _.times(2, _.stubFalse);
  33588. * // => [false, false]
  33589. */
  33590. function stubFalse() {
  33591. return false;
  33592. }
  33593. /**
  33594. * This method returns a new empty object.
  33595. *
  33596. * @static
  33597. * @memberOf _
  33598. * @since 4.13.0
  33599. * @category Util
  33600. * @returns {Object} Returns the new empty object.
  33601. * @example
  33602. *
  33603. * var objects = _.times(2, _.stubObject);
  33604. *
  33605. * console.log(objects);
  33606. * // => [{}, {}]
  33607. *
  33608. * console.log(objects[0] === objects[1]);
  33609. * // => false
  33610. */
  33611. function stubObject() {
  33612. return {};
  33613. }
  33614. /**
  33615. * This method returns an empty string.
  33616. *
  33617. * @static
  33618. * @memberOf _
  33619. * @since 4.13.0
  33620. * @category Util
  33621. * @returns {string} Returns the empty string.
  33622. * @example
  33623. *
  33624. * _.times(2, _.stubString);
  33625. * // => ['', '']
  33626. */
  33627. function stubString() {
  33628. return '';
  33629. }
  33630. /**
  33631. * This method returns `true`.
  33632. *
  33633. * @static
  33634. * @memberOf _
  33635. * @since 4.13.0
  33636. * @category Util
  33637. * @returns {boolean} Returns `true`.
  33638. * @example
  33639. *
  33640. * _.times(2, _.stubTrue);
  33641. * // => [true, true]
  33642. */
  33643. function stubTrue() {
  33644. return true;
  33645. }
  33646. /**
  33647. * Invokes the iteratee `n` times, returning an array of the results of
  33648. * each invocation. The iteratee is invoked with one argument; (index).
  33649. *
  33650. * @static
  33651. * @since 0.1.0
  33652. * @memberOf _
  33653. * @category Util
  33654. * @param {number} n The number of times to invoke `iteratee`.
  33655. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33656. * @returns {Array} Returns the array of results.
  33657. * @example
  33658. *
  33659. * _.times(3, String);
  33660. * // => ['0', '1', '2']
  33661. *
  33662. * _.times(4, _.constant(0));
  33663. * // => [0, 0, 0, 0]
  33664. */
  33665. function times(n, iteratee) {
  33666. n = toInteger(n);
  33667. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33668. return [];
  33669. }
  33670. var index = MAX_ARRAY_LENGTH,
  33671. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33672. iteratee = getIteratee(iteratee);
  33673. n -= MAX_ARRAY_LENGTH;
  33674. var result = baseTimes(length, iteratee);
  33675. while (++index < n) {
  33676. iteratee(index);
  33677. }
  33678. return result;
  33679. }
  33680. /**
  33681. * Converts `value` to a property path array.
  33682. *
  33683. * @static
  33684. * @memberOf _
  33685. * @since 4.0.0
  33686. * @category Util
  33687. * @param {*} value The value to convert.
  33688. * @returns {Array} Returns the new property path array.
  33689. * @example
  33690. *
  33691. * _.toPath('a.b.c');
  33692. * // => ['a', 'b', 'c']
  33693. *
  33694. * _.toPath('a[0].b.c');
  33695. * // => ['a', '0', 'b', 'c']
  33696. */
  33697. function toPath(value) {
  33698. if (isArray(value)) {
  33699. return arrayMap(value, toKey);
  33700. }
  33701. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33702. }
  33703. /**
  33704. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33705. *
  33706. * @static
  33707. * @since 0.1.0
  33708. * @memberOf _
  33709. * @category Util
  33710. * @param {string} [prefix=''] The value to prefix the ID with.
  33711. * @returns {string} Returns the unique ID.
  33712. * @example
  33713. *
  33714. * _.uniqueId('contact_');
  33715. * // => 'contact_104'
  33716. *
  33717. * _.uniqueId();
  33718. * // => '105'
  33719. */
  33720. function uniqueId(prefix) {
  33721. var id = ++idCounter;
  33722. return toString(prefix) + id;
  33723. }
  33724. /*------------------------------------------------------------------------*/
  33725. /**
  33726. * Adds two numbers.
  33727. *
  33728. * @static
  33729. * @memberOf _
  33730. * @since 3.4.0
  33731. * @category Math
  33732. * @param {number} augend The first number in an addition.
  33733. * @param {number} addend The second number in an addition.
  33734. * @returns {number} Returns the total.
  33735. * @example
  33736. *
  33737. * _.add(6, 4);
  33738. * // => 10
  33739. */
  33740. var add = createMathOperation(function(augend, addend) {
  33741. return augend + addend;
  33742. }, 0);
  33743. /**
  33744. * Computes `number` rounded up to `precision`.
  33745. *
  33746. * @static
  33747. * @memberOf _
  33748. * @since 3.10.0
  33749. * @category Math
  33750. * @param {number} number The number to round up.
  33751. * @param {number} [precision=0] The precision to round up to.
  33752. * @returns {number} Returns the rounded up number.
  33753. * @example
  33754. *
  33755. * _.ceil(4.006);
  33756. * // => 5
  33757. *
  33758. * _.ceil(6.004, 2);
  33759. * // => 6.01
  33760. *
  33761. * _.ceil(6040, -2);
  33762. * // => 6100
  33763. */
  33764. var ceil = createRound('ceil');
  33765. /**
  33766. * Divide two numbers.
  33767. *
  33768. * @static
  33769. * @memberOf _
  33770. * @since 4.7.0
  33771. * @category Math
  33772. * @param {number} dividend The first number in a division.
  33773. * @param {number} divisor The second number in a division.
  33774. * @returns {number} Returns the quotient.
  33775. * @example
  33776. *
  33777. * _.divide(6, 4);
  33778. * // => 1.5
  33779. */
  33780. var divide = createMathOperation(function(dividend, divisor) {
  33781. return dividend / divisor;
  33782. }, 1);
  33783. /**
  33784. * Computes `number` rounded down to `precision`.
  33785. *
  33786. * @static
  33787. * @memberOf _
  33788. * @since 3.10.0
  33789. * @category Math
  33790. * @param {number} number The number to round down.
  33791. * @param {number} [precision=0] The precision to round down to.
  33792. * @returns {number} Returns the rounded down number.
  33793. * @example
  33794. *
  33795. * _.floor(4.006);
  33796. * // => 4
  33797. *
  33798. * _.floor(0.046, 2);
  33799. * // => 0.04
  33800. *
  33801. * _.floor(4060, -2);
  33802. * // => 4000
  33803. */
  33804. var floor = createRound('floor');
  33805. /**
  33806. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33807. * `undefined` is returned.
  33808. *
  33809. * @static
  33810. * @since 0.1.0
  33811. * @memberOf _
  33812. * @category Math
  33813. * @param {Array} array The array to iterate over.
  33814. * @returns {*} Returns the maximum value.
  33815. * @example
  33816. *
  33817. * _.max([4, 2, 8, 6]);
  33818. * // => 8
  33819. *
  33820. * _.max([]);
  33821. * // => undefined
  33822. */
  33823. function max(array) {
  33824. return (array && array.length)
  33825. ? baseExtremum(array, identity, baseGt)
  33826. : undefined;
  33827. }
  33828. /**
  33829. * This method is like `_.max` except that it accepts `iteratee` which is
  33830. * invoked for each element in `array` to generate the criterion by which
  33831. * the value is ranked. The iteratee is invoked with one argument: (value).
  33832. *
  33833. * @static
  33834. * @memberOf _
  33835. * @since 4.0.0
  33836. * @category Math
  33837. * @param {Array} array The array to iterate over.
  33838. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33839. * @returns {*} Returns the maximum value.
  33840. * @example
  33841. *
  33842. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33843. *
  33844. * _.maxBy(objects, function(o) { return o.n; });
  33845. * // => { 'n': 2 }
  33846. *
  33847. * // The `_.property` iteratee shorthand.
  33848. * _.maxBy(objects, 'n');
  33849. * // => { 'n': 2 }
  33850. */
  33851. function maxBy(array, iteratee) {
  33852. return (array && array.length)
  33853. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33854. : undefined;
  33855. }
  33856. /**
  33857. * Computes the mean of the values in `array`.
  33858. *
  33859. * @static
  33860. * @memberOf _
  33861. * @since 4.0.0
  33862. * @category Math
  33863. * @param {Array} array The array to iterate over.
  33864. * @returns {number} Returns the mean.
  33865. * @example
  33866. *
  33867. * _.mean([4, 2, 8, 6]);
  33868. * // => 5
  33869. */
  33870. function mean(array) {
  33871. return baseMean(array, identity);
  33872. }
  33873. /**
  33874. * This method is like `_.mean` except that it accepts `iteratee` which is
  33875. * invoked for each element in `array` to generate the value to be averaged.
  33876. * The iteratee is invoked with one argument: (value).
  33877. *
  33878. * @static
  33879. * @memberOf _
  33880. * @since 4.7.0
  33881. * @category Math
  33882. * @param {Array} array The array to iterate over.
  33883. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33884. * @returns {number} Returns the mean.
  33885. * @example
  33886. *
  33887. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33888. *
  33889. * _.meanBy(objects, function(o) { return o.n; });
  33890. * // => 5
  33891. *
  33892. * // The `_.property` iteratee shorthand.
  33893. * _.meanBy(objects, 'n');
  33894. * // => 5
  33895. */
  33896. function meanBy(array, iteratee) {
  33897. return baseMean(array, getIteratee(iteratee, 2));
  33898. }
  33899. /**
  33900. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33901. * `undefined` is returned.
  33902. *
  33903. * @static
  33904. * @since 0.1.0
  33905. * @memberOf _
  33906. * @category Math
  33907. * @param {Array} array The array to iterate over.
  33908. * @returns {*} Returns the minimum value.
  33909. * @example
  33910. *
  33911. * _.min([4, 2, 8, 6]);
  33912. * // => 2
  33913. *
  33914. * _.min([]);
  33915. * // => undefined
  33916. */
  33917. function min(array) {
  33918. return (array && array.length)
  33919. ? baseExtremum(array, identity, baseLt)
  33920. : undefined;
  33921. }
  33922. /**
  33923. * This method is like `_.min` except that it accepts `iteratee` which is
  33924. * invoked for each element in `array` to generate the criterion by which
  33925. * the value is ranked. The iteratee is invoked with one argument: (value).
  33926. *
  33927. * @static
  33928. * @memberOf _
  33929. * @since 4.0.0
  33930. * @category Math
  33931. * @param {Array} array The array to iterate over.
  33932. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33933. * @returns {*} Returns the minimum value.
  33934. * @example
  33935. *
  33936. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33937. *
  33938. * _.minBy(objects, function(o) { return o.n; });
  33939. * // => { 'n': 1 }
  33940. *
  33941. * // The `_.property` iteratee shorthand.
  33942. * _.minBy(objects, 'n');
  33943. * // => { 'n': 1 }
  33944. */
  33945. function minBy(array, iteratee) {
  33946. return (array && array.length)
  33947. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33948. : undefined;
  33949. }
  33950. /**
  33951. * Multiply two numbers.
  33952. *
  33953. * @static
  33954. * @memberOf _
  33955. * @since 4.7.0
  33956. * @category Math
  33957. * @param {number} multiplier The first number in a multiplication.
  33958. * @param {number} multiplicand The second number in a multiplication.
  33959. * @returns {number} Returns the product.
  33960. * @example
  33961. *
  33962. * _.multiply(6, 4);
  33963. * // => 24
  33964. */
  33965. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33966. return multiplier * multiplicand;
  33967. }, 1);
  33968. /**
  33969. * Computes `number` rounded to `precision`.
  33970. *
  33971. * @static
  33972. * @memberOf _
  33973. * @since 3.10.0
  33974. * @category Math
  33975. * @param {number} number The number to round.
  33976. * @param {number} [precision=0] The precision to round to.
  33977. * @returns {number} Returns the rounded number.
  33978. * @example
  33979. *
  33980. * _.round(4.006);
  33981. * // => 4
  33982. *
  33983. * _.round(4.006, 2);
  33984. * // => 4.01
  33985. *
  33986. * _.round(4060, -2);
  33987. * // => 4100
  33988. */
  33989. var round = createRound('round');
  33990. /**
  33991. * Subtract two numbers.
  33992. *
  33993. * @static
  33994. * @memberOf _
  33995. * @since 4.0.0
  33996. * @category Math
  33997. * @param {number} minuend The first number in a subtraction.
  33998. * @param {number} subtrahend The second number in a subtraction.
  33999. * @returns {number} Returns the difference.
  34000. * @example
  34001. *
  34002. * _.subtract(6, 4);
  34003. * // => 2
  34004. */
  34005. var subtract = createMathOperation(function(minuend, subtrahend) {
  34006. return minuend - subtrahend;
  34007. }, 0);
  34008. /**
  34009. * Computes the sum of the values in `array`.
  34010. *
  34011. * @static
  34012. * @memberOf _
  34013. * @since 3.4.0
  34014. * @category Math
  34015. * @param {Array} array The array to iterate over.
  34016. * @returns {number} Returns the sum.
  34017. * @example
  34018. *
  34019. * _.sum([4, 2, 8, 6]);
  34020. * // => 20
  34021. */
  34022. function sum(array) {
  34023. return (array && array.length)
  34024. ? baseSum(array, identity)
  34025. : 0;
  34026. }
  34027. /**
  34028. * This method is like `_.sum` except that it accepts `iteratee` which is
  34029. * invoked for each element in `array` to generate the value to be summed.
  34030. * The iteratee is invoked with one argument: (value).
  34031. *
  34032. * @static
  34033. * @memberOf _
  34034. * @since 4.0.0
  34035. * @category Math
  34036. * @param {Array} array The array to iterate over.
  34037. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34038. * @returns {number} Returns the sum.
  34039. * @example
  34040. *
  34041. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34042. *
  34043. * _.sumBy(objects, function(o) { return o.n; });
  34044. * // => 20
  34045. *
  34046. * // The `_.property` iteratee shorthand.
  34047. * _.sumBy(objects, 'n');
  34048. * // => 20
  34049. */
  34050. function sumBy(array, iteratee) {
  34051. return (array && array.length)
  34052. ? baseSum(array, getIteratee(iteratee, 2))
  34053. : 0;
  34054. }
  34055. /*------------------------------------------------------------------------*/
  34056. // Add methods that return wrapped values in chain sequences.
  34057. lodash.after = after;
  34058. lodash.ary = ary;
  34059. lodash.assign = assign;
  34060. lodash.assignIn = assignIn;
  34061. lodash.assignInWith = assignInWith;
  34062. lodash.assignWith = assignWith;
  34063. lodash.at = at;
  34064. lodash.before = before;
  34065. lodash.bind = bind;
  34066. lodash.bindAll = bindAll;
  34067. lodash.bindKey = bindKey;
  34068. lodash.castArray = castArray;
  34069. lodash.chain = chain;
  34070. lodash.chunk = chunk;
  34071. lodash.compact = compact;
  34072. lodash.concat = concat;
  34073. lodash.cond = cond;
  34074. lodash.conforms = conforms;
  34075. lodash.constant = constant;
  34076. lodash.countBy = countBy;
  34077. lodash.create = create;
  34078. lodash.curry = curry;
  34079. lodash.curryRight = curryRight;
  34080. lodash.debounce = debounce;
  34081. lodash.defaults = defaults;
  34082. lodash.defaultsDeep = defaultsDeep;
  34083. lodash.defer = defer;
  34084. lodash.delay = delay;
  34085. lodash.difference = difference;
  34086. lodash.differenceBy = differenceBy;
  34087. lodash.differenceWith = differenceWith;
  34088. lodash.drop = drop;
  34089. lodash.dropRight = dropRight;
  34090. lodash.dropRightWhile = dropRightWhile;
  34091. lodash.dropWhile = dropWhile;
  34092. lodash.fill = fill;
  34093. lodash.filter = filter;
  34094. lodash.flatMap = flatMap;
  34095. lodash.flatMapDeep = flatMapDeep;
  34096. lodash.flatMapDepth = flatMapDepth;
  34097. lodash.flatten = flatten;
  34098. lodash.flattenDeep = flattenDeep;
  34099. lodash.flattenDepth = flattenDepth;
  34100. lodash.flip = flip;
  34101. lodash.flow = flow;
  34102. lodash.flowRight = flowRight;
  34103. lodash.fromPairs = fromPairs;
  34104. lodash.functions = functions;
  34105. lodash.functionsIn = functionsIn;
  34106. lodash.groupBy = groupBy;
  34107. lodash.initial = initial;
  34108. lodash.intersection = intersection;
  34109. lodash.intersectionBy = intersectionBy;
  34110. lodash.intersectionWith = intersectionWith;
  34111. lodash.invert = invert;
  34112. lodash.invertBy = invertBy;
  34113. lodash.invokeMap = invokeMap;
  34114. lodash.iteratee = iteratee;
  34115. lodash.keyBy = keyBy;
  34116. lodash.keys = keys;
  34117. lodash.keysIn = keysIn;
  34118. lodash.map = map;
  34119. lodash.mapKeys = mapKeys;
  34120. lodash.mapValues = mapValues;
  34121. lodash.matches = matches;
  34122. lodash.matchesProperty = matchesProperty;
  34123. lodash.memoize = memoize;
  34124. lodash.merge = merge;
  34125. lodash.mergeWith = mergeWith;
  34126. lodash.method = method;
  34127. lodash.methodOf = methodOf;
  34128. lodash.mixin = mixin;
  34129. lodash.negate = negate;
  34130. lodash.nthArg = nthArg;
  34131. lodash.omit = omit;
  34132. lodash.omitBy = omitBy;
  34133. lodash.once = once;
  34134. lodash.orderBy = orderBy;
  34135. lodash.over = over;
  34136. lodash.overArgs = overArgs;
  34137. lodash.overEvery = overEvery;
  34138. lodash.overSome = overSome;
  34139. lodash.partial = partial;
  34140. lodash.partialRight = partialRight;
  34141. lodash.partition = partition;
  34142. lodash.pick = pick;
  34143. lodash.pickBy = pickBy;
  34144. lodash.property = property;
  34145. lodash.propertyOf = propertyOf;
  34146. lodash.pull = pull;
  34147. lodash.pullAll = pullAll;
  34148. lodash.pullAllBy = pullAllBy;
  34149. lodash.pullAllWith = pullAllWith;
  34150. lodash.pullAt = pullAt;
  34151. lodash.range = range;
  34152. lodash.rangeRight = rangeRight;
  34153. lodash.rearg = rearg;
  34154. lodash.reject = reject;
  34155. lodash.remove = remove;
  34156. lodash.rest = rest;
  34157. lodash.reverse = reverse;
  34158. lodash.sampleSize = sampleSize;
  34159. lodash.set = set;
  34160. lodash.setWith = setWith;
  34161. lodash.shuffle = shuffle;
  34162. lodash.slice = slice;
  34163. lodash.sortBy = sortBy;
  34164. lodash.sortedUniq = sortedUniq;
  34165. lodash.sortedUniqBy = sortedUniqBy;
  34166. lodash.split = split;
  34167. lodash.spread = spread;
  34168. lodash.tail = tail;
  34169. lodash.take = take;
  34170. lodash.takeRight = takeRight;
  34171. lodash.takeRightWhile = takeRightWhile;
  34172. lodash.takeWhile = takeWhile;
  34173. lodash.tap = tap;
  34174. lodash.throttle = throttle;
  34175. lodash.thru = thru;
  34176. lodash.toArray = toArray;
  34177. lodash.toPairs = toPairs;
  34178. lodash.toPairsIn = toPairsIn;
  34179. lodash.toPath = toPath;
  34180. lodash.toPlainObject = toPlainObject;
  34181. lodash.transform = transform;
  34182. lodash.unary = unary;
  34183. lodash.union = union;
  34184. lodash.unionBy = unionBy;
  34185. lodash.unionWith = unionWith;
  34186. lodash.uniq = uniq;
  34187. lodash.uniqBy = uniqBy;
  34188. lodash.uniqWith = uniqWith;
  34189. lodash.unset = unset;
  34190. lodash.unzip = unzip;
  34191. lodash.unzipWith = unzipWith;
  34192. lodash.update = update;
  34193. lodash.updateWith = updateWith;
  34194. lodash.values = values;
  34195. lodash.valuesIn = valuesIn;
  34196. lodash.without = without;
  34197. lodash.words = words;
  34198. lodash.wrap = wrap;
  34199. lodash.xor = xor;
  34200. lodash.xorBy = xorBy;
  34201. lodash.xorWith = xorWith;
  34202. lodash.zip = zip;
  34203. lodash.zipObject = zipObject;
  34204. lodash.zipObjectDeep = zipObjectDeep;
  34205. lodash.zipWith = zipWith;
  34206. // Add aliases.
  34207. lodash.entries = toPairs;
  34208. lodash.entriesIn = toPairsIn;
  34209. lodash.extend = assignIn;
  34210. lodash.extendWith = assignInWith;
  34211. // Add methods to `lodash.prototype`.
  34212. mixin(lodash, lodash);
  34213. /*------------------------------------------------------------------------*/
  34214. // Add methods that return unwrapped values in chain sequences.
  34215. lodash.add = add;
  34216. lodash.attempt = attempt;
  34217. lodash.camelCase = camelCase;
  34218. lodash.capitalize = capitalize;
  34219. lodash.ceil = ceil;
  34220. lodash.clamp = clamp;
  34221. lodash.clone = clone;
  34222. lodash.cloneDeep = cloneDeep;
  34223. lodash.cloneDeepWith = cloneDeepWith;
  34224. lodash.cloneWith = cloneWith;
  34225. lodash.conformsTo = conformsTo;
  34226. lodash.deburr = deburr;
  34227. lodash.defaultTo = defaultTo;
  34228. lodash.divide = divide;
  34229. lodash.endsWith = endsWith;
  34230. lodash.eq = eq;
  34231. lodash.escape = escape;
  34232. lodash.escapeRegExp = escapeRegExp;
  34233. lodash.every = every;
  34234. lodash.find = find;
  34235. lodash.findIndex = findIndex;
  34236. lodash.findKey = findKey;
  34237. lodash.findLast = findLast;
  34238. lodash.findLastIndex = findLastIndex;
  34239. lodash.findLastKey = findLastKey;
  34240. lodash.floor = floor;
  34241. lodash.forEach = forEach;
  34242. lodash.forEachRight = forEachRight;
  34243. lodash.forIn = forIn;
  34244. lodash.forInRight = forInRight;
  34245. lodash.forOwn = forOwn;
  34246. lodash.forOwnRight = forOwnRight;
  34247. lodash.get = get;
  34248. lodash.gt = gt;
  34249. lodash.gte = gte;
  34250. lodash.has = has;
  34251. lodash.hasIn = hasIn;
  34252. lodash.head = head;
  34253. lodash.identity = identity;
  34254. lodash.includes = includes;
  34255. lodash.indexOf = indexOf;
  34256. lodash.inRange = inRange;
  34257. lodash.invoke = invoke;
  34258. lodash.isArguments = isArguments;
  34259. lodash.isArray = isArray;
  34260. lodash.isArrayBuffer = isArrayBuffer;
  34261. lodash.isArrayLike = isArrayLike;
  34262. lodash.isArrayLikeObject = isArrayLikeObject;
  34263. lodash.isBoolean = isBoolean;
  34264. lodash.isBuffer = isBuffer;
  34265. lodash.isDate = isDate;
  34266. lodash.isElement = isElement;
  34267. lodash.isEmpty = isEmpty;
  34268. lodash.isEqual = isEqual;
  34269. lodash.isEqualWith = isEqualWith;
  34270. lodash.isError = isError;
  34271. lodash.isFinite = isFinite;
  34272. lodash.isFunction = isFunction;
  34273. lodash.isInteger = isInteger;
  34274. lodash.isLength = isLength;
  34275. lodash.isMap = isMap;
  34276. lodash.isMatch = isMatch;
  34277. lodash.isMatchWith = isMatchWith;
  34278. lodash.isNaN = isNaN;
  34279. lodash.isNative = isNative;
  34280. lodash.isNil = isNil;
  34281. lodash.isNull = isNull;
  34282. lodash.isNumber = isNumber;
  34283. lodash.isObject = isObject;
  34284. lodash.isObjectLike = isObjectLike;
  34285. lodash.isPlainObject = isPlainObject;
  34286. lodash.isRegExp = isRegExp;
  34287. lodash.isSafeInteger = isSafeInteger;
  34288. lodash.isSet = isSet;
  34289. lodash.isString = isString;
  34290. lodash.isSymbol = isSymbol;
  34291. lodash.isTypedArray = isTypedArray;
  34292. lodash.isUndefined = isUndefined;
  34293. lodash.isWeakMap = isWeakMap;
  34294. lodash.isWeakSet = isWeakSet;
  34295. lodash.join = join;
  34296. lodash.kebabCase = kebabCase;
  34297. lodash.last = last;
  34298. lodash.lastIndexOf = lastIndexOf;
  34299. lodash.lowerCase = lowerCase;
  34300. lodash.lowerFirst = lowerFirst;
  34301. lodash.lt = lt;
  34302. lodash.lte = lte;
  34303. lodash.max = max;
  34304. lodash.maxBy = maxBy;
  34305. lodash.mean = mean;
  34306. lodash.meanBy = meanBy;
  34307. lodash.min = min;
  34308. lodash.minBy = minBy;
  34309. lodash.stubArray = stubArray;
  34310. lodash.stubFalse = stubFalse;
  34311. lodash.stubObject = stubObject;
  34312. lodash.stubString = stubString;
  34313. lodash.stubTrue = stubTrue;
  34314. lodash.multiply = multiply;
  34315. lodash.nth = nth;
  34316. lodash.noConflict = noConflict;
  34317. lodash.noop = noop;
  34318. lodash.now = now;
  34319. lodash.pad = pad;
  34320. lodash.padEnd = padEnd;
  34321. lodash.padStart = padStart;
  34322. lodash.parseInt = parseInt;
  34323. lodash.random = random;
  34324. lodash.reduce = reduce;
  34325. lodash.reduceRight = reduceRight;
  34326. lodash.repeat = repeat;
  34327. lodash.replace = replace;
  34328. lodash.result = result;
  34329. lodash.round = round;
  34330. lodash.runInContext = runInContext;
  34331. lodash.sample = sample;
  34332. lodash.size = size;
  34333. lodash.snakeCase = snakeCase;
  34334. lodash.some = some;
  34335. lodash.sortedIndex = sortedIndex;
  34336. lodash.sortedIndexBy = sortedIndexBy;
  34337. lodash.sortedIndexOf = sortedIndexOf;
  34338. lodash.sortedLastIndex = sortedLastIndex;
  34339. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34340. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34341. lodash.startCase = startCase;
  34342. lodash.startsWith = startsWith;
  34343. lodash.subtract = subtract;
  34344. lodash.sum = sum;
  34345. lodash.sumBy = sumBy;
  34346. lodash.template = template;
  34347. lodash.times = times;
  34348. lodash.toFinite = toFinite;
  34349. lodash.toInteger = toInteger;
  34350. lodash.toLength = toLength;
  34351. lodash.toLower = toLower;
  34352. lodash.toNumber = toNumber;
  34353. lodash.toSafeInteger = toSafeInteger;
  34354. lodash.toString = toString;
  34355. lodash.toUpper = toUpper;
  34356. lodash.trim = trim;
  34357. lodash.trimEnd = trimEnd;
  34358. lodash.trimStart = trimStart;
  34359. lodash.truncate = truncate;
  34360. lodash.unescape = unescape;
  34361. lodash.uniqueId = uniqueId;
  34362. lodash.upperCase = upperCase;
  34363. lodash.upperFirst = upperFirst;
  34364. // Add aliases.
  34365. lodash.each = forEach;
  34366. lodash.eachRight = forEachRight;
  34367. lodash.first = head;
  34368. mixin(lodash, (function() {
  34369. var source = {};
  34370. baseForOwn(lodash, function(func, methodName) {
  34371. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34372. source[methodName] = func;
  34373. }
  34374. });
  34375. return source;
  34376. }()), { 'chain': false });
  34377. /*------------------------------------------------------------------------*/
  34378. /**
  34379. * The semantic version number.
  34380. *
  34381. * @static
  34382. * @memberOf _
  34383. * @type {string}
  34384. */
  34385. lodash.VERSION = VERSION;
  34386. // Assign default placeholders.
  34387. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34388. lodash[methodName].placeholder = lodash;
  34389. });
  34390. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34391. arrayEach(['drop', 'take'], function(methodName, index) {
  34392. LazyWrapper.prototype[methodName] = function(n) {
  34393. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34394. var result = (this.__filtered__ && !index)
  34395. ? new LazyWrapper(this)
  34396. : this.clone();
  34397. if (result.__filtered__) {
  34398. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34399. } else {
  34400. result.__views__.push({
  34401. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34402. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34403. });
  34404. }
  34405. return result;
  34406. };
  34407. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34408. return this.reverse()[methodName](n).reverse();
  34409. };
  34410. });
  34411. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34412. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34413. var type = index + 1,
  34414. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34415. LazyWrapper.prototype[methodName] = function(iteratee) {
  34416. var result = this.clone();
  34417. result.__iteratees__.push({
  34418. 'iteratee': getIteratee(iteratee, 3),
  34419. 'type': type
  34420. });
  34421. result.__filtered__ = result.__filtered__ || isFilter;
  34422. return result;
  34423. };
  34424. });
  34425. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34426. arrayEach(['head', 'last'], function(methodName, index) {
  34427. var takeName = 'take' + (index ? 'Right' : '');
  34428. LazyWrapper.prototype[methodName] = function() {
  34429. return this[takeName](1).value()[0];
  34430. };
  34431. });
  34432. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34433. arrayEach(['initial', 'tail'], function(methodName, index) {
  34434. var dropName = 'drop' + (index ? '' : 'Right');
  34435. LazyWrapper.prototype[methodName] = function() {
  34436. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34437. };
  34438. });
  34439. LazyWrapper.prototype.compact = function() {
  34440. return this.filter(identity);
  34441. };
  34442. LazyWrapper.prototype.find = function(predicate) {
  34443. return this.filter(predicate).head();
  34444. };
  34445. LazyWrapper.prototype.findLast = function(predicate) {
  34446. return this.reverse().find(predicate);
  34447. };
  34448. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34449. if (typeof path == 'function') {
  34450. return new LazyWrapper(this);
  34451. }
  34452. return this.map(function(value) {
  34453. return baseInvoke(value, path, args);
  34454. });
  34455. });
  34456. LazyWrapper.prototype.reject = function(predicate) {
  34457. return this.filter(negate(getIteratee(predicate)));
  34458. };
  34459. LazyWrapper.prototype.slice = function(start, end) {
  34460. start = toInteger(start);
  34461. var result = this;
  34462. if (result.__filtered__ && (start > 0 || end < 0)) {
  34463. return new LazyWrapper(result);
  34464. }
  34465. if (start < 0) {
  34466. result = result.takeRight(-start);
  34467. } else if (start) {
  34468. result = result.drop(start);
  34469. }
  34470. if (end !== undefined) {
  34471. end = toInteger(end);
  34472. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34473. }
  34474. return result;
  34475. };
  34476. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34477. return this.reverse().takeWhile(predicate).reverse();
  34478. };
  34479. LazyWrapper.prototype.toArray = function() {
  34480. return this.take(MAX_ARRAY_LENGTH);
  34481. };
  34482. // Add `LazyWrapper` methods to `lodash.prototype`.
  34483. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34484. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34485. isTaker = /^(?:head|last)$/.test(methodName),
  34486. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34487. retUnwrapped = isTaker || /^find/.test(methodName);
  34488. if (!lodashFunc) {
  34489. return;
  34490. }
  34491. lodash.prototype[methodName] = function() {
  34492. var value = this.__wrapped__,
  34493. args = isTaker ? [1] : arguments,
  34494. isLazy = value instanceof LazyWrapper,
  34495. iteratee = args[0],
  34496. useLazy = isLazy || isArray(value);
  34497. var interceptor = function(value) {
  34498. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34499. return (isTaker && chainAll) ? result[0] : result;
  34500. };
  34501. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34502. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34503. isLazy = useLazy = false;
  34504. }
  34505. var chainAll = this.__chain__,
  34506. isHybrid = !!this.__actions__.length,
  34507. isUnwrapped = retUnwrapped && !chainAll,
  34508. onlyLazy = isLazy && !isHybrid;
  34509. if (!retUnwrapped && useLazy) {
  34510. value = onlyLazy ? value : new LazyWrapper(this);
  34511. var result = func.apply(value, args);
  34512. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34513. return new LodashWrapper(result, chainAll);
  34514. }
  34515. if (isUnwrapped && onlyLazy) {
  34516. return func.apply(this, args);
  34517. }
  34518. result = this.thru(interceptor);
  34519. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34520. };
  34521. });
  34522. // Add `Array` methods to `lodash.prototype`.
  34523. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34524. var func = arrayProto[methodName],
  34525. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34526. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34527. lodash.prototype[methodName] = function() {
  34528. var args = arguments;
  34529. if (retUnwrapped && !this.__chain__) {
  34530. var value = this.value();
  34531. return func.apply(isArray(value) ? value : [], args);
  34532. }
  34533. return this[chainName](function(value) {
  34534. return func.apply(isArray(value) ? value : [], args);
  34535. });
  34536. };
  34537. });
  34538. // Map minified method names to their real names.
  34539. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34540. var lodashFunc = lodash[methodName];
  34541. if (lodashFunc) {
  34542. var key = lodashFunc.name + '';
  34543. if (!hasOwnProperty.call(realNames, key)) {
  34544. realNames[key] = [];
  34545. }
  34546. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34547. }
  34548. });
  34549. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34550. 'name': 'wrapper',
  34551. 'func': undefined
  34552. }];
  34553. // Add methods to `LazyWrapper`.
  34554. LazyWrapper.prototype.clone = lazyClone;
  34555. LazyWrapper.prototype.reverse = lazyReverse;
  34556. LazyWrapper.prototype.value = lazyValue;
  34557. // Add chain sequence methods to the `lodash` wrapper.
  34558. lodash.prototype.at = wrapperAt;
  34559. lodash.prototype.chain = wrapperChain;
  34560. lodash.prototype.commit = wrapperCommit;
  34561. lodash.prototype.next = wrapperNext;
  34562. lodash.prototype.plant = wrapperPlant;
  34563. lodash.prototype.reverse = wrapperReverse;
  34564. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34565. // Add lazy aliases.
  34566. lodash.prototype.first = lodash.prototype.head;
  34567. if (symIterator) {
  34568. lodash.prototype[symIterator] = wrapperToIterator;
  34569. }
  34570. return lodash;
  34571. });
  34572. /*--------------------------------------------------------------------------*/
  34573. // Export lodash.
  34574. var _ = runInContext();
  34575. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34576. if (true) {
  34577. // Expose Lodash on the global object to prevent errors when Lodash is
  34578. // loaded by a script tag in the presence of an AMD loader.
  34579. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34580. // Use `_.noConflict` to remove Lodash from the global object.
  34581. root._ = _;
  34582. // Define as an anonymous module so, through path mapping, it can be
  34583. // referenced as the "underscore" module.
  34584. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34585. return _;
  34586. }).call(exports, __webpack_require__, exports, module),
  34587. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34588. }
  34589. // Check for `exports` after `define` in case a build optimizer adds it.
  34590. else {}
  34591. }.call(this));
  34592. /* 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)))
  34593. /***/ }),
  34594. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34595. /*!***************************************************!*\
  34596. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34597. \***************************************************/
  34598. /*! exports provided: default */
  34599. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34600. "use strict";
  34601. __webpack_require__.r(__webpack_exports__);
  34602. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34603. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34604. * @version 1.16.1
  34605. * @license
  34606. * Copyright (c) 2016 Federico Zivolo and contributors
  34607. *
  34608. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34609. * of this software and associated documentation files (the "Software"), to deal
  34610. * in the Software without restriction, including without limitation the rights
  34611. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34612. * copies of the Software, and to permit persons to whom the Software is
  34613. * furnished to do so, subject to the following conditions:
  34614. *
  34615. * The above copyright notice and this permission notice shall be included in all
  34616. * copies or substantial portions of the Software.
  34617. *
  34618. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34619. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34620. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34621. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34622. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34623. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34624. * SOFTWARE.
  34625. */
  34626. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34627. var timeoutDuration = function () {
  34628. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34629. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34630. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34631. return 1;
  34632. }
  34633. }
  34634. return 0;
  34635. }();
  34636. function microtaskDebounce(fn) {
  34637. var called = false;
  34638. return function () {
  34639. if (called) {
  34640. return;
  34641. }
  34642. called = true;
  34643. window.Promise.resolve().then(function () {
  34644. called = false;
  34645. fn();
  34646. });
  34647. };
  34648. }
  34649. function taskDebounce(fn) {
  34650. var scheduled = false;
  34651. return function () {
  34652. if (!scheduled) {
  34653. scheduled = true;
  34654. setTimeout(function () {
  34655. scheduled = false;
  34656. fn();
  34657. }, timeoutDuration);
  34658. }
  34659. };
  34660. }
  34661. var supportsMicroTasks = isBrowser && window.Promise;
  34662. /**
  34663. * Create a debounced version of a method, that's asynchronously deferred
  34664. * but called in the minimum time possible.
  34665. *
  34666. * @method
  34667. * @memberof Popper.Utils
  34668. * @argument {Function} fn
  34669. * @returns {Function}
  34670. */
  34671. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34672. /**
  34673. * Check if the given variable is a function
  34674. * @method
  34675. * @memberof Popper.Utils
  34676. * @argument {Any} functionToCheck - variable to check
  34677. * @returns {Boolean} answer to: is a function?
  34678. */
  34679. function isFunction(functionToCheck) {
  34680. var getType = {};
  34681. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34682. }
  34683. /**
  34684. * Get CSS computed property of the given element
  34685. * @method
  34686. * @memberof Popper.Utils
  34687. * @argument {Eement} element
  34688. * @argument {String} property
  34689. */
  34690. function getStyleComputedProperty(element, property) {
  34691. if (element.nodeType !== 1) {
  34692. return [];
  34693. }
  34694. // NOTE: 1 DOM access here
  34695. var window = element.ownerDocument.defaultView;
  34696. var css = window.getComputedStyle(element, null);
  34697. return property ? css[property] : css;
  34698. }
  34699. /**
  34700. * Returns the parentNode or the host of the element
  34701. * @method
  34702. * @memberof Popper.Utils
  34703. * @argument {Element} element
  34704. * @returns {Element} parent
  34705. */
  34706. function getParentNode(element) {
  34707. if (element.nodeName === 'HTML') {
  34708. return element;
  34709. }
  34710. return element.parentNode || element.host;
  34711. }
  34712. /**
  34713. * Returns the scrolling parent of the given element
  34714. * @method
  34715. * @memberof Popper.Utils
  34716. * @argument {Element} element
  34717. * @returns {Element} scroll parent
  34718. */
  34719. function getScrollParent(element) {
  34720. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34721. if (!element) {
  34722. return document.body;
  34723. }
  34724. switch (element.nodeName) {
  34725. case 'HTML':
  34726. case 'BODY':
  34727. return element.ownerDocument.body;
  34728. case '#document':
  34729. return element.body;
  34730. }
  34731. // Firefox want us to check `-x` and `-y` variations as well
  34732. var _getStyleComputedProp = getStyleComputedProperty(element),
  34733. overflow = _getStyleComputedProp.overflow,
  34734. overflowX = _getStyleComputedProp.overflowX,
  34735. overflowY = _getStyleComputedProp.overflowY;
  34736. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34737. return element;
  34738. }
  34739. return getScrollParent(getParentNode(element));
  34740. }
  34741. /**
  34742. * Returns the reference node of the reference object, or the reference object itself.
  34743. * @method
  34744. * @memberof Popper.Utils
  34745. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34746. * @returns {Element} parent
  34747. */
  34748. function getReferenceNode(reference) {
  34749. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34750. }
  34751. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34752. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34753. /**
  34754. * Determines if the browser is Internet Explorer
  34755. * @method
  34756. * @memberof Popper.Utils
  34757. * @param {Number} version to check
  34758. * @returns {Boolean} isIE
  34759. */
  34760. function isIE(version) {
  34761. if (version === 11) {
  34762. return isIE11;
  34763. }
  34764. if (version === 10) {
  34765. return isIE10;
  34766. }
  34767. return isIE11 || isIE10;
  34768. }
  34769. /**
  34770. * Returns the offset parent of the given element
  34771. * @method
  34772. * @memberof Popper.Utils
  34773. * @argument {Element} element
  34774. * @returns {Element} offset parent
  34775. */
  34776. function getOffsetParent(element) {
  34777. if (!element) {
  34778. return document.documentElement;
  34779. }
  34780. var noOffsetParent = isIE(10) ? document.body : null;
  34781. // NOTE: 1 DOM access here
  34782. var offsetParent = element.offsetParent || null;
  34783. // Skip hidden elements which don't have an offsetParent
  34784. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34785. offsetParent = (element = element.nextElementSibling).offsetParent;
  34786. }
  34787. var nodeName = offsetParent && offsetParent.nodeName;
  34788. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34789. return element ? element.ownerDocument.documentElement : document.documentElement;
  34790. }
  34791. // .offsetParent will return the closest TH, TD or TABLE in case
  34792. // no offsetParent is present, I hate this job...
  34793. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34794. return getOffsetParent(offsetParent);
  34795. }
  34796. return offsetParent;
  34797. }
  34798. function isOffsetContainer(element) {
  34799. var nodeName = element.nodeName;
  34800. if (nodeName === 'BODY') {
  34801. return false;
  34802. }
  34803. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34804. }
  34805. /**
  34806. * Finds the root node (document, shadowDOM root) of the given element
  34807. * @method
  34808. * @memberof Popper.Utils
  34809. * @argument {Element} node
  34810. * @returns {Element} root node
  34811. */
  34812. function getRoot(node) {
  34813. if (node.parentNode !== null) {
  34814. return getRoot(node.parentNode);
  34815. }
  34816. return node;
  34817. }
  34818. /**
  34819. * Finds the offset parent common to the two provided nodes
  34820. * @method
  34821. * @memberof Popper.Utils
  34822. * @argument {Element} element1
  34823. * @argument {Element} element2
  34824. * @returns {Element} common offset parent
  34825. */
  34826. function findCommonOffsetParent(element1, element2) {
  34827. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34828. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34829. return document.documentElement;
  34830. }
  34831. // Here we make sure to give as "start" the element that comes first in the DOM
  34832. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34833. var start = order ? element1 : element2;
  34834. var end = order ? element2 : element1;
  34835. // Get common ancestor container
  34836. var range = document.createRange();
  34837. range.setStart(start, 0);
  34838. range.setEnd(end, 0);
  34839. var commonAncestorContainer = range.commonAncestorContainer;
  34840. // Both nodes are inside #document
  34841. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34842. if (isOffsetContainer(commonAncestorContainer)) {
  34843. return commonAncestorContainer;
  34844. }
  34845. return getOffsetParent(commonAncestorContainer);
  34846. }
  34847. // one of the nodes is inside shadowDOM, find which one
  34848. var element1root = getRoot(element1);
  34849. if (element1root.host) {
  34850. return findCommonOffsetParent(element1root.host, element2);
  34851. } else {
  34852. return findCommonOffsetParent(element1, getRoot(element2).host);
  34853. }
  34854. }
  34855. /**
  34856. * Gets the scroll value of the given element in the given side (top and left)
  34857. * @method
  34858. * @memberof Popper.Utils
  34859. * @argument {Element} element
  34860. * @argument {String} side `top` or `left`
  34861. * @returns {number} amount of scrolled pixels
  34862. */
  34863. function getScroll(element) {
  34864. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34865. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34866. var nodeName = element.nodeName;
  34867. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34868. var html = element.ownerDocument.documentElement;
  34869. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34870. return scrollingElement[upperSide];
  34871. }
  34872. return element[upperSide];
  34873. }
  34874. /*
  34875. * Sum or subtract the element scroll values (left and top) from a given rect object
  34876. * @method
  34877. * @memberof Popper.Utils
  34878. * @param {Object} rect - Rect object you want to change
  34879. * @param {HTMLElement} element - The element from the function reads the scroll values
  34880. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34881. * @return {Object} rect - The modifier rect object
  34882. */
  34883. function includeScroll(rect, element) {
  34884. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34885. var scrollTop = getScroll(element, 'top');
  34886. var scrollLeft = getScroll(element, 'left');
  34887. var modifier = subtract ? -1 : 1;
  34888. rect.top += scrollTop * modifier;
  34889. rect.bottom += scrollTop * modifier;
  34890. rect.left += scrollLeft * modifier;
  34891. rect.right += scrollLeft * modifier;
  34892. return rect;
  34893. }
  34894. /*
  34895. * Helper to detect borders of a given element
  34896. * @method
  34897. * @memberof Popper.Utils
  34898. * @param {CSSStyleDeclaration} styles
  34899. * Result of `getStyleComputedProperty` on the given element
  34900. * @param {String} axis - `x` or `y`
  34901. * @return {number} borders - The borders size of the given axis
  34902. */
  34903. function getBordersSize(styles, axis) {
  34904. var sideA = axis === 'x' ? 'Left' : 'Top';
  34905. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34906. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34907. }
  34908. function getSize(axis, body, html, computedStyle) {
  34909. 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);
  34910. }
  34911. function getWindowSizes(document) {
  34912. var body = document.body;
  34913. var html = document.documentElement;
  34914. var computedStyle = isIE(10) && getComputedStyle(html);
  34915. return {
  34916. height: getSize('Height', body, html, computedStyle),
  34917. width: getSize('Width', body, html, computedStyle)
  34918. };
  34919. }
  34920. var classCallCheck = function (instance, Constructor) {
  34921. if (!(instance instanceof Constructor)) {
  34922. throw new TypeError("Cannot call a class as a function");
  34923. }
  34924. };
  34925. var createClass = function () {
  34926. function defineProperties(target, props) {
  34927. for (var i = 0; i < props.length; i++) {
  34928. var descriptor = props[i];
  34929. descriptor.enumerable = descriptor.enumerable || false;
  34930. descriptor.configurable = true;
  34931. if ("value" in descriptor) descriptor.writable = true;
  34932. Object.defineProperty(target, descriptor.key, descriptor);
  34933. }
  34934. }
  34935. return function (Constructor, protoProps, staticProps) {
  34936. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34937. if (staticProps) defineProperties(Constructor, staticProps);
  34938. return Constructor;
  34939. };
  34940. }();
  34941. var defineProperty = function (obj, key, value) {
  34942. if (key in obj) {
  34943. Object.defineProperty(obj, key, {
  34944. value: value,
  34945. enumerable: true,
  34946. configurable: true,
  34947. writable: true
  34948. });
  34949. } else {
  34950. obj[key] = value;
  34951. }
  34952. return obj;
  34953. };
  34954. var _extends = Object.assign || function (target) {
  34955. for (var i = 1; i < arguments.length; i++) {
  34956. var source = arguments[i];
  34957. for (var key in source) {
  34958. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34959. target[key] = source[key];
  34960. }
  34961. }
  34962. }
  34963. return target;
  34964. };
  34965. /**
  34966. * Given element offsets, generate an output similar to getBoundingClientRect
  34967. * @method
  34968. * @memberof Popper.Utils
  34969. * @argument {Object} offsets
  34970. * @returns {Object} ClientRect like output
  34971. */
  34972. function getClientRect(offsets) {
  34973. return _extends({}, offsets, {
  34974. right: offsets.left + offsets.width,
  34975. bottom: offsets.top + offsets.height
  34976. });
  34977. }
  34978. /**
  34979. * Get bounding client rect of given element
  34980. * @method
  34981. * @memberof Popper.Utils
  34982. * @param {HTMLElement} element
  34983. * @return {Object} client rect
  34984. */
  34985. function getBoundingClientRect(element) {
  34986. var rect = {};
  34987. // IE10 10 FIX: Please, don't ask, the element isn't
  34988. // considered in DOM in some circumstances...
  34989. // This isn't reproducible in IE10 compatibility mode of IE11
  34990. try {
  34991. if (isIE(10)) {
  34992. rect = element.getBoundingClientRect();
  34993. var scrollTop = getScroll(element, 'top');
  34994. var scrollLeft = getScroll(element, 'left');
  34995. rect.top += scrollTop;
  34996. rect.left += scrollLeft;
  34997. rect.bottom += scrollTop;
  34998. rect.right += scrollLeft;
  34999. } else {
  35000. rect = element.getBoundingClientRect();
  35001. }
  35002. } catch (e) {}
  35003. var result = {
  35004. left: rect.left,
  35005. top: rect.top,
  35006. width: rect.right - rect.left,
  35007. height: rect.bottom - rect.top
  35008. };
  35009. // subtract scrollbar size from sizes
  35010. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35011. var width = sizes.width || element.clientWidth || result.width;
  35012. var height = sizes.height || element.clientHeight || result.height;
  35013. var horizScrollbar = element.offsetWidth - width;
  35014. var vertScrollbar = element.offsetHeight - height;
  35015. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35016. // we make this check conditional for performance reasons
  35017. if (horizScrollbar || vertScrollbar) {
  35018. var styles = getStyleComputedProperty(element);
  35019. horizScrollbar -= getBordersSize(styles, 'x');
  35020. vertScrollbar -= getBordersSize(styles, 'y');
  35021. result.width -= horizScrollbar;
  35022. result.height -= vertScrollbar;
  35023. }
  35024. return getClientRect(result);
  35025. }
  35026. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35027. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35028. var isIE10 = isIE(10);
  35029. var isHTML = parent.nodeName === 'HTML';
  35030. var childrenRect = getBoundingClientRect(children);
  35031. var parentRect = getBoundingClientRect(parent);
  35032. var scrollParent = getScrollParent(children);
  35033. var styles = getStyleComputedProperty(parent);
  35034. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35035. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35036. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35037. if (fixedPosition && isHTML) {
  35038. parentRect.top = Math.max(parentRect.top, 0);
  35039. parentRect.left = Math.max(parentRect.left, 0);
  35040. }
  35041. var offsets = getClientRect({
  35042. top: childrenRect.top - parentRect.top - borderTopWidth,
  35043. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35044. width: childrenRect.width,
  35045. height: childrenRect.height
  35046. });
  35047. offsets.marginTop = 0;
  35048. offsets.marginLeft = 0;
  35049. // Subtract margins of documentElement in case it's being used as parent
  35050. // we do this only on HTML because it's the only element that behaves
  35051. // differently when margins are applied to it. The margins are included in
  35052. // the box of the documentElement, in the other cases not.
  35053. if (!isIE10 && isHTML) {
  35054. var marginTop = parseFloat(styles.marginTop);
  35055. var marginLeft = parseFloat(styles.marginLeft);
  35056. offsets.top -= borderTopWidth - marginTop;
  35057. offsets.bottom -= borderTopWidth - marginTop;
  35058. offsets.left -= borderLeftWidth - marginLeft;
  35059. offsets.right -= borderLeftWidth - marginLeft;
  35060. // Attach marginTop and marginLeft because in some circumstances we may need them
  35061. offsets.marginTop = marginTop;
  35062. offsets.marginLeft = marginLeft;
  35063. }
  35064. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35065. offsets = includeScroll(offsets, parent);
  35066. }
  35067. return offsets;
  35068. }
  35069. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35070. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35071. var html = element.ownerDocument.documentElement;
  35072. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35073. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35074. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35075. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35076. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35077. var offset = {
  35078. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35079. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35080. width: width,
  35081. height: height
  35082. };
  35083. return getClientRect(offset);
  35084. }
  35085. /**
  35086. * Check if the given element is fixed or is inside a fixed parent
  35087. * @method
  35088. * @memberof Popper.Utils
  35089. * @argument {Element} element
  35090. * @argument {Element} customContainer
  35091. * @returns {Boolean} answer to "isFixed?"
  35092. */
  35093. function isFixed(element) {
  35094. var nodeName = element.nodeName;
  35095. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35096. return false;
  35097. }
  35098. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35099. return true;
  35100. }
  35101. var parentNode = getParentNode(element);
  35102. if (!parentNode) {
  35103. return false;
  35104. }
  35105. return isFixed(parentNode);
  35106. }
  35107. /**
  35108. * Finds the first parent of an element that has a transformed property defined
  35109. * @method
  35110. * @memberof Popper.Utils
  35111. * @argument {Element} element
  35112. * @returns {Element} first transformed parent or documentElement
  35113. */
  35114. function getFixedPositionOffsetParent(element) {
  35115. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35116. if (!element || !element.parentElement || isIE()) {
  35117. return document.documentElement;
  35118. }
  35119. var el = element.parentElement;
  35120. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35121. el = el.parentElement;
  35122. }
  35123. return el || document.documentElement;
  35124. }
  35125. /**
  35126. * Computed the boundaries limits and return them
  35127. * @method
  35128. * @memberof Popper.Utils
  35129. * @param {HTMLElement} popper
  35130. * @param {HTMLElement} reference
  35131. * @param {number} padding
  35132. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35133. * @param {Boolean} fixedPosition - Is in fixed position mode
  35134. * @returns {Object} Coordinates of the boundaries
  35135. */
  35136. function getBoundaries(popper, reference, padding, boundariesElement) {
  35137. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35138. // NOTE: 1 DOM access here
  35139. var boundaries = { top: 0, left: 0 };
  35140. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35141. // Handle viewport case
  35142. if (boundariesElement === 'viewport') {
  35143. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35144. } else {
  35145. // Handle other cases based on DOM element used as boundaries
  35146. var boundariesNode = void 0;
  35147. if (boundariesElement === 'scrollParent') {
  35148. boundariesNode = getScrollParent(getParentNode(reference));
  35149. if (boundariesNode.nodeName === 'BODY') {
  35150. boundariesNode = popper.ownerDocument.documentElement;
  35151. }
  35152. } else if (boundariesElement === 'window') {
  35153. boundariesNode = popper.ownerDocument.documentElement;
  35154. } else {
  35155. boundariesNode = boundariesElement;
  35156. }
  35157. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35158. // In case of HTML, we need a different computation
  35159. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35160. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35161. height = _getWindowSizes.height,
  35162. width = _getWindowSizes.width;
  35163. boundaries.top += offsets.top - offsets.marginTop;
  35164. boundaries.bottom = height + offsets.top;
  35165. boundaries.left += offsets.left - offsets.marginLeft;
  35166. boundaries.right = width + offsets.left;
  35167. } else {
  35168. // for all the other DOM elements, this one is good
  35169. boundaries = offsets;
  35170. }
  35171. }
  35172. // Add paddings
  35173. padding = padding || 0;
  35174. var isPaddingNumber = typeof padding === 'number';
  35175. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35176. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35177. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35178. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35179. return boundaries;
  35180. }
  35181. function getArea(_ref) {
  35182. var width = _ref.width,
  35183. height = _ref.height;
  35184. return width * height;
  35185. }
  35186. /**
  35187. * Utility used to transform the `auto` placement to the placement with more
  35188. * available space.
  35189. * @method
  35190. * @memberof Popper.Utils
  35191. * @argument {Object} data - The data object generated by update method
  35192. * @argument {Object} options - Modifiers configuration and options
  35193. * @returns {Object} The data object, properly modified
  35194. */
  35195. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35196. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35197. if (placement.indexOf('auto') === -1) {
  35198. return placement;
  35199. }
  35200. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35201. var rects = {
  35202. top: {
  35203. width: boundaries.width,
  35204. height: refRect.top - boundaries.top
  35205. },
  35206. right: {
  35207. width: boundaries.right - refRect.right,
  35208. height: boundaries.height
  35209. },
  35210. bottom: {
  35211. width: boundaries.width,
  35212. height: boundaries.bottom - refRect.bottom
  35213. },
  35214. left: {
  35215. width: refRect.left - boundaries.left,
  35216. height: boundaries.height
  35217. }
  35218. };
  35219. var sortedAreas = Object.keys(rects).map(function (key) {
  35220. return _extends({
  35221. key: key
  35222. }, rects[key], {
  35223. area: getArea(rects[key])
  35224. });
  35225. }).sort(function (a, b) {
  35226. return b.area - a.area;
  35227. });
  35228. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35229. var width = _ref2.width,
  35230. height = _ref2.height;
  35231. return width >= popper.clientWidth && height >= popper.clientHeight;
  35232. });
  35233. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35234. var variation = placement.split('-')[1];
  35235. return computedPlacement + (variation ? '-' + variation : '');
  35236. }
  35237. /**
  35238. * Get offsets to the reference element
  35239. * @method
  35240. * @memberof Popper.Utils
  35241. * @param {Object} state
  35242. * @param {Element} popper - the popper element
  35243. * @param {Element} reference - the reference element (the popper will be relative to this)
  35244. * @param {Element} fixedPosition - is in fixed position mode
  35245. * @returns {Object} An object containing the offsets which will be applied to the popper
  35246. */
  35247. function getReferenceOffsets(state, popper, reference) {
  35248. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35249. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35250. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35251. }
  35252. /**
  35253. * Get the outer sizes of the given element (offset size + margins)
  35254. * @method
  35255. * @memberof Popper.Utils
  35256. * @argument {Element} element
  35257. * @returns {Object} object containing width and height properties
  35258. */
  35259. function getOuterSizes(element) {
  35260. var window = element.ownerDocument.defaultView;
  35261. var styles = window.getComputedStyle(element);
  35262. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35263. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35264. var result = {
  35265. width: element.offsetWidth + y,
  35266. height: element.offsetHeight + x
  35267. };
  35268. return result;
  35269. }
  35270. /**
  35271. * Get the opposite placement of the given one
  35272. * @method
  35273. * @memberof Popper.Utils
  35274. * @argument {String} placement
  35275. * @returns {String} flipped placement
  35276. */
  35277. function getOppositePlacement(placement) {
  35278. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35279. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35280. return hash[matched];
  35281. });
  35282. }
  35283. /**
  35284. * Get offsets to the popper
  35285. * @method
  35286. * @memberof Popper.Utils
  35287. * @param {Object} position - CSS position the Popper will get applied
  35288. * @param {HTMLElement} popper - the popper element
  35289. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35290. * @param {String} placement - one of the valid placement options
  35291. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35292. */
  35293. function getPopperOffsets(popper, referenceOffsets, placement) {
  35294. placement = placement.split('-')[0];
  35295. // Get popper node sizes
  35296. var popperRect = getOuterSizes(popper);
  35297. // Add position, width and height to our offsets object
  35298. var popperOffsets = {
  35299. width: popperRect.width,
  35300. height: popperRect.height
  35301. };
  35302. // depending by the popper placement we have to compute its offsets slightly differently
  35303. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35304. var mainSide = isHoriz ? 'top' : 'left';
  35305. var secondarySide = isHoriz ? 'left' : 'top';
  35306. var measurement = isHoriz ? 'height' : 'width';
  35307. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35308. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35309. if (placement === secondarySide) {
  35310. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35311. } else {
  35312. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35313. }
  35314. return popperOffsets;
  35315. }
  35316. /**
  35317. * Mimics the `find` method of Array
  35318. * @method
  35319. * @memberof Popper.Utils
  35320. * @argument {Array} arr
  35321. * @argument prop
  35322. * @argument value
  35323. * @returns index or -1
  35324. */
  35325. function find(arr, check) {
  35326. // use native find if supported
  35327. if (Array.prototype.find) {
  35328. return arr.find(check);
  35329. }
  35330. // use `filter` to obtain the same behavior of `find`
  35331. return arr.filter(check)[0];
  35332. }
  35333. /**
  35334. * Return the index of the matching object
  35335. * @method
  35336. * @memberof Popper.Utils
  35337. * @argument {Array} arr
  35338. * @argument prop
  35339. * @argument value
  35340. * @returns index or -1
  35341. */
  35342. function findIndex(arr, prop, value) {
  35343. // use native findIndex if supported
  35344. if (Array.prototype.findIndex) {
  35345. return arr.findIndex(function (cur) {
  35346. return cur[prop] === value;
  35347. });
  35348. }
  35349. // use `find` + `indexOf` if `findIndex` isn't supported
  35350. var match = find(arr, function (obj) {
  35351. return obj[prop] === value;
  35352. });
  35353. return arr.indexOf(match);
  35354. }
  35355. /**
  35356. * Loop trough the list of modifiers and run them in order,
  35357. * each of them will then edit the data object.
  35358. * @method
  35359. * @memberof Popper.Utils
  35360. * @param {dataObject} data
  35361. * @param {Array} modifiers
  35362. * @param {String} ends - Optional modifier name used as stopper
  35363. * @returns {dataObject}
  35364. */
  35365. function runModifiers(modifiers, data, ends) {
  35366. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35367. modifiersToRun.forEach(function (modifier) {
  35368. if (modifier['function']) {
  35369. // eslint-disable-line dot-notation
  35370. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35371. }
  35372. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35373. if (modifier.enabled && isFunction(fn)) {
  35374. // Add properties to offsets to make them a complete clientRect object
  35375. // we do this before each modifier to make sure the previous one doesn't
  35376. // mess with these values
  35377. data.offsets.popper = getClientRect(data.offsets.popper);
  35378. data.offsets.reference = getClientRect(data.offsets.reference);
  35379. data = fn(data, modifier);
  35380. }
  35381. });
  35382. return data;
  35383. }
  35384. /**
  35385. * Updates the position of the popper, computing the new offsets and applying
  35386. * the new style.<br />
  35387. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35388. * @method
  35389. * @memberof Popper
  35390. */
  35391. function update() {
  35392. // if popper is destroyed, don't perform any further update
  35393. if (this.state.isDestroyed) {
  35394. return;
  35395. }
  35396. var data = {
  35397. instance: this,
  35398. styles: {},
  35399. arrowStyles: {},
  35400. attributes: {},
  35401. flipped: false,
  35402. offsets: {}
  35403. };
  35404. // compute reference element offsets
  35405. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35406. // compute auto placement, store placement inside the data object,
  35407. // modifiers will be able to edit `placement` if needed
  35408. // and refer to originalPlacement to know the original value
  35409. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35410. // store the computed placement inside `originalPlacement`
  35411. data.originalPlacement = data.placement;
  35412. data.positionFixed = this.options.positionFixed;
  35413. // compute the popper offsets
  35414. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35415. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35416. // run the modifiers
  35417. data = runModifiers(this.modifiers, data);
  35418. // the first `update` will call `onCreate` callback
  35419. // the other ones will call `onUpdate` callback
  35420. if (!this.state.isCreated) {
  35421. this.state.isCreated = true;
  35422. this.options.onCreate(data);
  35423. } else {
  35424. this.options.onUpdate(data);
  35425. }
  35426. }
  35427. /**
  35428. * Helper used to know if the given modifier is enabled.
  35429. * @method
  35430. * @memberof Popper.Utils
  35431. * @returns {Boolean}
  35432. */
  35433. function isModifierEnabled(modifiers, modifierName) {
  35434. return modifiers.some(function (_ref) {
  35435. var name = _ref.name,
  35436. enabled = _ref.enabled;
  35437. return enabled && name === modifierName;
  35438. });
  35439. }
  35440. /**
  35441. * Get the prefixed supported property name
  35442. * @method
  35443. * @memberof Popper.Utils
  35444. * @argument {String} property (camelCase)
  35445. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35446. */
  35447. function getSupportedPropertyName(property) {
  35448. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35449. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35450. for (var i = 0; i < prefixes.length; i++) {
  35451. var prefix = prefixes[i];
  35452. var toCheck = prefix ? '' + prefix + upperProp : property;
  35453. if (typeof document.body.style[toCheck] !== 'undefined') {
  35454. return toCheck;
  35455. }
  35456. }
  35457. return null;
  35458. }
  35459. /**
  35460. * Destroys the popper.
  35461. * @method
  35462. * @memberof Popper
  35463. */
  35464. function destroy() {
  35465. this.state.isDestroyed = true;
  35466. // touch DOM only if `applyStyle` modifier is enabled
  35467. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35468. this.popper.removeAttribute('x-placement');
  35469. this.popper.style.position = '';
  35470. this.popper.style.top = '';
  35471. this.popper.style.left = '';
  35472. this.popper.style.right = '';
  35473. this.popper.style.bottom = '';
  35474. this.popper.style.willChange = '';
  35475. this.popper.style[getSupportedPropertyName('transform')] = '';
  35476. }
  35477. this.disableEventListeners();
  35478. // remove the popper if user explicitly asked for the deletion on destroy
  35479. // do not use `remove` because IE11 doesn't support it
  35480. if (this.options.removeOnDestroy) {
  35481. this.popper.parentNode.removeChild(this.popper);
  35482. }
  35483. return this;
  35484. }
  35485. /**
  35486. * Get the window associated with the element
  35487. * @argument {Element} element
  35488. * @returns {Window}
  35489. */
  35490. function getWindow(element) {
  35491. var ownerDocument = element.ownerDocument;
  35492. return ownerDocument ? ownerDocument.defaultView : window;
  35493. }
  35494. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35495. var isBody = scrollParent.nodeName === 'BODY';
  35496. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35497. target.addEventListener(event, callback, { passive: true });
  35498. if (!isBody) {
  35499. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35500. }
  35501. scrollParents.push(target);
  35502. }
  35503. /**
  35504. * Setup needed event listeners used to update the popper position
  35505. * @method
  35506. * @memberof Popper.Utils
  35507. * @private
  35508. */
  35509. function setupEventListeners(reference, options, state, updateBound) {
  35510. // Resize event listener on window
  35511. state.updateBound = updateBound;
  35512. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35513. // Scroll event listener on scroll parents
  35514. var scrollElement = getScrollParent(reference);
  35515. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35516. state.scrollElement = scrollElement;
  35517. state.eventsEnabled = true;
  35518. return state;
  35519. }
  35520. /**
  35521. * It will add resize/scroll events and start recalculating
  35522. * position of the popper element when they are triggered.
  35523. * @method
  35524. * @memberof Popper
  35525. */
  35526. function enableEventListeners() {
  35527. if (!this.state.eventsEnabled) {
  35528. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35529. }
  35530. }
  35531. /**
  35532. * Remove event listeners used to update the popper position
  35533. * @method
  35534. * @memberof Popper.Utils
  35535. * @private
  35536. */
  35537. function removeEventListeners(reference, state) {
  35538. // Remove resize event listener on window
  35539. getWindow(reference).removeEventListener('resize', state.updateBound);
  35540. // Remove scroll event listener on scroll parents
  35541. state.scrollParents.forEach(function (target) {
  35542. target.removeEventListener('scroll', state.updateBound);
  35543. });
  35544. // Reset state
  35545. state.updateBound = null;
  35546. state.scrollParents = [];
  35547. state.scrollElement = null;
  35548. state.eventsEnabled = false;
  35549. return state;
  35550. }
  35551. /**
  35552. * It will remove resize/scroll events and won't recalculate popper position
  35553. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35554. * unless you call `update` method manually.
  35555. * @method
  35556. * @memberof Popper
  35557. */
  35558. function disableEventListeners() {
  35559. if (this.state.eventsEnabled) {
  35560. cancelAnimationFrame(this.scheduleUpdate);
  35561. this.state = removeEventListeners(this.reference, this.state);
  35562. }
  35563. }
  35564. /**
  35565. * Tells if a given input is a number
  35566. * @method
  35567. * @memberof Popper.Utils
  35568. * @param {*} input to check
  35569. * @return {Boolean}
  35570. */
  35571. function isNumeric(n) {
  35572. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35573. }
  35574. /**
  35575. * Set the style to the given popper
  35576. * @method
  35577. * @memberof Popper.Utils
  35578. * @argument {Element} element - Element to apply the style to
  35579. * @argument {Object} styles
  35580. * Object with a list of properties and values which will be applied to the element
  35581. */
  35582. function setStyles(element, styles) {
  35583. Object.keys(styles).forEach(function (prop) {
  35584. var unit = '';
  35585. // add unit if the value is numeric and is one of the following
  35586. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35587. unit = 'px';
  35588. }
  35589. element.style[prop] = styles[prop] + unit;
  35590. });
  35591. }
  35592. /**
  35593. * Set the attributes to the given popper
  35594. * @method
  35595. * @memberof Popper.Utils
  35596. * @argument {Element} element - Element to apply the attributes to
  35597. * @argument {Object} styles
  35598. * Object with a list of properties and values which will be applied to the element
  35599. */
  35600. function setAttributes(element, attributes) {
  35601. Object.keys(attributes).forEach(function (prop) {
  35602. var value = attributes[prop];
  35603. if (value !== false) {
  35604. element.setAttribute(prop, attributes[prop]);
  35605. } else {
  35606. element.removeAttribute(prop);
  35607. }
  35608. });
  35609. }
  35610. /**
  35611. * @function
  35612. * @memberof Modifiers
  35613. * @argument {Object} data - The data object generated by `update` method
  35614. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35615. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35616. * @argument {Object} options - Modifiers configuration and options
  35617. * @returns {Object} The same data object
  35618. */
  35619. function applyStyle(data) {
  35620. // any property present in `data.styles` will be applied to the popper,
  35621. // in this way we can make the 3rd party modifiers add custom styles to it
  35622. // Be aware, modifiers could override the properties defined in the previous
  35623. // lines of this modifier!
  35624. setStyles(data.instance.popper, data.styles);
  35625. // any property present in `data.attributes` will be applied to the popper,
  35626. // they will be set as HTML attributes of the element
  35627. setAttributes(data.instance.popper, data.attributes);
  35628. // if arrowElement is defined and arrowStyles has some properties
  35629. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35630. setStyles(data.arrowElement, data.arrowStyles);
  35631. }
  35632. return data;
  35633. }
  35634. /**
  35635. * Set the x-placement attribute before everything else because it could be used
  35636. * to add margins to the popper margins needs to be calculated to get the
  35637. * correct popper offsets.
  35638. * @method
  35639. * @memberof Popper.modifiers
  35640. * @param {HTMLElement} reference - The reference element used to position the popper
  35641. * @param {HTMLElement} popper - The HTML element used as popper
  35642. * @param {Object} options - Popper.js options
  35643. */
  35644. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35645. // compute reference element offsets
  35646. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35647. // compute auto placement, store placement inside the data object,
  35648. // modifiers will be able to edit `placement` if needed
  35649. // and refer to originalPlacement to know the original value
  35650. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35651. popper.setAttribute('x-placement', placement);
  35652. // Apply `position` to popper before anything else because
  35653. // without the position applied we can't guarantee correct computations
  35654. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35655. return options;
  35656. }
  35657. /**
  35658. * @function
  35659. * @memberof Popper.Utils
  35660. * @argument {Object} data - The data object generated by `update` method
  35661. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35662. * @returns {Object} The popper's position offsets rounded
  35663. *
  35664. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35665. * good as it can be within reason.
  35666. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35667. *
  35668. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35669. * as well on High DPI screens).
  35670. *
  35671. * Firefox prefers no rounding for positioning and does not have blurriness on
  35672. * high DPI screens.
  35673. *
  35674. * Only horizontal placement and left/right values need to be considered.
  35675. */
  35676. function getRoundedOffsets(data, shouldRound) {
  35677. var _data$offsets = data.offsets,
  35678. popper = _data$offsets.popper,
  35679. reference = _data$offsets.reference;
  35680. var round = Math.round,
  35681. floor = Math.floor;
  35682. var noRound = function noRound(v) {
  35683. return v;
  35684. };
  35685. var referenceWidth = round(reference.width);
  35686. var popperWidth = round(popper.width);
  35687. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35688. var isVariation = data.placement.indexOf('-') !== -1;
  35689. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35690. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35691. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35692. var verticalToInteger = !shouldRound ? noRound : round;
  35693. return {
  35694. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35695. top: verticalToInteger(popper.top),
  35696. bottom: verticalToInteger(popper.bottom),
  35697. right: horizontalToInteger(popper.right)
  35698. };
  35699. }
  35700. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35701. /**
  35702. * @function
  35703. * @memberof Modifiers
  35704. * @argument {Object} data - The data object generated by `update` method
  35705. * @argument {Object} options - Modifiers configuration and options
  35706. * @returns {Object} The data object, properly modified
  35707. */
  35708. function computeStyle(data, options) {
  35709. var x = options.x,
  35710. y = options.y;
  35711. var popper = data.offsets.popper;
  35712. // Remove this legacy support in Popper.js v2
  35713. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35714. return modifier.name === 'applyStyle';
  35715. }).gpuAcceleration;
  35716. if (legacyGpuAccelerationOption !== undefined) {
  35717. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35718. }
  35719. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35720. var offsetParent = getOffsetParent(data.instance.popper);
  35721. var offsetParentRect = getBoundingClientRect(offsetParent);
  35722. // Styles
  35723. var styles = {
  35724. position: popper.position
  35725. };
  35726. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35727. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35728. var sideB = y === 'right' ? 'left' : 'right';
  35729. // if gpuAcceleration is set to `true` and transform is supported,
  35730. // we use `translate3d` to apply the position to the popper we
  35731. // automatically use the supported prefixed version if needed
  35732. var prefixedProperty = getSupportedPropertyName('transform');
  35733. // now, let's make a step back and look at this code closely (wtf?)
  35734. // If the content of the popper grows once it's been positioned, it
  35735. // may happen that the popper gets misplaced because of the new content
  35736. // overflowing its reference element
  35737. // To avoid this problem, we provide two options (x and y), which allow
  35738. // the consumer to define the offset origin.
  35739. // If we position a popper on top of a reference element, we can set
  35740. // `x` to `top` to make the popper grow towards its top instead of
  35741. // its bottom.
  35742. var left = void 0,
  35743. top = void 0;
  35744. if (sideA === 'bottom') {
  35745. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35746. // and not the bottom of the html element
  35747. if (offsetParent.nodeName === 'HTML') {
  35748. top = -offsetParent.clientHeight + offsets.bottom;
  35749. } else {
  35750. top = -offsetParentRect.height + offsets.bottom;
  35751. }
  35752. } else {
  35753. top = offsets.top;
  35754. }
  35755. if (sideB === 'right') {
  35756. if (offsetParent.nodeName === 'HTML') {
  35757. left = -offsetParent.clientWidth + offsets.right;
  35758. } else {
  35759. left = -offsetParentRect.width + offsets.right;
  35760. }
  35761. } else {
  35762. left = offsets.left;
  35763. }
  35764. if (gpuAcceleration && prefixedProperty) {
  35765. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35766. styles[sideA] = 0;
  35767. styles[sideB] = 0;
  35768. styles.willChange = 'transform';
  35769. } else {
  35770. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35771. var invertTop = sideA === 'bottom' ? -1 : 1;
  35772. var invertLeft = sideB === 'right' ? -1 : 1;
  35773. styles[sideA] = top * invertTop;
  35774. styles[sideB] = left * invertLeft;
  35775. styles.willChange = sideA + ', ' + sideB;
  35776. }
  35777. // Attributes
  35778. var attributes = {
  35779. 'x-placement': data.placement
  35780. };
  35781. // Update `data` attributes, styles and arrowStyles
  35782. data.attributes = _extends({}, attributes, data.attributes);
  35783. data.styles = _extends({}, styles, data.styles);
  35784. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35785. return data;
  35786. }
  35787. /**
  35788. * Helper used to know if the given modifier depends from another one.<br />
  35789. * It checks if the needed modifier is listed and enabled.
  35790. * @method
  35791. * @memberof Popper.Utils
  35792. * @param {Array} modifiers - list of modifiers
  35793. * @param {String} requestingName - name of requesting modifier
  35794. * @param {String} requestedName - name of requested modifier
  35795. * @returns {Boolean}
  35796. */
  35797. function isModifierRequired(modifiers, requestingName, requestedName) {
  35798. var requesting = find(modifiers, function (_ref) {
  35799. var name = _ref.name;
  35800. return name === requestingName;
  35801. });
  35802. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35803. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35804. });
  35805. if (!isRequired) {
  35806. var _requesting = '`' + requestingName + '`';
  35807. var requested = '`' + requestedName + '`';
  35808. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35809. }
  35810. return isRequired;
  35811. }
  35812. /**
  35813. * @function
  35814. * @memberof Modifiers
  35815. * @argument {Object} data - The data object generated by update method
  35816. * @argument {Object} options - Modifiers configuration and options
  35817. * @returns {Object} The data object, properly modified
  35818. */
  35819. function arrow(data, options) {
  35820. var _data$offsets$arrow;
  35821. // arrow depends on keepTogether in order to work
  35822. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35823. return data;
  35824. }
  35825. var arrowElement = options.element;
  35826. // if arrowElement is a string, suppose it's a CSS selector
  35827. if (typeof arrowElement === 'string') {
  35828. arrowElement = data.instance.popper.querySelector(arrowElement);
  35829. // if arrowElement is not found, don't run the modifier
  35830. if (!arrowElement) {
  35831. return data;
  35832. }
  35833. } else {
  35834. // if the arrowElement isn't a query selector we must check that the
  35835. // provided DOM node is child of its popper node
  35836. if (!data.instance.popper.contains(arrowElement)) {
  35837. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35838. return data;
  35839. }
  35840. }
  35841. var placement = data.placement.split('-')[0];
  35842. var _data$offsets = data.offsets,
  35843. popper = _data$offsets.popper,
  35844. reference = _data$offsets.reference;
  35845. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35846. var len = isVertical ? 'height' : 'width';
  35847. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35848. var side = sideCapitalized.toLowerCase();
  35849. var altSide = isVertical ? 'left' : 'top';
  35850. var opSide = isVertical ? 'bottom' : 'right';
  35851. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35852. //
  35853. // extends keepTogether behavior making sure the popper and its
  35854. // reference have enough pixels in conjunction
  35855. //
  35856. // top/left side
  35857. if (reference[opSide] - arrowElementSize < popper[side]) {
  35858. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35859. }
  35860. // bottom/right side
  35861. if (reference[side] + arrowElementSize > popper[opSide]) {
  35862. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35863. }
  35864. data.offsets.popper = getClientRect(data.offsets.popper);
  35865. // compute center of the popper
  35866. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35867. // Compute the sideValue using the updated popper offsets
  35868. // take popper margin in account because we don't have this info available
  35869. var css = getStyleComputedProperty(data.instance.popper);
  35870. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35871. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35872. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35873. // prevent arrowElement from being placed not contiguously to its popper
  35874. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35875. data.arrowElement = arrowElement;
  35876. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35877. return data;
  35878. }
  35879. /**
  35880. * Get the opposite placement variation of the given one
  35881. * @method
  35882. * @memberof Popper.Utils
  35883. * @argument {String} placement variation
  35884. * @returns {String} flipped placement variation
  35885. */
  35886. function getOppositeVariation(variation) {
  35887. if (variation === 'end') {
  35888. return 'start';
  35889. } else if (variation === 'start') {
  35890. return 'end';
  35891. }
  35892. return variation;
  35893. }
  35894. /**
  35895. * List of accepted placements to use as values of the `placement` option.<br />
  35896. * Valid placements are:
  35897. * - `auto`
  35898. * - `top`
  35899. * - `right`
  35900. * - `bottom`
  35901. * - `left`
  35902. *
  35903. * Each placement can have a variation from this list:
  35904. * - `-start`
  35905. * - `-end`
  35906. *
  35907. * Variations are interpreted easily if you think of them as the left to right
  35908. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35909. * is right.<br />
  35910. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35911. *
  35912. * Some valid examples are:
  35913. * - `top-end` (on top of reference, right aligned)
  35914. * - `right-start` (on right of reference, top aligned)
  35915. * - `bottom` (on bottom, centered)
  35916. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35917. *
  35918. * @static
  35919. * @type {Array}
  35920. * @enum {String}
  35921. * @readonly
  35922. * @method placements
  35923. * @memberof Popper
  35924. */
  35925. 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'];
  35926. // Get rid of `auto` `auto-start` and `auto-end`
  35927. var validPlacements = placements.slice(3);
  35928. /**
  35929. * Given an initial placement, returns all the subsequent placements
  35930. * clockwise (or counter-clockwise).
  35931. *
  35932. * @method
  35933. * @memberof Popper.Utils
  35934. * @argument {String} placement - A valid placement (it accepts variations)
  35935. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35936. * @returns {Array} placements including their variations
  35937. */
  35938. function clockwise(placement) {
  35939. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35940. var index = validPlacements.indexOf(placement);
  35941. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35942. return counter ? arr.reverse() : arr;
  35943. }
  35944. var BEHAVIORS = {
  35945. FLIP: 'flip',
  35946. CLOCKWISE: 'clockwise',
  35947. COUNTERCLOCKWISE: 'counterclockwise'
  35948. };
  35949. /**
  35950. * @function
  35951. * @memberof Modifiers
  35952. * @argument {Object} data - The data object generated by update method
  35953. * @argument {Object} options - Modifiers configuration and options
  35954. * @returns {Object} The data object, properly modified
  35955. */
  35956. function flip(data, options) {
  35957. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35958. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35959. return data;
  35960. }
  35961. if (data.flipped && data.placement === data.originalPlacement) {
  35962. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35963. return data;
  35964. }
  35965. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35966. var placement = data.placement.split('-')[0];
  35967. var placementOpposite = getOppositePlacement(placement);
  35968. var variation = data.placement.split('-')[1] || '';
  35969. var flipOrder = [];
  35970. switch (options.behavior) {
  35971. case BEHAVIORS.FLIP:
  35972. flipOrder = [placement, placementOpposite];
  35973. break;
  35974. case BEHAVIORS.CLOCKWISE:
  35975. flipOrder = clockwise(placement);
  35976. break;
  35977. case BEHAVIORS.COUNTERCLOCKWISE:
  35978. flipOrder = clockwise(placement, true);
  35979. break;
  35980. default:
  35981. flipOrder = options.behavior;
  35982. }
  35983. flipOrder.forEach(function (step, index) {
  35984. if (placement !== step || flipOrder.length === index + 1) {
  35985. return data;
  35986. }
  35987. placement = data.placement.split('-')[0];
  35988. placementOpposite = getOppositePlacement(placement);
  35989. var popperOffsets = data.offsets.popper;
  35990. var refOffsets = data.offsets.reference;
  35991. // using floor because the reference offsets may contain decimals we are not going to consider here
  35992. var floor = Math.floor;
  35993. 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);
  35994. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35995. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35996. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35997. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35998. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35999. // flip the variation if required
  36000. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36001. // flips variation if reference element overflows boundaries
  36002. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36003. // flips variation if popper content overflows boundaries
  36004. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36005. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36006. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36007. // this boolean to detect any flip loop
  36008. data.flipped = true;
  36009. if (overlapsRef || overflowsBoundaries) {
  36010. placement = flipOrder[index + 1];
  36011. }
  36012. if (flippedVariation) {
  36013. variation = getOppositeVariation(variation);
  36014. }
  36015. data.placement = placement + (variation ? '-' + variation : '');
  36016. // this object contains `position`, we want to preserve it along with
  36017. // any additional property we may add in the future
  36018. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36019. data = runModifiers(data.instance.modifiers, data, 'flip');
  36020. }
  36021. });
  36022. return data;
  36023. }
  36024. /**
  36025. * @function
  36026. * @memberof Modifiers
  36027. * @argument {Object} data - The data object generated by update method
  36028. * @argument {Object} options - Modifiers configuration and options
  36029. * @returns {Object} The data object, properly modified
  36030. */
  36031. function keepTogether(data) {
  36032. var _data$offsets = data.offsets,
  36033. popper = _data$offsets.popper,
  36034. reference = _data$offsets.reference;
  36035. var placement = data.placement.split('-')[0];
  36036. var floor = Math.floor;
  36037. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36038. var side = isVertical ? 'right' : 'bottom';
  36039. var opSide = isVertical ? 'left' : 'top';
  36040. var measurement = isVertical ? 'width' : 'height';
  36041. if (popper[side] < floor(reference[opSide])) {
  36042. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36043. }
  36044. if (popper[opSide] > floor(reference[side])) {
  36045. data.offsets.popper[opSide] = floor(reference[side]);
  36046. }
  36047. return data;
  36048. }
  36049. /**
  36050. * Converts a string containing value + unit into a px value number
  36051. * @function
  36052. * @memberof {modifiers~offset}
  36053. * @private
  36054. * @argument {String} str - Value + unit string
  36055. * @argument {String} measurement - `height` or `width`
  36056. * @argument {Object} popperOffsets
  36057. * @argument {Object} referenceOffsets
  36058. * @returns {Number|String}
  36059. * Value in pixels, or original string if no values were extracted
  36060. */
  36061. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36062. // separate value from unit
  36063. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36064. var value = +split[1];
  36065. var unit = split[2];
  36066. // If it's not a number it's an operator, I guess
  36067. if (!value) {
  36068. return str;
  36069. }
  36070. if (unit.indexOf('%') === 0) {
  36071. var element = void 0;
  36072. switch (unit) {
  36073. case '%p':
  36074. element = popperOffsets;
  36075. break;
  36076. case '%':
  36077. case '%r':
  36078. default:
  36079. element = referenceOffsets;
  36080. }
  36081. var rect = getClientRect(element);
  36082. return rect[measurement] / 100 * value;
  36083. } else if (unit === 'vh' || unit === 'vw') {
  36084. // if is a vh or vw, we calculate the size based on the viewport
  36085. var size = void 0;
  36086. if (unit === 'vh') {
  36087. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36088. } else {
  36089. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36090. }
  36091. return size / 100 * value;
  36092. } else {
  36093. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36094. // if is an implicit unit, it's px, and we return just the value
  36095. return value;
  36096. }
  36097. }
  36098. /**
  36099. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36100. * @function
  36101. * @memberof {modifiers~offset}
  36102. * @private
  36103. * @argument {String} offset
  36104. * @argument {Object} popperOffsets
  36105. * @argument {Object} referenceOffsets
  36106. * @argument {String} basePlacement
  36107. * @returns {Array} a two cells array with x and y offsets in numbers
  36108. */
  36109. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36110. var offsets = [0, 0];
  36111. // Use height if placement is left or right and index is 0 otherwise use width
  36112. // in this way the first offset will use an axis and the second one
  36113. // will use the other one
  36114. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36115. // Split the offset string to obtain a list of values and operands
  36116. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36117. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36118. return frag.trim();
  36119. });
  36120. // Detect if the offset string contains a pair of values or a single one
  36121. // they could be separated by comma or space
  36122. var divider = fragments.indexOf(find(fragments, function (frag) {
  36123. return frag.search(/,|\s/) !== -1;
  36124. }));
  36125. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36126. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36127. }
  36128. // If divider is found, we divide the list of values and operands to divide
  36129. // them by ofset X and Y.
  36130. var splitRegex = /\s*,\s*|\s+/;
  36131. 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];
  36132. // Convert the values with units to absolute pixels to allow our computations
  36133. ops = ops.map(function (op, index) {
  36134. // Most of the units rely on the orientation of the popper
  36135. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36136. var mergeWithPrevious = false;
  36137. return op
  36138. // This aggregates any `+` or `-` sign that aren't considered operators
  36139. // e.g.: 10 + +5 => [10, +, +5]
  36140. .reduce(function (a, b) {
  36141. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36142. a[a.length - 1] = b;
  36143. mergeWithPrevious = true;
  36144. return a;
  36145. } else if (mergeWithPrevious) {
  36146. a[a.length - 1] += b;
  36147. mergeWithPrevious = false;
  36148. return a;
  36149. } else {
  36150. return a.concat(b);
  36151. }
  36152. }, [])
  36153. // Here we convert the string values into number values (in px)
  36154. .map(function (str) {
  36155. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36156. });
  36157. });
  36158. // Loop trough the offsets arrays and execute the operations
  36159. ops.forEach(function (op, index) {
  36160. op.forEach(function (frag, index2) {
  36161. if (isNumeric(frag)) {
  36162. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36163. }
  36164. });
  36165. });
  36166. return offsets;
  36167. }
  36168. /**
  36169. * @function
  36170. * @memberof Modifiers
  36171. * @argument {Object} data - The data object generated by update method
  36172. * @argument {Object} options - Modifiers configuration and options
  36173. * @argument {Number|String} options.offset=0
  36174. * The offset value as described in the modifier description
  36175. * @returns {Object} The data object, properly modified
  36176. */
  36177. function offset(data, _ref) {
  36178. var offset = _ref.offset;
  36179. var placement = data.placement,
  36180. _data$offsets = data.offsets,
  36181. popper = _data$offsets.popper,
  36182. reference = _data$offsets.reference;
  36183. var basePlacement = placement.split('-')[0];
  36184. var offsets = void 0;
  36185. if (isNumeric(+offset)) {
  36186. offsets = [+offset, 0];
  36187. } else {
  36188. offsets = parseOffset(offset, popper, reference, basePlacement);
  36189. }
  36190. if (basePlacement === 'left') {
  36191. popper.top += offsets[0];
  36192. popper.left -= offsets[1];
  36193. } else if (basePlacement === 'right') {
  36194. popper.top += offsets[0];
  36195. popper.left += offsets[1];
  36196. } else if (basePlacement === 'top') {
  36197. popper.left += offsets[0];
  36198. popper.top -= offsets[1];
  36199. } else if (basePlacement === 'bottom') {
  36200. popper.left += offsets[0];
  36201. popper.top += offsets[1];
  36202. }
  36203. data.popper = popper;
  36204. return data;
  36205. }
  36206. /**
  36207. * @function
  36208. * @memberof Modifiers
  36209. * @argument {Object} data - The data object generated by `update` method
  36210. * @argument {Object} options - Modifiers configuration and options
  36211. * @returns {Object} The data object, properly modified
  36212. */
  36213. function preventOverflow(data, options) {
  36214. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36215. // If offsetParent is the reference element, we really want to
  36216. // go one step up and use the next offsetParent as reference to
  36217. // avoid to make this modifier completely useless and look like broken
  36218. if (data.instance.reference === boundariesElement) {
  36219. boundariesElement = getOffsetParent(boundariesElement);
  36220. }
  36221. // NOTE: DOM access here
  36222. // resets the popper's position so that the document size can be calculated excluding
  36223. // the size of the popper element itself
  36224. var transformProp = getSupportedPropertyName('transform');
  36225. var popperStyles = data.instance.popper.style; // assignment to help minification
  36226. var top = popperStyles.top,
  36227. left = popperStyles.left,
  36228. transform = popperStyles[transformProp];
  36229. popperStyles.top = '';
  36230. popperStyles.left = '';
  36231. popperStyles[transformProp] = '';
  36232. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36233. // NOTE: DOM access here
  36234. // restores the original style properties after the offsets have been computed
  36235. popperStyles.top = top;
  36236. popperStyles.left = left;
  36237. popperStyles[transformProp] = transform;
  36238. options.boundaries = boundaries;
  36239. var order = options.priority;
  36240. var popper = data.offsets.popper;
  36241. var check = {
  36242. primary: function primary(placement) {
  36243. var value = popper[placement];
  36244. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36245. value = Math.max(popper[placement], boundaries[placement]);
  36246. }
  36247. return defineProperty({}, placement, value);
  36248. },
  36249. secondary: function secondary(placement) {
  36250. var mainSide = placement === 'right' ? 'left' : 'top';
  36251. var value = popper[mainSide];
  36252. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36253. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36254. }
  36255. return defineProperty({}, mainSide, value);
  36256. }
  36257. };
  36258. order.forEach(function (placement) {
  36259. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36260. popper = _extends({}, popper, check[side](placement));
  36261. });
  36262. data.offsets.popper = popper;
  36263. return data;
  36264. }
  36265. /**
  36266. * @function
  36267. * @memberof Modifiers
  36268. * @argument {Object} data - The data object generated by `update` method
  36269. * @argument {Object} options - Modifiers configuration and options
  36270. * @returns {Object} The data object, properly modified
  36271. */
  36272. function shift(data) {
  36273. var placement = data.placement;
  36274. var basePlacement = placement.split('-')[0];
  36275. var shiftvariation = placement.split('-')[1];
  36276. // if shift shiftvariation is specified, run the modifier
  36277. if (shiftvariation) {
  36278. var _data$offsets = data.offsets,
  36279. reference = _data$offsets.reference,
  36280. popper = _data$offsets.popper;
  36281. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36282. var side = isVertical ? 'left' : 'top';
  36283. var measurement = isVertical ? 'width' : 'height';
  36284. var shiftOffsets = {
  36285. start: defineProperty({}, side, reference[side]),
  36286. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36287. };
  36288. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36289. }
  36290. return data;
  36291. }
  36292. /**
  36293. * @function
  36294. * @memberof Modifiers
  36295. * @argument {Object} data - The data object generated by update method
  36296. * @argument {Object} options - Modifiers configuration and options
  36297. * @returns {Object} The data object, properly modified
  36298. */
  36299. function hide(data) {
  36300. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36301. return data;
  36302. }
  36303. var refRect = data.offsets.reference;
  36304. var bound = find(data.instance.modifiers, function (modifier) {
  36305. return modifier.name === 'preventOverflow';
  36306. }).boundaries;
  36307. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36308. // Avoid unnecessary DOM access if visibility hasn't changed
  36309. if (data.hide === true) {
  36310. return data;
  36311. }
  36312. data.hide = true;
  36313. data.attributes['x-out-of-boundaries'] = '';
  36314. } else {
  36315. // Avoid unnecessary DOM access if visibility hasn't changed
  36316. if (data.hide === false) {
  36317. return data;
  36318. }
  36319. data.hide = false;
  36320. data.attributes['x-out-of-boundaries'] = false;
  36321. }
  36322. return data;
  36323. }
  36324. /**
  36325. * @function
  36326. * @memberof Modifiers
  36327. * @argument {Object} data - The data object generated by `update` method
  36328. * @argument {Object} options - Modifiers configuration and options
  36329. * @returns {Object} The data object, properly modified
  36330. */
  36331. function inner(data) {
  36332. var placement = data.placement;
  36333. var basePlacement = placement.split('-')[0];
  36334. var _data$offsets = data.offsets,
  36335. popper = _data$offsets.popper,
  36336. reference = _data$offsets.reference;
  36337. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36338. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36339. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36340. data.placement = getOppositePlacement(placement);
  36341. data.offsets.popper = getClientRect(popper);
  36342. return data;
  36343. }
  36344. /**
  36345. * Modifier function, each modifier can have a function of this type assigned
  36346. * to its `fn` property.<br />
  36347. * These functions will be called on each update, this means that you must
  36348. * make sure they are performant enough to avoid performance bottlenecks.
  36349. *
  36350. * @function ModifierFn
  36351. * @argument {dataObject} data - The data object generated by `update` method
  36352. * @argument {Object} options - Modifiers configuration and options
  36353. * @returns {dataObject} The data object, properly modified
  36354. */
  36355. /**
  36356. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36357. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36358. * needed by the library.
  36359. *
  36360. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36361. * All the other properties are configurations that could be tweaked.
  36362. * @namespace modifiers
  36363. */
  36364. var modifiers = {
  36365. /**
  36366. * Modifier used to shift the popper on the start or end of its reference
  36367. * element.<br />
  36368. * It will read the variation of the `placement` property.<br />
  36369. * It can be one either `-end` or `-start`.
  36370. * @memberof modifiers
  36371. * @inner
  36372. */
  36373. shift: {
  36374. /** @prop {number} order=100 - Index used to define the order of execution */
  36375. order: 100,
  36376. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36377. enabled: true,
  36378. /** @prop {ModifierFn} */
  36379. fn: shift
  36380. },
  36381. /**
  36382. * The `offset` modifier can shift your popper on both its axis.
  36383. *
  36384. * It accepts the following units:
  36385. * - `px` or unit-less, interpreted as pixels
  36386. * - `%` or `%r`, percentage relative to the length of the reference element
  36387. * - `%p`, percentage relative to the length of the popper element
  36388. * - `vw`, CSS viewport width unit
  36389. * - `vh`, CSS viewport height unit
  36390. *
  36391. * For length is intended the main axis relative to the placement of the popper.<br />
  36392. * This means that if the placement is `top` or `bottom`, the length will be the
  36393. * `width`. In case of `left` or `right`, it will be the `height`.
  36394. *
  36395. * You can provide a single value (as `Number` or `String`), or a pair of values
  36396. * as `String` divided by a comma or one (or more) white spaces.<br />
  36397. * The latter is a deprecated method because it leads to confusion and will be
  36398. * removed in v2.<br />
  36399. * Additionally, it accepts additions and subtractions between different units.
  36400. * Note that multiplications and divisions aren't supported.
  36401. *
  36402. * Valid examples are:
  36403. * ```
  36404. * 10
  36405. * '10%'
  36406. * '10, 10'
  36407. * '10%, 10'
  36408. * '10 + 10%'
  36409. * '10 - 5vh + 3%'
  36410. * '-10px + 5vh, 5px - 6%'
  36411. * ```
  36412. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36413. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36414. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36415. *
  36416. * @memberof modifiers
  36417. * @inner
  36418. */
  36419. offset: {
  36420. /** @prop {number} order=200 - Index used to define the order of execution */
  36421. order: 200,
  36422. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36423. enabled: true,
  36424. /** @prop {ModifierFn} */
  36425. fn: offset,
  36426. /** @prop {Number|String} offset=0
  36427. * The offset value as described in the modifier description
  36428. */
  36429. offset: 0
  36430. },
  36431. /**
  36432. * Modifier used to prevent the popper from being positioned outside the boundary.
  36433. *
  36434. * A scenario exists where the reference itself is not within the boundaries.<br />
  36435. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36436. * In this case we need to decide whether the popper should either:
  36437. *
  36438. * - detach from the reference and remain "trapped" in the boundaries, or
  36439. * - if it should ignore the boundary and "escape with its reference"
  36440. *
  36441. * When `escapeWithReference` is set to`true` and reference is completely
  36442. * outside its boundaries, the popper will overflow (or completely leave)
  36443. * the boundaries in order to remain attached to the edge of the reference.
  36444. *
  36445. * @memberof modifiers
  36446. * @inner
  36447. */
  36448. preventOverflow: {
  36449. /** @prop {number} order=300 - Index used to define the order of execution */
  36450. order: 300,
  36451. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36452. enabled: true,
  36453. /** @prop {ModifierFn} */
  36454. fn: preventOverflow,
  36455. /**
  36456. * @prop {Array} [priority=['left','right','top','bottom']]
  36457. * Popper will try to prevent overflow following these priorities by default,
  36458. * then, it could overflow on the left and on top of the `boundariesElement`
  36459. */
  36460. priority: ['left', 'right', 'top', 'bottom'],
  36461. /**
  36462. * @prop {number} padding=5
  36463. * Amount of pixel used to define a minimum distance between the boundaries
  36464. * and the popper. This makes sure the popper always has a little padding
  36465. * between the edges of its container
  36466. */
  36467. padding: 5,
  36468. /**
  36469. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36470. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36471. * `viewport` or any DOM element.
  36472. */
  36473. boundariesElement: 'scrollParent'
  36474. },
  36475. /**
  36476. * Modifier used to make sure the reference and its popper stay near each other
  36477. * without leaving any gap between the two. Especially useful when the arrow is
  36478. * enabled and you want to ensure that it points to its reference element.
  36479. * It cares only about the first axis. You can still have poppers with margin
  36480. * between the popper and its reference element.
  36481. * @memberof modifiers
  36482. * @inner
  36483. */
  36484. keepTogether: {
  36485. /** @prop {number} order=400 - Index used to define the order of execution */
  36486. order: 400,
  36487. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36488. enabled: true,
  36489. /** @prop {ModifierFn} */
  36490. fn: keepTogether
  36491. },
  36492. /**
  36493. * This modifier is used to move the `arrowElement` of the popper to make
  36494. * sure it is positioned between the reference element and its popper element.
  36495. * It will read the outer size of the `arrowElement` node to detect how many
  36496. * pixels of conjunction are needed.
  36497. *
  36498. * It has no effect if no `arrowElement` is provided.
  36499. * @memberof modifiers
  36500. * @inner
  36501. */
  36502. arrow: {
  36503. /** @prop {number} order=500 - Index used to define the order of execution */
  36504. order: 500,
  36505. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36506. enabled: true,
  36507. /** @prop {ModifierFn} */
  36508. fn: arrow,
  36509. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36510. element: '[x-arrow]'
  36511. },
  36512. /**
  36513. * Modifier used to flip the popper's placement when it starts to overlap its
  36514. * reference element.
  36515. *
  36516. * Requires the `preventOverflow` modifier before it in order to work.
  36517. *
  36518. * **NOTE:** this modifier will interrupt the current update cycle and will
  36519. * restart it if it detects the need to flip the placement.
  36520. * @memberof modifiers
  36521. * @inner
  36522. */
  36523. flip: {
  36524. /** @prop {number} order=600 - Index used to define the order of execution */
  36525. order: 600,
  36526. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36527. enabled: true,
  36528. /** @prop {ModifierFn} */
  36529. fn: flip,
  36530. /**
  36531. * @prop {String|Array} behavior='flip'
  36532. * The behavior used to change the popper's placement. It can be one of
  36533. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36534. * placements (with optional variations)
  36535. */
  36536. behavior: 'flip',
  36537. /**
  36538. * @prop {number} padding=5
  36539. * The popper will flip if it hits the edges of the `boundariesElement`
  36540. */
  36541. padding: 5,
  36542. /**
  36543. * @prop {String|HTMLElement} boundariesElement='viewport'
  36544. * The element which will define the boundaries of the popper position.
  36545. * The popper will never be placed outside of the defined boundaries
  36546. * (except if `keepTogether` is enabled)
  36547. */
  36548. boundariesElement: 'viewport',
  36549. /**
  36550. * @prop {Boolean} flipVariations=false
  36551. * The popper will switch placement variation between `-start` and `-end` when
  36552. * the reference element overlaps its boundaries.
  36553. *
  36554. * The original placement should have a set variation.
  36555. */
  36556. flipVariations: false,
  36557. /**
  36558. * @prop {Boolean} flipVariationsByContent=false
  36559. * The popper will switch placement variation between `-start` and `-end` when
  36560. * the popper element overlaps its reference boundaries.
  36561. *
  36562. * The original placement should have a set variation.
  36563. */
  36564. flipVariationsByContent: false
  36565. },
  36566. /**
  36567. * Modifier used to make the popper flow toward the inner of the reference element.
  36568. * By default, when this modifier is disabled, the popper will be placed outside
  36569. * the reference element.
  36570. * @memberof modifiers
  36571. * @inner
  36572. */
  36573. inner: {
  36574. /** @prop {number} order=700 - Index used to define the order of execution */
  36575. order: 700,
  36576. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36577. enabled: false,
  36578. /** @prop {ModifierFn} */
  36579. fn: inner
  36580. },
  36581. /**
  36582. * Modifier used to hide the popper when its reference element is outside of the
  36583. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36584. * be used to hide with a CSS selector the popper when its reference is
  36585. * out of boundaries.
  36586. *
  36587. * Requires the `preventOverflow` modifier before it in order to work.
  36588. * @memberof modifiers
  36589. * @inner
  36590. */
  36591. hide: {
  36592. /** @prop {number} order=800 - Index used to define the order of execution */
  36593. order: 800,
  36594. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36595. enabled: true,
  36596. /** @prop {ModifierFn} */
  36597. fn: hide
  36598. },
  36599. /**
  36600. * Computes the style that will be applied to the popper element to gets
  36601. * properly positioned.
  36602. *
  36603. * Note that this modifier will not touch the DOM, it just prepares the styles
  36604. * so that `applyStyle` modifier can apply it. This separation is useful
  36605. * in case you need to replace `applyStyle` with a custom implementation.
  36606. *
  36607. * This modifier has `850` as `order` value to maintain backward compatibility
  36608. * with previous versions of Popper.js. Expect the modifiers ordering method
  36609. * to change in future major versions of the library.
  36610. *
  36611. * @memberof modifiers
  36612. * @inner
  36613. */
  36614. computeStyle: {
  36615. /** @prop {number} order=850 - Index used to define the order of execution */
  36616. order: 850,
  36617. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36618. enabled: true,
  36619. /** @prop {ModifierFn} */
  36620. fn: computeStyle,
  36621. /**
  36622. * @prop {Boolean} gpuAcceleration=true
  36623. * If true, it uses the CSS 3D transformation to position the popper.
  36624. * Otherwise, it will use the `top` and `left` properties
  36625. */
  36626. gpuAcceleration: true,
  36627. /**
  36628. * @prop {string} [x='bottom']
  36629. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36630. * Change this if your popper should grow in a direction different from `bottom`
  36631. */
  36632. x: 'bottom',
  36633. /**
  36634. * @prop {string} [x='left']
  36635. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36636. * Change this if your popper should grow in a direction different from `right`
  36637. */
  36638. y: 'right'
  36639. },
  36640. /**
  36641. * Applies the computed styles to the popper element.
  36642. *
  36643. * All the DOM manipulations are limited to this modifier. This is useful in case
  36644. * you want to integrate Popper.js inside a framework or view library and you
  36645. * want to delegate all the DOM manipulations to it.
  36646. *
  36647. * Note that if you disable this modifier, you must make sure the popper element
  36648. * has its position set to `absolute` before Popper.js can do its work!
  36649. *
  36650. * Just disable this modifier and define your own to achieve the desired effect.
  36651. *
  36652. * @memberof modifiers
  36653. * @inner
  36654. */
  36655. applyStyle: {
  36656. /** @prop {number} order=900 - Index used to define the order of execution */
  36657. order: 900,
  36658. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36659. enabled: true,
  36660. /** @prop {ModifierFn} */
  36661. fn: applyStyle,
  36662. /** @prop {Function} */
  36663. onLoad: applyStyleOnLoad,
  36664. /**
  36665. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36666. * @prop {Boolean} gpuAcceleration=true
  36667. * If true, it uses the CSS 3D transformation to position the popper.
  36668. * Otherwise, it will use the `top` and `left` properties
  36669. */
  36670. gpuAcceleration: undefined
  36671. }
  36672. };
  36673. /**
  36674. * The `dataObject` is an object containing all the information used by Popper.js.
  36675. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36676. * @name dataObject
  36677. * @property {Object} data.instance The Popper.js instance
  36678. * @property {String} data.placement Placement applied to popper
  36679. * @property {String} data.originalPlacement Placement originally defined on init
  36680. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36681. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36682. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36683. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36684. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36685. * @property {Object} data.boundaries Offsets of the popper boundaries
  36686. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36687. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36688. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36689. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36690. */
  36691. /**
  36692. * Default options provided to Popper.js constructor.<br />
  36693. * These can be overridden using the `options` argument of Popper.js.<br />
  36694. * To override an option, simply pass an object with the same
  36695. * structure of the `options` object, as the 3rd argument. For example:
  36696. * ```
  36697. * new Popper(ref, pop, {
  36698. * modifiers: {
  36699. * preventOverflow: { enabled: false }
  36700. * }
  36701. * })
  36702. * ```
  36703. * @type {Object}
  36704. * @static
  36705. * @memberof Popper
  36706. */
  36707. var Defaults = {
  36708. /**
  36709. * Popper's placement.
  36710. * @prop {Popper.placements} placement='bottom'
  36711. */
  36712. placement: 'bottom',
  36713. /**
  36714. * Set this to true if you want popper to position it self in 'fixed' mode
  36715. * @prop {Boolean} positionFixed=false
  36716. */
  36717. positionFixed: false,
  36718. /**
  36719. * Whether events (resize, scroll) are initially enabled.
  36720. * @prop {Boolean} eventsEnabled=true
  36721. */
  36722. eventsEnabled: true,
  36723. /**
  36724. * Set to true if you want to automatically remove the popper when
  36725. * you call the `destroy` method.
  36726. * @prop {Boolean} removeOnDestroy=false
  36727. */
  36728. removeOnDestroy: false,
  36729. /**
  36730. * Callback called when the popper is created.<br />
  36731. * By default, it is set to no-op.<br />
  36732. * Access Popper.js instance with `data.instance`.
  36733. * @prop {onCreate}
  36734. */
  36735. onCreate: function onCreate() {},
  36736. /**
  36737. * Callback called when the popper is updated. This callback is not called
  36738. * on the initialization/creation of the popper, but only on subsequent
  36739. * updates.<br />
  36740. * By default, it is set to no-op.<br />
  36741. * Access Popper.js instance with `data.instance`.
  36742. * @prop {onUpdate}
  36743. */
  36744. onUpdate: function onUpdate() {},
  36745. /**
  36746. * List of modifiers used to modify the offsets before they are applied to the popper.
  36747. * They provide most of the functionalities of Popper.js.
  36748. * @prop {modifiers}
  36749. */
  36750. modifiers: modifiers
  36751. };
  36752. /**
  36753. * @callback onCreate
  36754. * @param {dataObject} data
  36755. */
  36756. /**
  36757. * @callback onUpdate
  36758. * @param {dataObject} data
  36759. */
  36760. // Utils
  36761. // Methods
  36762. var Popper = function () {
  36763. /**
  36764. * Creates a new Popper.js instance.
  36765. * @class Popper
  36766. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36767. * @param {Element} popper - The HTML / XML element used as the popper
  36768. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36769. * @return {Object} instance - The generated Popper.js instance
  36770. */
  36771. function Popper(reference, popper) {
  36772. var _this = this;
  36773. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36774. classCallCheck(this, Popper);
  36775. this.scheduleUpdate = function () {
  36776. return requestAnimationFrame(_this.update);
  36777. };
  36778. // make update() debounced, so that it only runs at most once-per-tick
  36779. this.update = debounce(this.update.bind(this));
  36780. // with {} we create a new object with the options inside it
  36781. this.options = _extends({}, Popper.Defaults, options);
  36782. // init state
  36783. this.state = {
  36784. isDestroyed: false,
  36785. isCreated: false,
  36786. scrollParents: []
  36787. };
  36788. // get reference and popper elements (allow jQuery wrappers)
  36789. this.reference = reference && reference.jquery ? reference[0] : reference;
  36790. this.popper = popper && popper.jquery ? popper[0] : popper;
  36791. // Deep merge modifiers options
  36792. this.options.modifiers = {};
  36793. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36794. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36795. });
  36796. // Refactoring modifiers' list (Object => Array)
  36797. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36798. return _extends({
  36799. name: name
  36800. }, _this.options.modifiers[name]);
  36801. })
  36802. // sort the modifiers by order
  36803. .sort(function (a, b) {
  36804. return a.order - b.order;
  36805. });
  36806. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36807. // such code is executed in the same order of its modifier
  36808. // they could add new properties to their options configuration
  36809. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36810. this.modifiers.forEach(function (modifierOptions) {
  36811. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36812. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36813. }
  36814. });
  36815. // fire the first update to position the popper in the right place
  36816. this.update();
  36817. var eventsEnabled = this.options.eventsEnabled;
  36818. if (eventsEnabled) {
  36819. // setup event listeners, they will take care of update the position in specific situations
  36820. this.enableEventListeners();
  36821. }
  36822. this.state.eventsEnabled = eventsEnabled;
  36823. }
  36824. // We can't use class properties because they don't get listed in the
  36825. // class prototype and break stuff like Sinon stubs
  36826. createClass(Popper, [{
  36827. key: 'update',
  36828. value: function update$$1() {
  36829. return update.call(this);
  36830. }
  36831. }, {
  36832. key: 'destroy',
  36833. value: function destroy$$1() {
  36834. return destroy.call(this);
  36835. }
  36836. }, {
  36837. key: 'enableEventListeners',
  36838. value: function enableEventListeners$$1() {
  36839. return enableEventListeners.call(this);
  36840. }
  36841. }, {
  36842. key: 'disableEventListeners',
  36843. value: function disableEventListeners$$1() {
  36844. return disableEventListeners.call(this);
  36845. }
  36846. /**
  36847. * Schedules an update. It will run on the next UI update available.
  36848. * @method scheduleUpdate
  36849. * @memberof Popper
  36850. */
  36851. /**
  36852. * Collection of utilities useful when writing custom modifiers.
  36853. * Starting from version 1.7, this method is available only if you
  36854. * include `popper-utils.js` before `popper.js`.
  36855. *
  36856. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36857. * and will be removed in v2! Use the PopperUtils module directly instead.
  36858. * Due to the high instability of the methods contained in Utils, we can't
  36859. * guarantee them to follow semver. Use them at your own risk!
  36860. * @static
  36861. * @private
  36862. * @type {Object}
  36863. * @deprecated since version 1.8
  36864. * @member Utils
  36865. * @memberof Popper
  36866. */
  36867. }]);
  36868. return Popper;
  36869. }();
  36870. /**
  36871. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36872. * and lets you use it as replacement of a real DOM node.<br />
  36873. * You can use this method to position a popper relatively to a set of coordinates
  36874. * in case you don't have a DOM node to use as reference.
  36875. *
  36876. * ```
  36877. * new Popper(referenceObject, popperNode);
  36878. * ```
  36879. *
  36880. * NB: This feature isn't supported in Internet Explorer 10.
  36881. * @name referenceObject
  36882. * @property {Function} data.getBoundingClientRect
  36883. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36884. * @property {number} data.clientWidth
  36885. * An ES6 getter that will return the width of the virtual reference element.
  36886. * @property {number} data.clientHeight
  36887. * An ES6 getter that will return the height of the virtual reference element.
  36888. */
  36889. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36890. Popper.placements = placements;
  36891. Popper.Defaults = Defaults;
  36892. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36893. //# sourceMappingURL=popper.js.map
  36894. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36895. /***/ }),
  36896. /***/ "./node_modules/process/browser.js":
  36897. /*!*****************************************!*\
  36898. !*** ./node_modules/process/browser.js ***!
  36899. \*****************************************/
  36900. /*! no static exports found */
  36901. /***/ (function(module, exports) {
  36902. // shim for using process in browser
  36903. var process = module.exports = {};
  36904. // cached from whatever global is present so that test runners that stub it
  36905. // don't break things. But we need to wrap it in a try catch in case it is
  36906. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36907. // function because try/catches deoptimize in certain engines.
  36908. var cachedSetTimeout;
  36909. var cachedClearTimeout;
  36910. function defaultSetTimout() {
  36911. throw new Error('setTimeout has not been defined');
  36912. }
  36913. function defaultClearTimeout () {
  36914. throw new Error('clearTimeout has not been defined');
  36915. }
  36916. (function () {
  36917. try {
  36918. if (typeof setTimeout === 'function') {
  36919. cachedSetTimeout = setTimeout;
  36920. } else {
  36921. cachedSetTimeout = defaultSetTimout;
  36922. }
  36923. } catch (e) {
  36924. cachedSetTimeout = defaultSetTimout;
  36925. }
  36926. try {
  36927. if (typeof clearTimeout === 'function') {
  36928. cachedClearTimeout = clearTimeout;
  36929. } else {
  36930. cachedClearTimeout = defaultClearTimeout;
  36931. }
  36932. } catch (e) {
  36933. cachedClearTimeout = defaultClearTimeout;
  36934. }
  36935. } ())
  36936. function runTimeout(fun) {
  36937. if (cachedSetTimeout === setTimeout) {
  36938. //normal enviroments in sane situations
  36939. return setTimeout(fun, 0);
  36940. }
  36941. // if setTimeout wasn't available but was latter defined
  36942. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36943. cachedSetTimeout = setTimeout;
  36944. return setTimeout(fun, 0);
  36945. }
  36946. try {
  36947. // when when somebody has screwed with setTimeout but no I.E. maddness
  36948. return cachedSetTimeout(fun, 0);
  36949. } catch(e){
  36950. try {
  36951. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36952. return cachedSetTimeout.call(null, fun, 0);
  36953. } catch(e){
  36954. // 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
  36955. return cachedSetTimeout.call(this, fun, 0);
  36956. }
  36957. }
  36958. }
  36959. function runClearTimeout(marker) {
  36960. if (cachedClearTimeout === clearTimeout) {
  36961. //normal enviroments in sane situations
  36962. return clearTimeout(marker);
  36963. }
  36964. // if clearTimeout wasn't available but was latter defined
  36965. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36966. cachedClearTimeout = clearTimeout;
  36967. return clearTimeout(marker);
  36968. }
  36969. try {
  36970. // when when somebody has screwed with setTimeout but no I.E. maddness
  36971. return cachedClearTimeout(marker);
  36972. } catch (e){
  36973. try {
  36974. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36975. return cachedClearTimeout.call(null, marker);
  36976. } catch (e){
  36977. // 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.
  36978. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36979. return cachedClearTimeout.call(this, marker);
  36980. }
  36981. }
  36982. }
  36983. var queue = [];
  36984. var draining = false;
  36985. var currentQueue;
  36986. var queueIndex = -1;
  36987. function cleanUpNextTick() {
  36988. if (!draining || !currentQueue) {
  36989. return;
  36990. }
  36991. draining = false;
  36992. if (currentQueue.length) {
  36993. queue = currentQueue.concat(queue);
  36994. } else {
  36995. queueIndex = -1;
  36996. }
  36997. if (queue.length) {
  36998. drainQueue();
  36999. }
  37000. }
  37001. function drainQueue() {
  37002. if (draining) {
  37003. return;
  37004. }
  37005. var timeout = runTimeout(cleanUpNextTick);
  37006. draining = true;
  37007. var len = queue.length;
  37008. while(len) {
  37009. currentQueue = queue;
  37010. queue = [];
  37011. while (++queueIndex < len) {
  37012. if (currentQueue) {
  37013. currentQueue[queueIndex].run();
  37014. }
  37015. }
  37016. queueIndex = -1;
  37017. len = queue.length;
  37018. }
  37019. currentQueue = null;
  37020. draining = false;
  37021. runClearTimeout(timeout);
  37022. }
  37023. process.nextTick = function (fun) {
  37024. var args = new Array(arguments.length - 1);
  37025. if (arguments.length > 1) {
  37026. for (var i = 1; i < arguments.length; i++) {
  37027. args[i - 1] = arguments[i];
  37028. }
  37029. }
  37030. queue.push(new Item(fun, args));
  37031. if (queue.length === 1 && !draining) {
  37032. runTimeout(drainQueue);
  37033. }
  37034. };
  37035. // v8 likes predictible objects
  37036. function Item(fun, array) {
  37037. this.fun = fun;
  37038. this.array = array;
  37039. }
  37040. Item.prototype.run = function () {
  37041. this.fun.apply(null, this.array);
  37042. };
  37043. process.title = 'browser';
  37044. process.browser = true;
  37045. process.env = {};
  37046. process.argv = [];
  37047. process.version = ''; // empty string to avoid regexp issues
  37048. process.versions = {};
  37049. function noop() {}
  37050. process.on = noop;
  37051. process.addListener = noop;
  37052. process.once = noop;
  37053. process.off = noop;
  37054. process.removeListener = noop;
  37055. process.removeAllListeners = noop;
  37056. process.emit = noop;
  37057. process.prependListener = noop;
  37058. process.prependOnceListener = noop;
  37059. process.listeners = function (name) { return [] }
  37060. process.binding = function (name) {
  37061. throw new Error('process.binding is not supported');
  37062. };
  37063. process.cwd = function () { return '/' };
  37064. process.chdir = function (dir) {
  37065. throw new Error('process.chdir is not supported');
  37066. };
  37067. process.umask = function() { return 0; };
  37068. /***/ }),
  37069. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37070. /*!***************************************************!*\
  37071. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37072. \***************************************************/
  37073. /*! no static exports found */
  37074. /***/ (function(module, exports, __webpack_require__) {
  37075. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37076. * Pusher JavaScript Library v5.0.3
  37077. * https://pusher.com/
  37078. *
  37079. * Copyright 2017, Pusher
  37080. * Released under the MIT licence.
  37081. */
  37082. (function webpackUniversalModuleDefinition(root, factory) {
  37083. if(true)
  37084. module.exports = factory();
  37085. else {}
  37086. })(window, function() {
  37087. return /******/ (function(modules) { // webpackBootstrap
  37088. /******/ // The module cache
  37089. /******/ var installedModules = {};
  37090. /******/
  37091. /******/ // The require function
  37092. /******/ function __webpack_require__(moduleId) {
  37093. /******/
  37094. /******/ // Check if module is in cache
  37095. /******/ if(installedModules[moduleId]) {
  37096. /******/ return installedModules[moduleId].exports;
  37097. /******/ }
  37098. /******/ // Create a new module (and put it into the cache)
  37099. /******/ var module = installedModules[moduleId] = {
  37100. /******/ i: moduleId,
  37101. /******/ l: false,
  37102. /******/ exports: {}
  37103. /******/ };
  37104. /******/
  37105. /******/ // Execute the module function
  37106. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37107. /******/
  37108. /******/ // Flag the module as loaded
  37109. /******/ module.l = true;
  37110. /******/
  37111. /******/ // Return the exports of the module
  37112. /******/ return module.exports;
  37113. /******/ }
  37114. /******/
  37115. /******/
  37116. /******/ // expose the modules object (__webpack_modules__)
  37117. /******/ __webpack_require__.m = modules;
  37118. /******/
  37119. /******/ // expose the module cache
  37120. /******/ __webpack_require__.c = installedModules;
  37121. /******/
  37122. /******/ // define getter function for harmony exports
  37123. /******/ __webpack_require__.d = function(exports, name, getter) {
  37124. /******/ if(!__webpack_require__.o(exports, name)) {
  37125. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37126. /******/ }
  37127. /******/ };
  37128. /******/
  37129. /******/ // define __esModule on exports
  37130. /******/ __webpack_require__.r = function(exports) {
  37131. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37132. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37133. /******/ }
  37134. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37135. /******/ };
  37136. /******/
  37137. /******/ // create a fake namespace object
  37138. /******/ // mode & 1: value is a module id, require it
  37139. /******/ // mode & 2: merge all properties of value into the ns
  37140. /******/ // mode & 4: return value when already ns object
  37141. /******/ // mode & 8|1: behave like require
  37142. /******/ __webpack_require__.t = function(value, mode) {
  37143. /******/ if(mode & 1) value = __webpack_require__(value);
  37144. /******/ if(mode & 8) return value;
  37145. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37146. /******/ var ns = Object.create(null);
  37147. /******/ __webpack_require__.r(ns);
  37148. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37149. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37150. /******/ return ns;
  37151. /******/ };
  37152. /******/
  37153. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37154. /******/ __webpack_require__.n = function(module) {
  37155. /******/ var getter = module && module.__esModule ?
  37156. /******/ function getDefault() { return module['default']; } :
  37157. /******/ function getModuleExports() { return module; };
  37158. /******/ __webpack_require__.d(getter, 'a', getter);
  37159. /******/ return getter;
  37160. /******/ };
  37161. /******/
  37162. /******/ // Object.prototype.hasOwnProperty.call
  37163. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37164. /******/
  37165. /******/ // __webpack_public_path__
  37166. /******/ __webpack_require__.p = "";
  37167. /******/
  37168. /******/
  37169. /******/ // Load entry module and return exports
  37170. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37171. /******/ })
  37172. /************************************************************************/
  37173. /******/ ([
  37174. /* 0 */
  37175. /***/ (function(module, exports, __webpack_require__) {
  37176. (function(nacl) {
  37177. 'use strict';
  37178. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37179. // Public domain.
  37180. //
  37181. // Implementation derived from TweetNaCl version 20140427.
  37182. // See for details: http://tweetnacl.cr.yp.to/
  37183. var gf = function(init) {
  37184. var i, r = new Float64Array(16);
  37185. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37186. return r;
  37187. };
  37188. // Pluggable, initialized in high-level API below.
  37189. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37190. var _0 = new Uint8Array(16);
  37191. var _9 = new Uint8Array(32); _9[0] = 9;
  37192. var gf0 = gf(),
  37193. gf1 = gf([1]),
  37194. _121665 = gf([0xdb41, 1]),
  37195. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37196. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37197. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37198. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37199. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37200. function ts64(x, i, h, l) {
  37201. x[i] = (h >> 24) & 0xff;
  37202. x[i+1] = (h >> 16) & 0xff;
  37203. x[i+2] = (h >> 8) & 0xff;
  37204. x[i+3] = h & 0xff;
  37205. x[i+4] = (l >> 24) & 0xff;
  37206. x[i+5] = (l >> 16) & 0xff;
  37207. x[i+6] = (l >> 8) & 0xff;
  37208. x[i+7] = l & 0xff;
  37209. }
  37210. function vn(x, xi, y, yi, n) {
  37211. var i,d = 0;
  37212. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37213. return (1 & ((d - 1) >>> 8)) - 1;
  37214. }
  37215. function crypto_verify_16(x, xi, y, yi) {
  37216. return vn(x,xi,y,yi,16);
  37217. }
  37218. function crypto_verify_32(x, xi, y, yi) {
  37219. return vn(x,xi,y,yi,32);
  37220. }
  37221. function core_salsa20(o, p, k, c) {
  37222. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37223. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37224. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37225. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37226. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37227. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37228. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37229. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37230. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37231. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37232. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37233. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37234. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37235. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37236. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37237. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37238. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37239. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37240. x15 = j15, u;
  37241. for (var i = 0; i < 20; i += 2) {
  37242. u = x0 + x12 | 0;
  37243. x4 ^= u<<7 | u>>>(32-7);
  37244. u = x4 + x0 | 0;
  37245. x8 ^= u<<9 | u>>>(32-9);
  37246. u = x8 + x4 | 0;
  37247. x12 ^= u<<13 | u>>>(32-13);
  37248. u = x12 + x8 | 0;
  37249. x0 ^= u<<18 | u>>>(32-18);
  37250. u = x5 + x1 | 0;
  37251. x9 ^= u<<7 | u>>>(32-7);
  37252. u = x9 + x5 | 0;
  37253. x13 ^= u<<9 | u>>>(32-9);
  37254. u = x13 + x9 | 0;
  37255. x1 ^= u<<13 | u>>>(32-13);
  37256. u = x1 + x13 | 0;
  37257. x5 ^= u<<18 | u>>>(32-18);
  37258. u = x10 + x6 | 0;
  37259. x14 ^= u<<7 | u>>>(32-7);
  37260. u = x14 + x10 | 0;
  37261. x2 ^= u<<9 | u>>>(32-9);
  37262. u = x2 + x14 | 0;
  37263. x6 ^= u<<13 | u>>>(32-13);
  37264. u = x6 + x2 | 0;
  37265. x10 ^= u<<18 | u>>>(32-18);
  37266. u = x15 + x11 | 0;
  37267. x3 ^= u<<7 | u>>>(32-7);
  37268. u = x3 + x15 | 0;
  37269. x7 ^= u<<9 | u>>>(32-9);
  37270. u = x7 + x3 | 0;
  37271. x11 ^= u<<13 | u>>>(32-13);
  37272. u = x11 + x7 | 0;
  37273. x15 ^= u<<18 | u>>>(32-18);
  37274. u = x0 + x3 | 0;
  37275. x1 ^= u<<7 | u>>>(32-7);
  37276. u = x1 + x0 | 0;
  37277. x2 ^= u<<9 | u>>>(32-9);
  37278. u = x2 + x1 | 0;
  37279. x3 ^= u<<13 | u>>>(32-13);
  37280. u = x3 + x2 | 0;
  37281. x0 ^= u<<18 | u>>>(32-18);
  37282. u = x5 + x4 | 0;
  37283. x6 ^= u<<7 | u>>>(32-7);
  37284. u = x6 + x5 | 0;
  37285. x7 ^= u<<9 | u>>>(32-9);
  37286. u = x7 + x6 | 0;
  37287. x4 ^= u<<13 | u>>>(32-13);
  37288. u = x4 + x7 | 0;
  37289. x5 ^= u<<18 | u>>>(32-18);
  37290. u = x10 + x9 | 0;
  37291. x11 ^= u<<7 | u>>>(32-7);
  37292. u = x11 + x10 | 0;
  37293. x8 ^= u<<9 | u>>>(32-9);
  37294. u = x8 + x11 | 0;
  37295. x9 ^= u<<13 | u>>>(32-13);
  37296. u = x9 + x8 | 0;
  37297. x10 ^= u<<18 | u>>>(32-18);
  37298. u = x15 + x14 | 0;
  37299. x12 ^= u<<7 | u>>>(32-7);
  37300. u = x12 + x15 | 0;
  37301. x13 ^= u<<9 | u>>>(32-9);
  37302. u = x13 + x12 | 0;
  37303. x14 ^= u<<13 | u>>>(32-13);
  37304. u = x14 + x13 | 0;
  37305. x15 ^= u<<18 | u>>>(32-18);
  37306. }
  37307. x0 = x0 + j0 | 0;
  37308. x1 = x1 + j1 | 0;
  37309. x2 = x2 + j2 | 0;
  37310. x3 = x3 + j3 | 0;
  37311. x4 = x4 + j4 | 0;
  37312. x5 = x5 + j5 | 0;
  37313. x6 = x6 + j6 | 0;
  37314. x7 = x7 + j7 | 0;
  37315. x8 = x8 + j8 | 0;
  37316. x9 = x9 + j9 | 0;
  37317. x10 = x10 + j10 | 0;
  37318. x11 = x11 + j11 | 0;
  37319. x12 = x12 + j12 | 0;
  37320. x13 = x13 + j13 | 0;
  37321. x14 = x14 + j14 | 0;
  37322. x15 = x15 + j15 | 0;
  37323. o[ 0] = x0 >>> 0 & 0xff;
  37324. o[ 1] = x0 >>> 8 & 0xff;
  37325. o[ 2] = x0 >>> 16 & 0xff;
  37326. o[ 3] = x0 >>> 24 & 0xff;
  37327. o[ 4] = x1 >>> 0 & 0xff;
  37328. o[ 5] = x1 >>> 8 & 0xff;
  37329. o[ 6] = x1 >>> 16 & 0xff;
  37330. o[ 7] = x1 >>> 24 & 0xff;
  37331. o[ 8] = x2 >>> 0 & 0xff;
  37332. o[ 9] = x2 >>> 8 & 0xff;
  37333. o[10] = x2 >>> 16 & 0xff;
  37334. o[11] = x2 >>> 24 & 0xff;
  37335. o[12] = x3 >>> 0 & 0xff;
  37336. o[13] = x3 >>> 8 & 0xff;
  37337. o[14] = x3 >>> 16 & 0xff;
  37338. o[15] = x3 >>> 24 & 0xff;
  37339. o[16] = x4 >>> 0 & 0xff;
  37340. o[17] = x4 >>> 8 & 0xff;
  37341. o[18] = x4 >>> 16 & 0xff;
  37342. o[19] = x4 >>> 24 & 0xff;
  37343. o[20] = x5 >>> 0 & 0xff;
  37344. o[21] = x5 >>> 8 & 0xff;
  37345. o[22] = x5 >>> 16 & 0xff;
  37346. o[23] = x5 >>> 24 & 0xff;
  37347. o[24] = x6 >>> 0 & 0xff;
  37348. o[25] = x6 >>> 8 & 0xff;
  37349. o[26] = x6 >>> 16 & 0xff;
  37350. o[27] = x6 >>> 24 & 0xff;
  37351. o[28] = x7 >>> 0 & 0xff;
  37352. o[29] = x7 >>> 8 & 0xff;
  37353. o[30] = x7 >>> 16 & 0xff;
  37354. o[31] = x7 >>> 24 & 0xff;
  37355. o[32] = x8 >>> 0 & 0xff;
  37356. o[33] = x8 >>> 8 & 0xff;
  37357. o[34] = x8 >>> 16 & 0xff;
  37358. o[35] = x8 >>> 24 & 0xff;
  37359. o[36] = x9 >>> 0 & 0xff;
  37360. o[37] = x9 >>> 8 & 0xff;
  37361. o[38] = x9 >>> 16 & 0xff;
  37362. o[39] = x9 >>> 24 & 0xff;
  37363. o[40] = x10 >>> 0 & 0xff;
  37364. o[41] = x10 >>> 8 & 0xff;
  37365. o[42] = x10 >>> 16 & 0xff;
  37366. o[43] = x10 >>> 24 & 0xff;
  37367. o[44] = x11 >>> 0 & 0xff;
  37368. o[45] = x11 >>> 8 & 0xff;
  37369. o[46] = x11 >>> 16 & 0xff;
  37370. o[47] = x11 >>> 24 & 0xff;
  37371. o[48] = x12 >>> 0 & 0xff;
  37372. o[49] = x12 >>> 8 & 0xff;
  37373. o[50] = x12 >>> 16 & 0xff;
  37374. o[51] = x12 >>> 24 & 0xff;
  37375. o[52] = x13 >>> 0 & 0xff;
  37376. o[53] = x13 >>> 8 & 0xff;
  37377. o[54] = x13 >>> 16 & 0xff;
  37378. o[55] = x13 >>> 24 & 0xff;
  37379. o[56] = x14 >>> 0 & 0xff;
  37380. o[57] = x14 >>> 8 & 0xff;
  37381. o[58] = x14 >>> 16 & 0xff;
  37382. o[59] = x14 >>> 24 & 0xff;
  37383. o[60] = x15 >>> 0 & 0xff;
  37384. o[61] = x15 >>> 8 & 0xff;
  37385. o[62] = x15 >>> 16 & 0xff;
  37386. o[63] = x15 >>> 24 & 0xff;
  37387. }
  37388. function core_hsalsa20(o,p,k,c) {
  37389. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37390. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37391. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37392. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37393. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37394. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37395. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37396. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37397. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37398. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37399. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37400. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37401. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37402. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37403. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37404. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37405. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37406. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37407. x15 = j15, u;
  37408. for (var i = 0; i < 20; i += 2) {
  37409. u = x0 + x12 | 0;
  37410. x4 ^= u<<7 | u>>>(32-7);
  37411. u = x4 + x0 | 0;
  37412. x8 ^= u<<9 | u>>>(32-9);
  37413. u = x8 + x4 | 0;
  37414. x12 ^= u<<13 | u>>>(32-13);
  37415. u = x12 + x8 | 0;
  37416. x0 ^= u<<18 | u>>>(32-18);
  37417. u = x5 + x1 | 0;
  37418. x9 ^= u<<7 | u>>>(32-7);
  37419. u = x9 + x5 | 0;
  37420. x13 ^= u<<9 | u>>>(32-9);
  37421. u = x13 + x9 | 0;
  37422. x1 ^= u<<13 | u>>>(32-13);
  37423. u = x1 + x13 | 0;
  37424. x5 ^= u<<18 | u>>>(32-18);
  37425. u = x10 + x6 | 0;
  37426. x14 ^= u<<7 | u>>>(32-7);
  37427. u = x14 + x10 | 0;
  37428. x2 ^= u<<9 | u>>>(32-9);
  37429. u = x2 + x14 | 0;
  37430. x6 ^= u<<13 | u>>>(32-13);
  37431. u = x6 + x2 | 0;
  37432. x10 ^= u<<18 | u>>>(32-18);
  37433. u = x15 + x11 | 0;
  37434. x3 ^= u<<7 | u>>>(32-7);
  37435. u = x3 + x15 | 0;
  37436. x7 ^= u<<9 | u>>>(32-9);
  37437. u = x7 + x3 | 0;
  37438. x11 ^= u<<13 | u>>>(32-13);
  37439. u = x11 + x7 | 0;
  37440. x15 ^= u<<18 | u>>>(32-18);
  37441. u = x0 + x3 | 0;
  37442. x1 ^= u<<7 | u>>>(32-7);
  37443. u = x1 + x0 | 0;
  37444. x2 ^= u<<9 | u>>>(32-9);
  37445. u = x2 + x1 | 0;
  37446. x3 ^= u<<13 | u>>>(32-13);
  37447. u = x3 + x2 | 0;
  37448. x0 ^= u<<18 | u>>>(32-18);
  37449. u = x5 + x4 | 0;
  37450. x6 ^= u<<7 | u>>>(32-7);
  37451. u = x6 + x5 | 0;
  37452. x7 ^= u<<9 | u>>>(32-9);
  37453. u = x7 + x6 | 0;
  37454. x4 ^= u<<13 | u>>>(32-13);
  37455. u = x4 + x7 | 0;
  37456. x5 ^= u<<18 | u>>>(32-18);
  37457. u = x10 + x9 | 0;
  37458. x11 ^= u<<7 | u>>>(32-7);
  37459. u = x11 + x10 | 0;
  37460. x8 ^= u<<9 | u>>>(32-9);
  37461. u = x8 + x11 | 0;
  37462. x9 ^= u<<13 | u>>>(32-13);
  37463. u = x9 + x8 | 0;
  37464. x10 ^= u<<18 | u>>>(32-18);
  37465. u = x15 + x14 | 0;
  37466. x12 ^= u<<7 | u>>>(32-7);
  37467. u = x12 + x15 | 0;
  37468. x13 ^= u<<9 | u>>>(32-9);
  37469. u = x13 + x12 | 0;
  37470. x14 ^= u<<13 | u>>>(32-13);
  37471. u = x14 + x13 | 0;
  37472. x15 ^= u<<18 | u>>>(32-18);
  37473. }
  37474. o[ 0] = x0 >>> 0 & 0xff;
  37475. o[ 1] = x0 >>> 8 & 0xff;
  37476. o[ 2] = x0 >>> 16 & 0xff;
  37477. o[ 3] = x0 >>> 24 & 0xff;
  37478. o[ 4] = x5 >>> 0 & 0xff;
  37479. o[ 5] = x5 >>> 8 & 0xff;
  37480. o[ 6] = x5 >>> 16 & 0xff;
  37481. o[ 7] = x5 >>> 24 & 0xff;
  37482. o[ 8] = x10 >>> 0 & 0xff;
  37483. o[ 9] = x10 >>> 8 & 0xff;
  37484. o[10] = x10 >>> 16 & 0xff;
  37485. o[11] = x10 >>> 24 & 0xff;
  37486. o[12] = x15 >>> 0 & 0xff;
  37487. o[13] = x15 >>> 8 & 0xff;
  37488. o[14] = x15 >>> 16 & 0xff;
  37489. o[15] = x15 >>> 24 & 0xff;
  37490. o[16] = x6 >>> 0 & 0xff;
  37491. o[17] = x6 >>> 8 & 0xff;
  37492. o[18] = x6 >>> 16 & 0xff;
  37493. o[19] = x6 >>> 24 & 0xff;
  37494. o[20] = x7 >>> 0 & 0xff;
  37495. o[21] = x7 >>> 8 & 0xff;
  37496. o[22] = x7 >>> 16 & 0xff;
  37497. o[23] = x7 >>> 24 & 0xff;
  37498. o[24] = x8 >>> 0 & 0xff;
  37499. o[25] = x8 >>> 8 & 0xff;
  37500. o[26] = x8 >>> 16 & 0xff;
  37501. o[27] = x8 >>> 24 & 0xff;
  37502. o[28] = x9 >>> 0 & 0xff;
  37503. o[29] = x9 >>> 8 & 0xff;
  37504. o[30] = x9 >>> 16 & 0xff;
  37505. o[31] = x9 >>> 24 & 0xff;
  37506. }
  37507. function crypto_core_salsa20(out,inp,k,c) {
  37508. core_salsa20(out,inp,k,c);
  37509. }
  37510. function crypto_core_hsalsa20(out,inp,k,c) {
  37511. core_hsalsa20(out,inp,k,c);
  37512. }
  37513. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37514. // "expand 32-byte k"
  37515. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37516. var z = new Uint8Array(16), x = new Uint8Array(64);
  37517. var u, i;
  37518. for (i = 0; i < 16; i++) z[i] = 0;
  37519. for (i = 0; i < 8; i++) z[i] = n[i];
  37520. while (b >= 64) {
  37521. crypto_core_salsa20(x,z,k,sigma);
  37522. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37523. u = 1;
  37524. for (i = 8; i < 16; i++) {
  37525. u = u + (z[i] & 0xff) | 0;
  37526. z[i] = u & 0xff;
  37527. u >>>= 8;
  37528. }
  37529. b -= 64;
  37530. cpos += 64;
  37531. mpos += 64;
  37532. }
  37533. if (b > 0) {
  37534. crypto_core_salsa20(x,z,k,sigma);
  37535. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37536. }
  37537. return 0;
  37538. }
  37539. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37540. var z = new Uint8Array(16), x = new Uint8Array(64);
  37541. var u, i;
  37542. for (i = 0; i < 16; i++) z[i] = 0;
  37543. for (i = 0; i < 8; i++) z[i] = n[i];
  37544. while (b >= 64) {
  37545. crypto_core_salsa20(x,z,k,sigma);
  37546. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37547. u = 1;
  37548. for (i = 8; i < 16; i++) {
  37549. u = u + (z[i] & 0xff) | 0;
  37550. z[i] = u & 0xff;
  37551. u >>>= 8;
  37552. }
  37553. b -= 64;
  37554. cpos += 64;
  37555. }
  37556. if (b > 0) {
  37557. crypto_core_salsa20(x,z,k,sigma);
  37558. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37559. }
  37560. return 0;
  37561. }
  37562. function crypto_stream(c,cpos,d,n,k) {
  37563. var s = new Uint8Array(32);
  37564. crypto_core_hsalsa20(s,n,k,sigma);
  37565. var sn = new Uint8Array(8);
  37566. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37567. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37568. }
  37569. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37570. var s = new Uint8Array(32);
  37571. crypto_core_hsalsa20(s,n,k,sigma);
  37572. var sn = new Uint8Array(8);
  37573. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37574. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37575. }
  37576. /*
  37577. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37578. * https://github.com/floodyberry/poly1305-donna
  37579. */
  37580. var poly1305 = function(key) {
  37581. this.buffer = new Uint8Array(16);
  37582. this.r = new Uint16Array(10);
  37583. this.h = new Uint16Array(10);
  37584. this.pad = new Uint16Array(8);
  37585. this.leftover = 0;
  37586. this.fin = 0;
  37587. var t0, t1, t2, t3, t4, t5, t6, t7;
  37588. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37589. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37590. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37591. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37592. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37593. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37594. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37595. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37596. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37597. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37598. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37599. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37600. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37601. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37602. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37603. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37604. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37605. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37606. };
  37607. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37608. var hibit = this.fin ? 0 : (1 << 11);
  37609. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37610. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37611. var h0 = this.h[0],
  37612. h1 = this.h[1],
  37613. h2 = this.h[2],
  37614. h3 = this.h[3],
  37615. h4 = this.h[4],
  37616. h5 = this.h[5],
  37617. h6 = this.h[6],
  37618. h7 = this.h[7],
  37619. h8 = this.h[8],
  37620. h9 = this.h[9];
  37621. var r0 = this.r[0],
  37622. r1 = this.r[1],
  37623. r2 = this.r[2],
  37624. r3 = this.r[3],
  37625. r4 = this.r[4],
  37626. r5 = this.r[5],
  37627. r6 = this.r[6],
  37628. r7 = this.r[7],
  37629. r8 = this.r[8],
  37630. r9 = this.r[9];
  37631. while (bytes >= 16) {
  37632. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37633. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37634. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37635. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37636. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37637. h5 += ((t4 >>> 1)) & 0x1fff;
  37638. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37639. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37640. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37641. h9 += ((t7 >>> 5)) | hibit;
  37642. c = 0;
  37643. d0 = c;
  37644. d0 += h0 * r0;
  37645. d0 += h1 * (5 * r9);
  37646. d0 += h2 * (5 * r8);
  37647. d0 += h3 * (5 * r7);
  37648. d0 += h4 * (5 * r6);
  37649. c = (d0 >>> 13); d0 &= 0x1fff;
  37650. d0 += h5 * (5 * r5);
  37651. d0 += h6 * (5 * r4);
  37652. d0 += h7 * (5 * r3);
  37653. d0 += h8 * (5 * r2);
  37654. d0 += h9 * (5 * r1);
  37655. c += (d0 >>> 13); d0 &= 0x1fff;
  37656. d1 = c;
  37657. d1 += h0 * r1;
  37658. d1 += h1 * r0;
  37659. d1 += h2 * (5 * r9);
  37660. d1 += h3 * (5 * r8);
  37661. d1 += h4 * (5 * r7);
  37662. c = (d1 >>> 13); d1 &= 0x1fff;
  37663. d1 += h5 * (5 * r6);
  37664. d1 += h6 * (5 * r5);
  37665. d1 += h7 * (5 * r4);
  37666. d1 += h8 * (5 * r3);
  37667. d1 += h9 * (5 * r2);
  37668. c += (d1 >>> 13); d1 &= 0x1fff;
  37669. d2 = c;
  37670. d2 += h0 * r2;
  37671. d2 += h1 * r1;
  37672. d2 += h2 * r0;
  37673. d2 += h3 * (5 * r9);
  37674. d2 += h4 * (5 * r8);
  37675. c = (d2 >>> 13); d2 &= 0x1fff;
  37676. d2 += h5 * (5 * r7);
  37677. d2 += h6 * (5 * r6);
  37678. d2 += h7 * (5 * r5);
  37679. d2 += h8 * (5 * r4);
  37680. d2 += h9 * (5 * r3);
  37681. c += (d2 >>> 13); d2 &= 0x1fff;
  37682. d3 = c;
  37683. d3 += h0 * r3;
  37684. d3 += h1 * r2;
  37685. d3 += h2 * r1;
  37686. d3 += h3 * r0;
  37687. d3 += h4 * (5 * r9);
  37688. c = (d3 >>> 13); d3 &= 0x1fff;
  37689. d3 += h5 * (5 * r8);
  37690. d3 += h6 * (5 * r7);
  37691. d3 += h7 * (5 * r6);
  37692. d3 += h8 * (5 * r5);
  37693. d3 += h9 * (5 * r4);
  37694. c += (d3 >>> 13); d3 &= 0x1fff;
  37695. d4 = c;
  37696. d4 += h0 * r4;
  37697. d4 += h1 * r3;
  37698. d4 += h2 * r2;
  37699. d4 += h3 * r1;
  37700. d4 += h4 * r0;
  37701. c = (d4 >>> 13); d4 &= 0x1fff;
  37702. d4 += h5 * (5 * r9);
  37703. d4 += h6 * (5 * r8);
  37704. d4 += h7 * (5 * r7);
  37705. d4 += h8 * (5 * r6);
  37706. d4 += h9 * (5 * r5);
  37707. c += (d4 >>> 13); d4 &= 0x1fff;
  37708. d5 = c;
  37709. d5 += h0 * r5;
  37710. d5 += h1 * r4;
  37711. d5 += h2 * r3;
  37712. d5 += h3 * r2;
  37713. d5 += h4 * r1;
  37714. c = (d5 >>> 13); d5 &= 0x1fff;
  37715. d5 += h5 * r0;
  37716. d5 += h6 * (5 * r9);
  37717. d5 += h7 * (5 * r8);
  37718. d5 += h8 * (5 * r7);
  37719. d5 += h9 * (5 * r6);
  37720. c += (d5 >>> 13); d5 &= 0x1fff;
  37721. d6 = c;
  37722. d6 += h0 * r6;
  37723. d6 += h1 * r5;
  37724. d6 += h2 * r4;
  37725. d6 += h3 * r3;
  37726. d6 += h4 * r2;
  37727. c = (d6 >>> 13); d6 &= 0x1fff;
  37728. d6 += h5 * r1;
  37729. d6 += h6 * r0;
  37730. d6 += h7 * (5 * r9);
  37731. d6 += h8 * (5 * r8);
  37732. d6 += h9 * (5 * r7);
  37733. c += (d6 >>> 13); d6 &= 0x1fff;
  37734. d7 = c;
  37735. d7 += h0 * r7;
  37736. d7 += h1 * r6;
  37737. d7 += h2 * r5;
  37738. d7 += h3 * r4;
  37739. d7 += h4 * r3;
  37740. c = (d7 >>> 13); d7 &= 0x1fff;
  37741. d7 += h5 * r2;
  37742. d7 += h6 * r1;
  37743. d7 += h7 * r0;
  37744. d7 += h8 * (5 * r9);
  37745. d7 += h9 * (5 * r8);
  37746. c += (d7 >>> 13); d7 &= 0x1fff;
  37747. d8 = c;
  37748. d8 += h0 * r8;
  37749. d8 += h1 * r7;
  37750. d8 += h2 * r6;
  37751. d8 += h3 * r5;
  37752. d8 += h4 * r4;
  37753. c = (d8 >>> 13); d8 &= 0x1fff;
  37754. d8 += h5 * r3;
  37755. d8 += h6 * r2;
  37756. d8 += h7 * r1;
  37757. d8 += h8 * r0;
  37758. d8 += h9 * (5 * r9);
  37759. c += (d8 >>> 13); d8 &= 0x1fff;
  37760. d9 = c;
  37761. d9 += h0 * r9;
  37762. d9 += h1 * r8;
  37763. d9 += h2 * r7;
  37764. d9 += h3 * r6;
  37765. d9 += h4 * r5;
  37766. c = (d9 >>> 13); d9 &= 0x1fff;
  37767. d9 += h5 * r4;
  37768. d9 += h6 * r3;
  37769. d9 += h7 * r2;
  37770. d9 += h8 * r1;
  37771. d9 += h9 * r0;
  37772. c += (d9 >>> 13); d9 &= 0x1fff;
  37773. c = (((c << 2) + c)) | 0;
  37774. c = (c + d0) | 0;
  37775. d0 = c & 0x1fff;
  37776. c = (c >>> 13);
  37777. d1 += c;
  37778. h0 = d0;
  37779. h1 = d1;
  37780. h2 = d2;
  37781. h3 = d3;
  37782. h4 = d4;
  37783. h5 = d5;
  37784. h6 = d6;
  37785. h7 = d7;
  37786. h8 = d8;
  37787. h9 = d9;
  37788. mpos += 16;
  37789. bytes -= 16;
  37790. }
  37791. this.h[0] = h0;
  37792. this.h[1] = h1;
  37793. this.h[2] = h2;
  37794. this.h[3] = h3;
  37795. this.h[4] = h4;
  37796. this.h[5] = h5;
  37797. this.h[6] = h6;
  37798. this.h[7] = h7;
  37799. this.h[8] = h8;
  37800. this.h[9] = h9;
  37801. };
  37802. poly1305.prototype.finish = function(mac, macpos) {
  37803. var g = new Uint16Array(10);
  37804. var c, mask, f, i;
  37805. if (this.leftover) {
  37806. i = this.leftover;
  37807. this.buffer[i++] = 1;
  37808. for (; i < 16; i++) this.buffer[i] = 0;
  37809. this.fin = 1;
  37810. this.blocks(this.buffer, 0, 16);
  37811. }
  37812. c = this.h[1] >>> 13;
  37813. this.h[1] &= 0x1fff;
  37814. for (i = 2; i < 10; i++) {
  37815. this.h[i] += c;
  37816. c = this.h[i] >>> 13;
  37817. this.h[i] &= 0x1fff;
  37818. }
  37819. this.h[0] += (c * 5);
  37820. c = this.h[0] >>> 13;
  37821. this.h[0] &= 0x1fff;
  37822. this.h[1] += c;
  37823. c = this.h[1] >>> 13;
  37824. this.h[1] &= 0x1fff;
  37825. this.h[2] += c;
  37826. g[0] = this.h[0] + 5;
  37827. c = g[0] >>> 13;
  37828. g[0] &= 0x1fff;
  37829. for (i = 1; i < 10; i++) {
  37830. g[i] = this.h[i] + c;
  37831. c = g[i] >>> 13;
  37832. g[i] &= 0x1fff;
  37833. }
  37834. g[9] -= (1 << 13);
  37835. mask = (c ^ 1) - 1;
  37836. for (i = 0; i < 10; i++) g[i] &= mask;
  37837. mask = ~mask;
  37838. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37839. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37840. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37841. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37842. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37843. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37844. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37845. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37846. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37847. f = this.h[0] + this.pad[0];
  37848. this.h[0] = f & 0xffff;
  37849. for (i = 1; i < 8; i++) {
  37850. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37851. this.h[i] = f & 0xffff;
  37852. }
  37853. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37854. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37855. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37856. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37857. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37858. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37859. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37860. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37861. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37862. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37863. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37864. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37865. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37866. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37867. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37868. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37869. };
  37870. poly1305.prototype.update = function(m, mpos, bytes) {
  37871. var i, want;
  37872. if (this.leftover) {
  37873. want = (16 - this.leftover);
  37874. if (want > bytes)
  37875. want = bytes;
  37876. for (i = 0; i < want; i++)
  37877. this.buffer[this.leftover + i] = m[mpos+i];
  37878. bytes -= want;
  37879. mpos += want;
  37880. this.leftover += want;
  37881. if (this.leftover < 16)
  37882. return;
  37883. this.blocks(this.buffer, 0, 16);
  37884. this.leftover = 0;
  37885. }
  37886. if (bytes >= 16) {
  37887. want = bytes - (bytes % 16);
  37888. this.blocks(m, mpos, want);
  37889. mpos += want;
  37890. bytes -= want;
  37891. }
  37892. if (bytes) {
  37893. for (i = 0; i < bytes; i++)
  37894. this.buffer[this.leftover + i] = m[mpos+i];
  37895. this.leftover += bytes;
  37896. }
  37897. };
  37898. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37899. var s = new poly1305(k);
  37900. s.update(m, mpos, n);
  37901. s.finish(out, outpos);
  37902. return 0;
  37903. }
  37904. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37905. var x = new Uint8Array(16);
  37906. crypto_onetimeauth(x,0,m,mpos,n,k);
  37907. return crypto_verify_16(h,hpos,x,0);
  37908. }
  37909. function crypto_secretbox(c,m,d,n,k) {
  37910. var i;
  37911. if (d < 32) return -1;
  37912. crypto_stream_xor(c,0,m,0,d,n,k);
  37913. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37914. for (i = 0; i < 16; i++) c[i] = 0;
  37915. return 0;
  37916. }
  37917. function crypto_secretbox_open(m,c,d,n,k) {
  37918. var i;
  37919. var x = new Uint8Array(32);
  37920. if (d < 32) return -1;
  37921. crypto_stream(x,0,32,n,k);
  37922. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37923. crypto_stream_xor(m,0,c,0,d,n,k);
  37924. for (i = 0; i < 32; i++) m[i] = 0;
  37925. return 0;
  37926. }
  37927. function set25519(r, a) {
  37928. var i;
  37929. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37930. }
  37931. function car25519(o) {
  37932. var i, v, c = 1;
  37933. for (i = 0; i < 16; i++) {
  37934. v = o[i] + c + 65535;
  37935. c = Math.floor(v / 65536);
  37936. o[i] = v - c * 65536;
  37937. }
  37938. o[0] += c-1 + 37 * (c-1);
  37939. }
  37940. function sel25519(p, q, b) {
  37941. var t, c = ~(b-1);
  37942. for (var i = 0; i < 16; i++) {
  37943. t = c & (p[i] ^ q[i]);
  37944. p[i] ^= t;
  37945. q[i] ^= t;
  37946. }
  37947. }
  37948. function pack25519(o, n) {
  37949. var i, j, b;
  37950. var m = gf(), t = gf();
  37951. for (i = 0; i < 16; i++) t[i] = n[i];
  37952. car25519(t);
  37953. car25519(t);
  37954. car25519(t);
  37955. for (j = 0; j < 2; j++) {
  37956. m[0] = t[0] - 0xffed;
  37957. for (i = 1; i < 15; i++) {
  37958. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37959. m[i-1] &= 0xffff;
  37960. }
  37961. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37962. b = (m[15]>>16) & 1;
  37963. m[14] &= 0xffff;
  37964. sel25519(t, m, 1-b);
  37965. }
  37966. for (i = 0; i < 16; i++) {
  37967. o[2*i] = t[i] & 0xff;
  37968. o[2*i+1] = t[i]>>8;
  37969. }
  37970. }
  37971. function neq25519(a, b) {
  37972. var c = new Uint8Array(32), d = new Uint8Array(32);
  37973. pack25519(c, a);
  37974. pack25519(d, b);
  37975. return crypto_verify_32(c, 0, d, 0);
  37976. }
  37977. function par25519(a) {
  37978. var d = new Uint8Array(32);
  37979. pack25519(d, a);
  37980. return d[0] & 1;
  37981. }
  37982. function unpack25519(o, n) {
  37983. var i;
  37984. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37985. o[15] &= 0x7fff;
  37986. }
  37987. function A(o, a, b) {
  37988. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37989. }
  37990. function Z(o, a, b) {
  37991. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37992. }
  37993. function M(o, a, b) {
  37994. var v, c,
  37995. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37996. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37997. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37998. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37999. b0 = b[0],
  38000. b1 = b[1],
  38001. b2 = b[2],
  38002. b3 = b[3],
  38003. b4 = b[4],
  38004. b5 = b[5],
  38005. b6 = b[6],
  38006. b7 = b[7],
  38007. b8 = b[8],
  38008. b9 = b[9],
  38009. b10 = b[10],
  38010. b11 = b[11],
  38011. b12 = b[12],
  38012. b13 = b[13],
  38013. b14 = b[14],
  38014. b15 = b[15];
  38015. v = a[0];
  38016. t0 += v * b0;
  38017. t1 += v * b1;
  38018. t2 += v * b2;
  38019. t3 += v * b3;
  38020. t4 += v * b4;
  38021. t5 += v * b5;
  38022. t6 += v * b6;
  38023. t7 += v * b7;
  38024. t8 += v * b8;
  38025. t9 += v * b9;
  38026. t10 += v * b10;
  38027. t11 += v * b11;
  38028. t12 += v * b12;
  38029. t13 += v * b13;
  38030. t14 += v * b14;
  38031. t15 += v * b15;
  38032. v = a[1];
  38033. t1 += v * b0;
  38034. t2 += v * b1;
  38035. t3 += v * b2;
  38036. t4 += v * b3;
  38037. t5 += v * b4;
  38038. t6 += v * b5;
  38039. t7 += v * b6;
  38040. t8 += v * b7;
  38041. t9 += v * b8;
  38042. t10 += v * b9;
  38043. t11 += v * b10;
  38044. t12 += v * b11;
  38045. t13 += v * b12;
  38046. t14 += v * b13;
  38047. t15 += v * b14;
  38048. t16 += v * b15;
  38049. v = a[2];
  38050. t2 += v * b0;
  38051. t3 += v * b1;
  38052. t4 += v * b2;
  38053. t5 += v * b3;
  38054. t6 += v * b4;
  38055. t7 += v * b5;
  38056. t8 += v * b6;
  38057. t9 += v * b7;
  38058. t10 += v * b8;
  38059. t11 += v * b9;
  38060. t12 += v * b10;
  38061. t13 += v * b11;
  38062. t14 += v * b12;
  38063. t15 += v * b13;
  38064. t16 += v * b14;
  38065. t17 += v * b15;
  38066. v = a[3];
  38067. t3 += v * b0;
  38068. t4 += v * b1;
  38069. t5 += v * b2;
  38070. t6 += v * b3;
  38071. t7 += v * b4;
  38072. t8 += v * b5;
  38073. t9 += v * b6;
  38074. t10 += v * b7;
  38075. t11 += v * b8;
  38076. t12 += v * b9;
  38077. t13 += v * b10;
  38078. t14 += v * b11;
  38079. t15 += v * b12;
  38080. t16 += v * b13;
  38081. t17 += v * b14;
  38082. t18 += v * b15;
  38083. v = a[4];
  38084. t4 += v * b0;
  38085. t5 += v * b1;
  38086. t6 += v * b2;
  38087. t7 += v * b3;
  38088. t8 += v * b4;
  38089. t9 += v * b5;
  38090. t10 += v * b6;
  38091. t11 += v * b7;
  38092. t12 += v * b8;
  38093. t13 += v * b9;
  38094. t14 += v * b10;
  38095. t15 += v * b11;
  38096. t16 += v * b12;
  38097. t17 += v * b13;
  38098. t18 += v * b14;
  38099. t19 += v * b15;
  38100. v = a[5];
  38101. t5 += v * b0;
  38102. t6 += v * b1;
  38103. t7 += v * b2;
  38104. t8 += v * b3;
  38105. t9 += v * b4;
  38106. t10 += v * b5;
  38107. t11 += v * b6;
  38108. t12 += v * b7;
  38109. t13 += v * b8;
  38110. t14 += v * b9;
  38111. t15 += v * b10;
  38112. t16 += v * b11;
  38113. t17 += v * b12;
  38114. t18 += v * b13;
  38115. t19 += v * b14;
  38116. t20 += v * b15;
  38117. v = a[6];
  38118. t6 += v * b0;
  38119. t7 += v * b1;
  38120. t8 += v * b2;
  38121. t9 += v * b3;
  38122. t10 += v * b4;
  38123. t11 += v * b5;
  38124. t12 += v * b6;
  38125. t13 += v * b7;
  38126. t14 += v * b8;
  38127. t15 += v * b9;
  38128. t16 += v * b10;
  38129. t17 += v * b11;
  38130. t18 += v * b12;
  38131. t19 += v * b13;
  38132. t20 += v * b14;
  38133. t21 += v * b15;
  38134. v = a[7];
  38135. t7 += v * b0;
  38136. t8 += v * b1;
  38137. t9 += v * b2;
  38138. t10 += v * b3;
  38139. t11 += v * b4;
  38140. t12 += v * b5;
  38141. t13 += v * b6;
  38142. t14 += v * b7;
  38143. t15 += v * b8;
  38144. t16 += v * b9;
  38145. t17 += v * b10;
  38146. t18 += v * b11;
  38147. t19 += v * b12;
  38148. t20 += v * b13;
  38149. t21 += v * b14;
  38150. t22 += v * b15;
  38151. v = a[8];
  38152. t8 += v * b0;
  38153. t9 += v * b1;
  38154. t10 += v * b2;
  38155. t11 += v * b3;
  38156. t12 += v * b4;
  38157. t13 += v * b5;
  38158. t14 += v * b6;
  38159. t15 += v * b7;
  38160. t16 += v * b8;
  38161. t17 += v * b9;
  38162. t18 += v * b10;
  38163. t19 += v * b11;
  38164. t20 += v * b12;
  38165. t21 += v * b13;
  38166. t22 += v * b14;
  38167. t23 += v * b15;
  38168. v = a[9];
  38169. t9 += v * b0;
  38170. t10 += v * b1;
  38171. t11 += v * b2;
  38172. t12 += v * b3;
  38173. t13 += v * b4;
  38174. t14 += v * b5;
  38175. t15 += v * b6;
  38176. t16 += v * b7;
  38177. t17 += v * b8;
  38178. t18 += v * b9;
  38179. t19 += v * b10;
  38180. t20 += v * b11;
  38181. t21 += v * b12;
  38182. t22 += v * b13;
  38183. t23 += v * b14;
  38184. t24 += v * b15;
  38185. v = a[10];
  38186. t10 += v * b0;
  38187. t11 += v * b1;
  38188. t12 += v * b2;
  38189. t13 += v * b3;
  38190. t14 += v * b4;
  38191. t15 += v * b5;
  38192. t16 += v * b6;
  38193. t17 += v * b7;
  38194. t18 += v * b8;
  38195. t19 += v * b9;
  38196. t20 += v * b10;
  38197. t21 += v * b11;
  38198. t22 += v * b12;
  38199. t23 += v * b13;
  38200. t24 += v * b14;
  38201. t25 += v * b15;
  38202. v = a[11];
  38203. t11 += v * b0;
  38204. t12 += v * b1;
  38205. t13 += v * b2;
  38206. t14 += v * b3;
  38207. t15 += v * b4;
  38208. t16 += v * b5;
  38209. t17 += v * b6;
  38210. t18 += v * b7;
  38211. t19 += v * b8;
  38212. t20 += v * b9;
  38213. t21 += v * b10;
  38214. t22 += v * b11;
  38215. t23 += v * b12;
  38216. t24 += v * b13;
  38217. t25 += v * b14;
  38218. t26 += v * b15;
  38219. v = a[12];
  38220. t12 += v * b0;
  38221. t13 += v * b1;
  38222. t14 += v * b2;
  38223. t15 += v * b3;
  38224. t16 += v * b4;
  38225. t17 += v * b5;
  38226. t18 += v * b6;
  38227. t19 += v * b7;
  38228. t20 += v * b8;
  38229. t21 += v * b9;
  38230. t22 += v * b10;
  38231. t23 += v * b11;
  38232. t24 += v * b12;
  38233. t25 += v * b13;
  38234. t26 += v * b14;
  38235. t27 += v * b15;
  38236. v = a[13];
  38237. t13 += v * b0;
  38238. t14 += v * b1;
  38239. t15 += v * b2;
  38240. t16 += v * b3;
  38241. t17 += v * b4;
  38242. t18 += v * b5;
  38243. t19 += v * b6;
  38244. t20 += v * b7;
  38245. t21 += v * b8;
  38246. t22 += v * b9;
  38247. t23 += v * b10;
  38248. t24 += v * b11;
  38249. t25 += v * b12;
  38250. t26 += v * b13;
  38251. t27 += v * b14;
  38252. t28 += v * b15;
  38253. v = a[14];
  38254. t14 += v * b0;
  38255. t15 += v * b1;
  38256. t16 += v * b2;
  38257. t17 += v * b3;
  38258. t18 += v * b4;
  38259. t19 += v * b5;
  38260. t20 += v * b6;
  38261. t21 += v * b7;
  38262. t22 += v * b8;
  38263. t23 += v * b9;
  38264. t24 += v * b10;
  38265. t25 += v * b11;
  38266. t26 += v * b12;
  38267. t27 += v * b13;
  38268. t28 += v * b14;
  38269. t29 += v * b15;
  38270. v = a[15];
  38271. t15 += v * b0;
  38272. t16 += v * b1;
  38273. t17 += v * b2;
  38274. t18 += v * b3;
  38275. t19 += v * b4;
  38276. t20 += v * b5;
  38277. t21 += v * b6;
  38278. t22 += v * b7;
  38279. t23 += v * b8;
  38280. t24 += v * b9;
  38281. t25 += v * b10;
  38282. t26 += v * b11;
  38283. t27 += v * b12;
  38284. t28 += v * b13;
  38285. t29 += v * b14;
  38286. t30 += v * b15;
  38287. t0 += 38 * t16;
  38288. t1 += 38 * t17;
  38289. t2 += 38 * t18;
  38290. t3 += 38 * t19;
  38291. t4 += 38 * t20;
  38292. t5 += 38 * t21;
  38293. t6 += 38 * t22;
  38294. t7 += 38 * t23;
  38295. t8 += 38 * t24;
  38296. t9 += 38 * t25;
  38297. t10 += 38 * t26;
  38298. t11 += 38 * t27;
  38299. t12 += 38 * t28;
  38300. t13 += 38 * t29;
  38301. t14 += 38 * t30;
  38302. // t15 left as is
  38303. // first car
  38304. c = 1;
  38305. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38306. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38307. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38308. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38309. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38310. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38311. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38312. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38313. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38314. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38315. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38316. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38317. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38318. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38319. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38320. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38321. t0 += c-1 + 37 * (c-1);
  38322. // second car
  38323. c = 1;
  38324. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38325. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38326. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38327. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38328. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38329. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38330. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38331. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38332. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38333. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38334. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38335. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38336. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38337. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38338. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38339. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38340. t0 += c-1 + 37 * (c-1);
  38341. o[ 0] = t0;
  38342. o[ 1] = t1;
  38343. o[ 2] = t2;
  38344. o[ 3] = t3;
  38345. o[ 4] = t4;
  38346. o[ 5] = t5;
  38347. o[ 6] = t6;
  38348. o[ 7] = t7;
  38349. o[ 8] = t8;
  38350. o[ 9] = t9;
  38351. o[10] = t10;
  38352. o[11] = t11;
  38353. o[12] = t12;
  38354. o[13] = t13;
  38355. o[14] = t14;
  38356. o[15] = t15;
  38357. }
  38358. function S(o, a) {
  38359. M(o, a, a);
  38360. }
  38361. function inv25519(o, i) {
  38362. var c = gf();
  38363. var a;
  38364. for (a = 0; a < 16; a++) c[a] = i[a];
  38365. for (a = 253; a >= 0; a--) {
  38366. S(c, c);
  38367. if(a !== 2 && a !== 4) M(c, c, i);
  38368. }
  38369. for (a = 0; a < 16; a++) o[a] = c[a];
  38370. }
  38371. function pow2523(o, i) {
  38372. var c = gf();
  38373. var a;
  38374. for (a = 0; a < 16; a++) c[a] = i[a];
  38375. for (a = 250; a >= 0; a--) {
  38376. S(c, c);
  38377. if(a !== 1) M(c, c, i);
  38378. }
  38379. for (a = 0; a < 16; a++) o[a] = c[a];
  38380. }
  38381. function crypto_scalarmult(q, n, p) {
  38382. var z = new Uint8Array(32);
  38383. var x = new Float64Array(80), r, i;
  38384. var a = gf(), b = gf(), c = gf(),
  38385. d = gf(), e = gf(), f = gf();
  38386. for (i = 0; i < 31; i++) z[i] = n[i];
  38387. z[31]=(n[31]&127)|64;
  38388. z[0]&=248;
  38389. unpack25519(x,p);
  38390. for (i = 0; i < 16; i++) {
  38391. b[i]=x[i];
  38392. d[i]=a[i]=c[i]=0;
  38393. }
  38394. a[0]=d[0]=1;
  38395. for (i=254; i>=0; --i) {
  38396. r=(z[i>>>3]>>>(i&7))&1;
  38397. sel25519(a,b,r);
  38398. sel25519(c,d,r);
  38399. A(e,a,c);
  38400. Z(a,a,c);
  38401. A(c,b,d);
  38402. Z(b,b,d);
  38403. S(d,e);
  38404. S(f,a);
  38405. M(a,c,a);
  38406. M(c,b,e);
  38407. A(e,a,c);
  38408. Z(a,a,c);
  38409. S(b,a);
  38410. Z(c,d,f);
  38411. M(a,c,_121665);
  38412. A(a,a,d);
  38413. M(c,c,a);
  38414. M(a,d,f);
  38415. M(d,b,x);
  38416. S(b,e);
  38417. sel25519(a,b,r);
  38418. sel25519(c,d,r);
  38419. }
  38420. for (i = 0; i < 16; i++) {
  38421. x[i+16]=a[i];
  38422. x[i+32]=c[i];
  38423. x[i+48]=b[i];
  38424. x[i+64]=d[i];
  38425. }
  38426. var x32 = x.subarray(32);
  38427. var x16 = x.subarray(16);
  38428. inv25519(x32,x32);
  38429. M(x16,x16,x32);
  38430. pack25519(q,x16);
  38431. return 0;
  38432. }
  38433. function crypto_scalarmult_base(q, n) {
  38434. return crypto_scalarmult(q, n, _9);
  38435. }
  38436. function crypto_box_keypair(y, x) {
  38437. randombytes(x, 32);
  38438. return crypto_scalarmult_base(y, x);
  38439. }
  38440. function crypto_box_beforenm(k, y, x) {
  38441. var s = new Uint8Array(32);
  38442. crypto_scalarmult(s, x, y);
  38443. return crypto_core_hsalsa20(k, _0, s, sigma);
  38444. }
  38445. var crypto_box_afternm = crypto_secretbox;
  38446. var crypto_box_open_afternm = crypto_secretbox_open;
  38447. function crypto_box(c, m, d, n, y, x) {
  38448. var k = new Uint8Array(32);
  38449. crypto_box_beforenm(k, y, x);
  38450. return crypto_box_afternm(c, m, d, n, k);
  38451. }
  38452. function crypto_box_open(m, c, d, n, y, x) {
  38453. var k = new Uint8Array(32);
  38454. crypto_box_beforenm(k, y, x);
  38455. return crypto_box_open_afternm(m, c, d, n, k);
  38456. }
  38457. var K = [
  38458. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38459. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38460. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38461. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38462. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38463. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38464. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38465. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38466. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38467. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38468. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38469. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38470. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38471. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38472. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38473. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38474. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38475. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38476. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38477. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38478. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38479. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38480. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38481. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38482. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38483. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38484. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38485. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38486. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38487. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38488. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38489. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38490. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38491. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38492. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38493. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38494. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38495. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38496. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38497. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38498. ];
  38499. function crypto_hashblocks_hl(hh, hl, m, n) {
  38500. var wh = new Int32Array(16), wl = new Int32Array(16),
  38501. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38502. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38503. th, tl, i, j, h, l, a, b, c, d;
  38504. var ah0 = hh[0],
  38505. ah1 = hh[1],
  38506. ah2 = hh[2],
  38507. ah3 = hh[3],
  38508. ah4 = hh[4],
  38509. ah5 = hh[5],
  38510. ah6 = hh[6],
  38511. ah7 = hh[7],
  38512. al0 = hl[0],
  38513. al1 = hl[1],
  38514. al2 = hl[2],
  38515. al3 = hl[3],
  38516. al4 = hl[4],
  38517. al5 = hl[5],
  38518. al6 = hl[6],
  38519. al7 = hl[7];
  38520. var pos = 0;
  38521. while (n >= 128) {
  38522. for (i = 0; i < 16; i++) {
  38523. j = 8 * i + pos;
  38524. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38525. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38526. }
  38527. for (i = 0; i < 80; i++) {
  38528. bh0 = ah0;
  38529. bh1 = ah1;
  38530. bh2 = ah2;
  38531. bh3 = ah3;
  38532. bh4 = ah4;
  38533. bh5 = ah5;
  38534. bh6 = ah6;
  38535. bh7 = ah7;
  38536. bl0 = al0;
  38537. bl1 = al1;
  38538. bl2 = al2;
  38539. bl3 = al3;
  38540. bl4 = al4;
  38541. bl5 = al5;
  38542. bl6 = al6;
  38543. bl7 = al7;
  38544. // add
  38545. h = ah7;
  38546. l = al7;
  38547. a = l & 0xffff; b = l >>> 16;
  38548. c = h & 0xffff; d = h >>> 16;
  38549. // Sigma1
  38550. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38551. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38552. a += l & 0xffff; b += l >>> 16;
  38553. c += h & 0xffff; d += h >>> 16;
  38554. // Ch
  38555. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38556. l = (al4 & al5) ^ (~al4 & al6);
  38557. a += l & 0xffff; b += l >>> 16;
  38558. c += h & 0xffff; d += h >>> 16;
  38559. // K
  38560. h = K[i*2];
  38561. l = K[i*2+1];
  38562. a += l & 0xffff; b += l >>> 16;
  38563. c += h & 0xffff; d += h >>> 16;
  38564. // w
  38565. h = wh[i%16];
  38566. l = wl[i%16];
  38567. a += l & 0xffff; b += l >>> 16;
  38568. c += h & 0xffff; d += h >>> 16;
  38569. b += a >>> 16;
  38570. c += b >>> 16;
  38571. d += c >>> 16;
  38572. th = c & 0xffff | d << 16;
  38573. tl = a & 0xffff | b << 16;
  38574. // add
  38575. h = th;
  38576. l = tl;
  38577. a = l & 0xffff; b = l >>> 16;
  38578. c = h & 0xffff; d = h >>> 16;
  38579. // Sigma0
  38580. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38581. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38582. a += l & 0xffff; b += l >>> 16;
  38583. c += h & 0xffff; d += h >>> 16;
  38584. // Maj
  38585. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38586. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38587. a += l & 0xffff; b += l >>> 16;
  38588. c += h & 0xffff; d += h >>> 16;
  38589. b += a >>> 16;
  38590. c += b >>> 16;
  38591. d += c >>> 16;
  38592. bh7 = (c & 0xffff) | (d << 16);
  38593. bl7 = (a & 0xffff) | (b << 16);
  38594. // add
  38595. h = bh3;
  38596. l = bl3;
  38597. a = l & 0xffff; b = l >>> 16;
  38598. c = h & 0xffff; d = h >>> 16;
  38599. h = th;
  38600. l = tl;
  38601. a += l & 0xffff; b += l >>> 16;
  38602. c += h & 0xffff; d += h >>> 16;
  38603. b += a >>> 16;
  38604. c += b >>> 16;
  38605. d += c >>> 16;
  38606. bh3 = (c & 0xffff) | (d << 16);
  38607. bl3 = (a & 0xffff) | (b << 16);
  38608. ah1 = bh0;
  38609. ah2 = bh1;
  38610. ah3 = bh2;
  38611. ah4 = bh3;
  38612. ah5 = bh4;
  38613. ah6 = bh5;
  38614. ah7 = bh6;
  38615. ah0 = bh7;
  38616. al1 = bl0;
  38617. al2 = bl1;
  38618. al3 = bl2;
  38619. al4 = bl3;
  38620. al5 = bl4;
  38621. al6 = bl5;
  38622. al7 = bl6;
  38623. al0 = bl7;
  38624. if (i%16 === 15) {
  38625. for (j = 0; j < 16; j++) {
  38626. // add
  38627. h = wh[j];
  38628. l = wl[j];
  38629. a = l & 0xffff; b = l >>> 16;
  38630. c = h & 0xffff; d = h >>> 16;
  38631. h = wh[(j+9)%16];
  38632. l = wl[(j+9)%16];
  38633. a += l & 0xffff; b += l >>> 16;
  38634. c += h & 0xffff; d += h >>> 16;
  38635. // sigma0
  38636. th = wh[(j+1)%16];
  38637. tl = wl[(j+1)%16];
  38638. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38639. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38640. a += l & 0xffff; b += l >>> 16;
  38641. c += h & 0xffff; d += h >>> 16;
  38642. // sigma1
  38643. th = wh[(j+14)%16];
  38644. tl = wl[(j+14)%16];
  38645. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38646. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38647. a += l & 0xffff; b += l >>> 16;
  38648. c += h & 0xffff; d += h >>> 16;
  38649. b += a >>> 16;
  38650. c += b >>> 16;
  38651. d += c >>> 16;
  38652. wh[j] = (c & 0xffff) | (d << 16);
  38653. wl[j] = (a & 0xffff) | (b << 16);
  38654. }
  38655. }
  38656. }
  38657. // add
  38658. h = ah0;
  38659. l = al0;
  38660. a = l & 0xffff; b = l >>> 16;
  38661. c = h & 0xffff; d = h >>> 16;
  38662. h = hh[0];
  38663. l = hl[0];
  38664. a += l & 0xffff; b += l >>> 16;
  38665. c += h & 0xffff; d += h >>> 16;
  38666. b += a >>> 16;
  38667. c += b >>> 16;
  38668. d += c >>> 16;
  38669. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38670. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38671. h = ah1;
  38672. l = al1;
  38673. a = l & 0xffff; b = l >>> 16;
  38674. c = h & 0xffff; d = h >>> 16;
  38675. h = hh[1];
  38676. l = hl[1];
  38677. a += l & 0xffff; b += l >>> 16;
  38678. c += h & 0xffff; d += h >>> 16;
  38679. b += a >>> 16;
  38680. c += b >>> 16;
  38681. d += c >>> 16;
  38682. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38683. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38684. h = ah2;
  38685. l = al2;
  38686. a = l & 0xffff; b = l >>> 16;
  38687. c = h & 0xffff; d = h >>> 16;
  38688. h = hh[2];
  38689. l = hl[2];
  38690. a += l & 0xffff; b += l >>> 16;
  38691. c += h & 0xffff; d += h >>> 16;
  38692. b += a >>> 16;
  38693. c += b >>> 16;
  38694. d += c >>> 16;
  38695. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38696. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38697. h = ah3;
  38698. l = al3;
  38699. a = l & 0xffff; b = l >>> 16;
  38700. c = h & 0xffff; d = h >>> 16;
  38701. h = hh[3];
  38702. l = hl[3];
  38703. a += l & 0xffff; b += l >>> 16;
  38704. c += h & 0xffff; d += h >>> 16;
  38705. b += a >>> 16;
  38706. c += b >>> 16;
  38707. d += c >>> 16;
  38708. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38709. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38710. h = ah4;
  38711. l = al4;
  38712. a = l & 0xffff; b = l >>> 16;
  38713. c = h & 0xffff; d = h >>> 16;
  38714. h = hh[4];
  38715. l = hl[4];
  38716. a += l & 0xffff; b += l >>> 16;
  38717. c += h & 0xffff; d += h >>> 16;
  38718. b += a >>> 16;
  38719. c += b >>> 16;
  38720. d += c >>> 16;
  38721. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38722. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38723. h = ah5;
  38724. l = al5;
  38725. a = l & 0xffff; b = l >>> 16;
  38726. c = h & 0xffff; d = h >>> 16;
  38727. h = hh[5];
  38728. l = hl[5];
  38729. a += l & 0xffff; b += l >>> 16;
  38730. c += h & 0xffff; d += h >>> 16;
  38731. b += a >>> 16;
  38732. c += b >>> 16;
  38733. d += c >>> 16;
  38734. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38735. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38736. h = ah6;
  38737. l = al6;
  38738. a = l & 0xffff; b = l >>> 16;
  38739. c = h & 0xffff; d = h >>> 16;
  38740. h = hh[6];
  38741. l = hl[6];
  38742. a += l & 0xffff; b += l >>> 16;
  38743. c += h & 0xffff; d += h >>> 16;
  38744. b += a >>> 16;
  38745. c += b >>> 16;
  38746. d += c >>> 16;
  38747. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38748. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38749. h = ah7;
  38750. l = al7;
  38751. a = l & 0xffff; b = l >>> 16;
  38752. c = h & 0xffff; d = h >>> 16;
  38753. h = hh[7];
  38754. l = hl[7];
  38755. a += l & 0xffff; b += l >>> 16;
  38756. c += h & 0xffff; d += h >>> 16;
  38757. b += a >>> 16;
  38758. c += b >>> 16;
  38759. d += c >>> 16;
  38760. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38761. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38762. pos += 128;
  38763. n -= 128;
  38764. }
  38765. return n;
  38766. }
  38767. function crypto_hash(out, m, n) {
  38768. var hh = new Int32Array(8),
  38769. hl = new Int32Array(8),
  38770. x = new Uint8Array(256),
  38771. i, b = n;
  38772. hh[0] = 0x6a09e667;
  38773. hh[1] = 0xbb67ae85;
  38774. hh[2] = 0x3c6ef372;
  38775. hh[3] = 0xa54ff53a;
  38776. hh[4] = 0x510e527f;
  38777. hh[5] = 0x9b05688c;
  38778. hh[6] = 0x1f83d9ab;
  38779. hh[7] = 0x5be0cd19;
  38780. hl[0] = 0xf3bcc908;
  38781. hl[1] = 0x84caa73b;
  38782. hl[2] = 0xfe94f82b;
  38783. hl[3] = 0x5f1d36f1;
  38784. hl[4] = 0xade682d1;
  38785. hl[5] = 0x2b3e6c1f;
  38786. hl[6] = 0xfb41bd6b;
  38787. hl[7] = 0x137e2179;
  38788. crypto_hashblocks_hl(hh, hl, m, n);
  38789. n %= 128;
  38790. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38791. x[n] = 128;
  38792. n = 256-128*(n<112?1:0);
  38793. x[n-9] = 0;
  38794. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38795. crypto_hashblocks_hl(hh, hl, x, n);
  38796. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38797. return 0;
  38798. }
  38799. function add(p, q) {
  38800. var a = gf(), b = gf(), c = gf(),
  38801. d = gf(), e = gf(), f = gf(),
  38802. g = gf(), h = gf(), t = gf();
  38803. Z(a, p[1], p[0]);
  38804. Z(t, q[1], q[0]);
  38805. M(a, a, t);
  38806. A(b, p[0], p[1]);
  38807. A(t, q[0], q[1]);
  38808. M(b, b, t);
  38809. M(c, p[3], q[3]);
  38810. M(c, c, D2);
  38811. M(d, p[2], q[2]);
  38812. A(d, d, d);
  38813. Z(e, b, a);
  38814. Z(f, d, c);
  38815. A(g, d, c);
  38816. A(h, b, a);
  38817. M(p[0], e, f);
  38818. M(p[1], h, g);
  38819. M(p[2], g, f);
  38820. M(p[3], e, h);
  38821. }
  38822. function cswap(p, q, b) {
  38823. var i;
  38824. for (i = 0; i < 4; i++) {
  38825. sel25519(p[i], q[i], b);
  38826. }
  38827. }
  38828. function pack(r, p) {
  38829. var tx = gf(), ty = gf(), zi = gf();
  38830. inv25519(zi, p[2]);
  38831. M(tx, p[0], zi);
  38832. M(ty, p[1], zi);
  38833. pack25519(r, ty);
  38834. r[31] ^= par25519(tx) << 7;
  38835. }
  38836. function scalarmult(p, q, s) {
  38837. var b, i;
  38838. set25519(p[0], gf0);
  38839. set25519(p[1], gf1);
  38840. set25519(p[2], gf1);
  38841. set25519(p[3], gf0);
  38842. for (i = 255; i >= 0; --i) {
  38843. b = (s[(i/8)|0] >> (i&7)) & 1;
  38844. cswap(p, q, b);
  38845. add(q, p);
  38846. add(p, p);
  38847. cswap(p, q, b);
  38848. }
  38849. }
  38850. function scalarbase(p, s) {
  38851. var q = [gf(), gf(), gf(), gf()];
  38852. set25519(q[0], X);
  38853. set25519(q[1], Y);
  38854. set25519(q[2], gf1);
  38855. M(q[3], X, Y);
  38856. scalarmult(p, q, s);
  38857. }
  38858. function crypto_sign_keypair(pk, sk, seeded) {
  38859. var d = new Uint8Array(64);
  38860. var p = [gf(), gf(), gf(), gf()];
  38861. var i;
  38862. if (!seeded) randombytes(sk, 32);
  38863. crypto_hash(d, sk, 32);
  38864. d[0] &= 248;
  38865. d[31] &= 127;
  38866. d[31] |= 64;
  38867. scalarbase(p, d);
  38868. pack(pk, p);
  38869. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38870. return 0;
  38871. }
  38872. 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]);
  38873. function modL(r, x) {
  38874. var carry, i, j, k;
  38875. for (i = 63; i >= 32; --i) {
  38876. carry = 0;
  38877. for (j = i - 32, k = i - 12; j < k; ++j) {
  38878. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38879. carry = (x[j] + 128) >> 8;
  38880. x[j] -= carry * 256;
  38881. }
  38882. x[j] += carry;
  38883. x[i] = 0;
  38884. }
  38885. carry = 0;
  38886. for (j = 0; j < 32; j++) {
  38887. x[j] += carry - (x[31] >> 4) * L[j];
  38888. carry = x[j] >> 8;
  38889. x[j] &= 255;
  38890. }
  38891. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38892. for (i = 0; i < 32; i++) {
  38893. x[i+1] += x[i] >> 8;
  38894. r[i] = x[i] & 255;
  38895. }
  38896. }
  38897. function reduce(r) {
  38898. var x = new Float64Array(64), i;
  38899. for (i = 0; i < 64; i++) x[i] = r[i];
  38900. for (i = 0; i < 64; i++) r[i] = 0;
  38901. modL(r, x);
  38902. }
  38903. // Note: difference from C - smlen returned, not passed as argument.
  38904. function crypto_sign(sm, m, n, sk) {
  38905. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38906. var i, j, x = new Float64Array(64);
  38907. var p = [gf(), gf(), gf(), gf()];
  38908. crypto_hash(d, sk, 32);
  38909. d[0] &= 248;
  38910. d[31] &= 127;
  38911. d[31] |= 64;
  38912. var smlen = n + 64;
  38913. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38914. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38915. crypto_hash(r, sm.subarray(32), n+32);
  38916. reduce(r);
  38917. scalarbase(p, r);
  38918. pack(sm, p);
  38919. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38920. crypto_hash(h, sm, n + 64);
  38921. reduce(h);
  38922. for (i = 0; i < 64; i++) x[i] = 0;
  38923. for (i = 0; i < 32; i++) x[i] = r[i];
  38924. for (i = 0; i < 32; i++) {
  38925. for (j = 0; j < 32; j++) {
  38926. x[i+j] += h[i] * d[j];
  38927. }
  38928. }
  38929. modL(sm.subarray(32), x);
  38930. return smlen;
  38931. }
  38932. function unpackneg(r, p) {
  38933. var t = gf(), chk = gf(), num = gf(),
  38934. den = gf(), den2 = gf(), den4 = gf(),
  38935. den6 = gf();
  38936. set25519(r[2], gf1);
  38937. unpack25519(r[1], p);
  38938. S(num, r[1]);
  38939. M(den, num, D);
  38940. Z(num, num, r[2]);
  38941. A(den, r[2], den);
  38942. S(den2, den);
  38943. S(den4, den2);
  38944. M(den6, den4, den2);
  38945. M(t, den6, num);
  38946. M(t, t, den);
  38947. pow2523(t, t);
  38948. M(t, t, num);
  38949. M(t, t, den);
  38950. M(t, t, den);
  38951. M(r[0], t, den);
  38952. S(chk, r[0]);
  38953. M(chk, chk, den);
  38954. if (neq25519(chk, num)) M(r[0], r[0], I);
  38955. S(chk, r[0]);
  38956. M(chk, chk, den);
  38957. if (neq25519(chk, num)) return -1;
  38958. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38959. M(r[3], r[0], r[1]);
  38960. return 0;
  38961. }
  38962. function crypto_sign_open(m, sm, n, pk) {
  38963. var i, mlen;
  38964. var t = new Uint8Array(32), h = new Uint8Array(64);
  38965. var p = [gf(), gf(), gf(), gf()],
  38966. q = [gf(), gf(), gf(), gf()];
  38967. mlen = -1;
  38968. if (n < 64) return -1;
  38969. if (unpackneg(q, pk)) return -1;
  38970. for (i = 0; i < n; i++) m[i] = sm[i];
  38971. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38972. crypto_hash(h, m, n);
  38973. reduce(h);
  38974. scalarmult(p, q, h);
  38975. scalarbase(q, sm.subarray(32));
  38976. add(p, q);
  38977. pack(t, p);
  38978. n -= 64;
  38979. if (crypto_verify_32(sm, 0, t, 0)) {
  38980. for (i = 0; i < n; i++) m[i] = 0;
  38981. return -1;
  38982. }
  38983. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38984. mlen = n;
  38985. return mlen;
  38986. }
  38987. var crypto_secretbox_KEYBYTES = 32,
  38988. crypto_secretbox_NONCEBYTES = 24,
  38989. crypto_secretbox_ZEROBYTES = 32,
  38990. crypto_secretbox_BOXZEROBYTES = 16,
  38991. crypto_scalarmult_BYTES = 32,
  38992. crypto_scalarmult_SCALARBYTES = 32,
  38993. crypto_box_PUBLICKEYBYTES = 32,
  38994. crypto_box_SECRETKEYBYTES = 32,
  38995. crypto_box_BEFORENMBYTES = 32,
  38996. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38997. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38998. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38999. crypto_sign_BYTES = 64,
  39000. crypto_sign_PUBLICKEYBYTES = 32,
  39001. crypto_sign_SECRETKEYBYTES = 64,
  39002. crypto_sign_SEEDBYTES = 32,
  39003. crypto_hash_BYTES = 64;
  39004. nacl.lowlevel = {
  39005. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39006. crypto_stream_xor: crypto_stream_xor,
  39007. crypto_stream: crypto_stream,
  39008. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39009. crypto_stream_salsa20: crypto_stream_salsa20,
  39010. crypto_onetimeauth: crypto_onetimeauth,
  39011. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39012. crypto_verify_16: crypto_verify_16,
  39013. crypto_verify_32: crypto_verify_32,
  39014. crypto_secretbox: crypto_secretbox,
  39015. crypto_secretbox_open: crypto_secretbox_open,
  39016. crypto_scalarmult: crypto_scalarmult,
  39017. crypto_scalarmult_base: crypto_scalarmult_base,
  39018. crypto_box_beforenm: crypto_box_beforenm,
  39019. crypto_box_afternm: crypto_box_afternm,
  39020. crypto_box: crypto_box,
  39021. crypto_box_open: crypto_box_open,
  39022. crypto_box_keypair: crypto_box_keypair,
  39023. crypto_hash: crypto_hash,
  39024. crypto_sign: crypto_sign,
  39025. crypto_sign_keypair: crypto_sign_keypair,
  39026. crypto_sign_open: crypto_sign_open,
  39027. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39028. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39029. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39030. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39031. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39032. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39033. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39034. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39035. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39036. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39037. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39038. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39039. crypto_sign_BYTES: crypto_sign_BYTES,
  39040. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39041. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39042. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39043. crypto_hash_BYTES: crypto_hash_BYTES
  39044. };
  39045. /* High-level API */
  39046. function checkLengths(k, n) {
  39047. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39048. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39049. }
  39050. function checkBoxLengths(pk, sk) {
  39051. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39052. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39053. }
  39054. function checkArrayTypes() {
  39055. for (var i = 0; i < arguments.length; i++) {
  39056. if (!(arguments[i] instanceof Uint8Array))
  39057. throw new TypeError('unexpected type, use Uint8Array');
  39058. }
  39059. }
  39060. function cleanup(arr) {
  39061. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39062. }
  39063. nacl.randomBytes = function(n) {
  39064. var b = new Uint8Array(n);
  39065. randombytes(b, n);
  39066. return b;
  39067. };
  39068. nacl.secretbox = function(msg, nonce, key) {
  39069. checkArrayTypes(msg, nonce, key);
  39070. checkLengths(key, nonce);
  39071. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39072. var c = new Uint8Array(m.length);
  39073. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39074. crypto_secretbox(c, m, m.length, nonce, key);
  39075. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39076. };
  39077. nacl.secretbox.open = function(box, nonce, key) {
  39078. checkArrayTypes(box, nonce, key);
  39079. checkLengths(key, nonce);
  39080. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39081. var m = new Uint8Array(c.length);
  39082. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39083. if (c.length < 32) return null;
  39084. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39085. return m.subarray(crypto_secretbox_ZEROBYTES);
  39086. };
  39087. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39088. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39089. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39090. nacl.scalarMult = function(n, p) {
  39091. checkArrayTypes(n, p);
  39092. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39093. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39094. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39095. crypto_scalarmult(q, n, p);
  39096. return q;
  39097. };
  39098. nacl.scalarMult.base = function(n) {
  39099. checkArrayTypes(n);
  39100. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39101. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39102. crypto_scalarmult_base(q, n);
  39103. return q;
  39104. };
  39105. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39106. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39107. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39108. var k = nacl.box.before(publicKey, secretKey);
  39109. return nacl.secretbox(msg, nonce, k);
  39110. };
  39111. nacl.box.before = function(publicKey, secretKey) {
  39112. checkArrayTypes(publicKey, secretKey);
  39113. checkBoxLengths(publicKey, secretKey);
  39114. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39115. crypto_box_beforenm(k, publicKey, secretKey);
  39116. return k;
  39117. };
  39118. nacl.box.after = nacl.secretbox;
  39119. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39120. var k = nacl.box.before(publicKey, secretKey);
  39121. return nacl.secretbox.open(msg, nonce, k);
  39122. };
  39123. nacl.box.open.after = nacl.secretbox.open;
  39124. nacl.box.keyPair = function() {
  39125. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39126. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39127. crypto_box_keypair(pk, sk);
  39128. return {publicKey: pk, secretKey: sk};
  39129. };
  39130. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39131. checkArrayTypes(secretKey);
  39132. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39133. throw new Error('bad secret key size');
  39134. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39135. crypto_scalarmult_base(pk, secretKey);
  39136. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39137. };
  39138. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39139. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39140. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39141. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39142. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39143. nacl.sign = function(msg, secretKey) {
  39144. checkArrayTypes(msg, secretKey);
  39145. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39146. throw new Error('bad secret key size');
  39147. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39148. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39149. return signedMsg;
  39150. };
  39151. nacl.sign.open = function(signedMsg, publicKey) {
  39152. checkArrayTypes(signedMsg, publicKey);
  39153. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39154. throw new Error('bad public key size');
  39155. var tmp = new Uint8Array(signedMsg.length);
  39156. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39157. if (mlen < 0) return null;
  39158. var m = new Uint8Array(mlen);
  39159. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39160. return m;
  39161. };
  39162. nacl.sign.detached = function(msg, secretKey) {
  39163. var signedMsg = nacl.sign(msg, secretKey);
  39164. var sig = new Uint8Array(crypto_sign_BYTES);
  39165. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39166. return sig;
  39167. };
  39168. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39169. checkArrayTypes(msg, sig, publicKey);
  39170. if (sig.length !== crypto_sign_BYTES)
  39171. throw new Error('bad signature size');
  39172. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39173. throw new Error('bad public key size');
  39174. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39175. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39176. var i;
  39177. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39178. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39179. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39180. };
  39181. nacl.sign.keyPair = function() {
  39182. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39183. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39184. crypto_sign_keypair(pk, sk);
  39185. return {publicKey: pk, secretKey: sk};
  39186. };
  39187. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39188. checkArrayTypes(secretKey);
  39189. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39190. throw new Error('bad secret key size');
  39191. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39192. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39193. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39194. };
  39195. nacl.sign.keyPair.fromSeed = function(seed) {
  39196. checkArrayTypes(seed);
  39197. if (seed.length !== crypto_sign_SEEDBYTES)
  39198. throw new Error('bad seed size');
  39199. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39200. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39201. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39202. crypto_sign_keypair(pk, sk, true);
  39203. return {publicKey: pk, secretKey: sk};
  39204. };
  39205. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39206. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39207. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39208. nacl.sign.signatureLength = crypto_sign_BYTES;
  39209. nacl.hash = function(msg) {
  39210. checkArrayTypes(msg);
  39211. var h = new Uint8Array(crypto_hash_BYTES);
  39212. crypto_hash(h, msg, msg.length);
  39213. return h;
  39214. };
  39215. nacl.hash.hashLength = crypto_hash_BYTES;
  39216. nacl.verify = function(x, y) {
  39217. checkArrayTypes(x, y);
  39218. // Zero length arguments are considered not equal.
  39219. if (x.length === 0 || y.length === 0) return false;
  39220. if (x.length !== y.length) return false;
  39221. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39222. };
  39223. nacl.setPRNG = function(fn) {
  39224. randombytes = fn;
  39225. };
  39226. (function() {
  39227. // Initialize PRNG if environment provides CSPRNG.
  39228. // If not, methods calling randombytes will throw.
  39229. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39230. if (crypto && crypto.getRandomValues) {
  39231. // Browsers.
  39232. var QUOTA = 65536;
  39233. nacl.setPRNG(function(x, n) {
  39234. var i, v = new Uint8Array(n);
  39235. for (i = 0; i < n; i += QUOTA) {
  39236. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39237. }
  39238. for (i = 0; i < n; i++) x[i] = v[i];
  39239. cleanup(v);
  39240. });
  39241. } else if (true) {
  39242. // Node.js.
  39243. crypto = __webpack_require__(3);
  39244. if (crypto && crypto.randomBytes) {
  39245. nacl.setPRNG(function(x, n) {
  39246. var i, v = crypto.randomBytes(n);
  39247. for (i = 0; i < n; i++) x[i] = v[i];
  39248. cleanup(v);
  39249. });
  39250. }
  39251. }
  39252. })();
  39253. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39254. /***/ }),
  39255. /* 1 */
  39256. /***/ (function(module, exports, __webpack_require__) {
  39257. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39258. // Public domain.
  39259. (function(root, f) {
  39260. 'use strict';
  39261. if ( true && module.exports) module.exports = f();
  39262. else if (root.nacl) root.nacl.util = f();
  39263. else {
  39264. root.nacl = {};
  39265. root.nacl.util = f();
  39266. }
  39267. }(this, function() {
  39268. 'use strict';
  39269. var util = {};
  39270. function validateBase64(s) {
  39271. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39272. throw new TypeError('invalid encoding');
  39273. }
  39274. }
  39275. util.decodeUTF8 = function(s) {
  39276. if (typeof s !== 'string') throw new TypeError('expected string');
  39277. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39278. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39279. return b;
  39280. };
  39281. util.encodeUTF8 = function(arr) {
  39282. var i, s = [];
  39283. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39284. return decodeURIComponent(escape(s.join('')));
  39285. };
  39286. if (typeof atob === 'undefined') {
  39287. // Node.js
  39288. if (typeof Buffer.from !== 'undefined') {
  39289. // Node v6 and later
  39290. util.encodeBase64 = function (arr) { // v6 and later
  39291. return Buffer.from(arr).toString('base64');
  39292. };
  39293. util.decodeBase64 = function (s) {
  39294. validateBase64(s);
  39295. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39296. };
  39297. } else {
  39298. // Node earlier than v6
  39299. util.encodeBase64 = function (arr) { // v6 and later
  39300. return (new Buffer(arr)).toString('base64');
  39301. };
  39302. util.decodeBase64 = function(s) {
  39303. validateBase64(s);
  39304. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39305. };
  39306. }
  39307. } else {
  39308. // Browsers
  39309. util.encodeBase64 = function(arr) {
  39310. var i, s = [], len = arr.length;
  39311. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39312. return btoa(s.join(''));
  39313. };
  39314. util.decodeBase64 = function(s) {
  39315. validateBase64(s);
  39316. var i, d = atob(s), b = new Uint8Array(d.length);
  39317. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39318. return b;
  39319. };
  39320. }
  39321. return util;
  39322. }));
  39323. /***/ }),
  39324. /* 2 */
  39325. /***/ (function(module, exports, __webpack_require__) {
  39326. // required so we don't have to do require('pusher').default etc.
  39327. module.exports = __webpack_require__(4).default;
  39328. /***/ }),
  39329. /* 3 */
  39330. /***/ (function(module, exports) {
  39331. /* (ignored) */
  39332. /***/ }),
  39333. /* 4 */
  39334. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39335. "use strict";
  39336. __webpack_require__.r(__webpack_exports__);
  39337. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39338. var ScriptReceiverFactory = (function () {
  39339. function ScriptReceiverFactory(prefix, name) {
  39340. this.lastId = 0;
  39341. this.prefix = prefix;
  39342. this.name = name;
  39343. }
  39344. ScriptReceiverFactory.prototype.create = function (callback) {
  39345. this.lastId++;
  39346. var number = this.lastId;
  39347. var id = this.prefix + number;
  39348. var name = this.name + "[" + number + "]";
  39349. var called = false;
  39350. var callbackWrapper = function () {
  39351. if (!called) {
  39352. callback.apply(null, arguments);
  39353. called = true;
  39354. }
  39355. };
  39356. this[number] = callbackWrapper;
  39357. return { number: number, id: id, name: name, callback: callbackWrapper };
  39358. };
  39359. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39360. delete this[receiver.number];
  39361. };
  39362. return ScriptReceiverFactory;
  39363. }());
  39364. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39365. // CONCATENATED MODULE: ./src/core/defaults.ts
  39366. var Defaults = {
  39367. VERSION: "5.0.3",
  39368. PROTOCOL: 7,
  39369. host: 'ws.pusherapp.com',
  39370. ws_port: 80,
  39371. wss_port: 443,
  39372. ws_path: '',
  39373. sockjs_host: 'sockjs.pusher.com',
  39374. sockjs_http_port: 80,
  39375. sockjs_https_port: 443,
  39376. sockjs_path: '/pusher',
  39377. stats_host: 'stats.pusher.com',
  39378. channel_auth_endpoint: '/pusher/auth',
  39379. channel_auth_transport: 'ajax',
  39380. activity_timeout: 120000,
  39381. pong_timeout: 30000,
  39382. unavailable_timeout: 10000,
  39383. cdn_http: "http://js.pusher.com",
  39384. cdn_https: "https://js.pusher.com",
  39385. dependency_suffix: ""
  39386. };
  39387. /* harmony default export */ var defaults = (Defaults);
  39388. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39389. var dependency_loader_DependencyLoader = (function () {
  39390. function DependencyLoader(options) {
  39391. this.options = options;
  39392. this.receivers = options.receivers || ScriptReceivers;
  39393. this.loading = {};
  39394. }
  39395. DependencyLoader.prototype.load = function (name, options, callback) {
  39396. var self = this;
  39397. if (self.loading[name] && self.loading[name].length > 0) {
  39398. self.loading[name].push(callback);
  39399. }
  39400. else {
  39401. self.loading[name] = [callback];
  39402. var request = runtime.createScriptRequest(self.getPath(name, options));
  39403. var receiver = self.receivers.create(function (error) {
  39404. self.receivers.remove(receiver);
  39405. if (self.loading[name]) {
  39406. var callbacks = self.loading[name];
  39407. delete self.loading[name];
  39408. var successCallback = function (wasSuccessful) {
  39409. if (!wasSuccessful) {
  39410. request.cleanup();
  39411. }
  39412. };
  39413. for (var i = 0; i < callbacks.length; i++) {
  39414. callbacks[i](error, successCallback);
  39415. }
  39416. }
  39417. });
  39418. request.send(receiver);
  39419. }
  39420. };
  39421. DependencyLoader.prototype.getRoot = function (options) {
  39422. var cdn;
  39423. var protocol = runtime.getDocument().location.protocol;
  39424. if ((options && options.useTLS) || protocol === "https:") {
  39425. cdn = this.options.cdn_https;
  39426. }
  39427. else {
  39428. cdn = this.options.cdn_http;
  39429. }
  39430. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39431. };
  39432. DependencyLoader.prototype.getPath = function (name, options) {
  39433. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39434. };
  39435. ;
  39436. return DependencyLoader;
  39437. }());
  39438. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39439. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39440. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39441. var Dependencies = new dependency_loader({
  39442. cdn_http: defaults.cdn_http,
  39443. cdn_https: defaults.cdn_https,
  39444. version: defaults.VERSION,
  39445. suffix: defaults.dependency_suffix,
  39446. receivers: DependenciesReceivers
  39447. });
  39448. // CONCATENATED MODULE: ./src/core/base64.ts
  39449. function encode(s) {
  39450. return btoa(utob(s));
  39451. }
  39452. var fromCharCode = String.fromCharCode;
  39453. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39454. var b64tab = {};
  39455. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39456. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39457. }
  39458. var cb_utob = function (c) {
  39459. var cc = c.charCodeAt(0);
  39460. return cc < 0x80
  39461. ? c
  39462. : cc < 0x800
  39463. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39464. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39465. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39466. fromCharCode(0x80 | (cc & 0x3f));
  39467. };
  39468. var utob = function (u) {
  39469. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39470. };
  39471. var cb_encode = function (ccc) {
  39472. var padlen = [0, 2, 1][ccc.length % 3];
  39473. var ord = (ccc.charCodeAt(0) << 16) |
  39474. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39475. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39476. var chars = [
  39477. b64chars.charAt(ord >>> 18),
  39478. b64chars.charAt((ord >>> 12) & 63),
  39479. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39480. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39481. ];
  39482. return chars.join('');
  39483. };
  39484. var btoa = window.btoa ||
  39485. function (b) {
  39486. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39487. };
  39488. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39489. var Timer = (function () {
  39490. function Timer(set, clear, delay, callback) {
  39491. var _this = this;
  39492. this.clear = clear;
  39493. this.timer = set(function () {
  39494. if (_this.timer) {
  39495. _this.timer = callback(_this.timer);
  39496. }
  39497. }, delay);
  39498. }
  39499. Timer.prototype.isRunning = function () {
  39500. return this.timer !== null;
  39501. };
  39502. Timer.prototype.ensureAborted = function () {
  39503. if (this.timer) {
  39504. this.clear(this.timer);
  39505. this.timer = null;
  39506. }
  39507. };
  39508. return Timer;
  39509. }());
  39510. /* harmony default export */ var abstract_timer = (Timer);
  39511. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39512. var __extends = (undefined && undefined.__extends) || (function () {
  39513. var extendStatics = function (d, b) {
  39514. extendStatics = Object.setPrototypeOf ||
  39515. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39516. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39517. return extendStatics(d, b);
  39518. };
  39519. return function (d, b) {
  39520. extendStatics(d, b);
  39521. function __() { this.constructor = d; }
  39522. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39523. };
  39524. })();
  39525. function timers_clearTimeout(timer) {
  39526. window.clearTimeout(timer);
  39527. }
  39528. function timers_clearInterval(timer) {
  39529. window.clearInterval(timer);
  39530. }
  39531. var OneOffTimer = (function (_super) {
  39532. __extends(OneOffTimer, _super);
  39533. function OneOffTimer(delay, callback) {
  39534. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39535. callback();
  39536. return null;
  39537. }) || this;
  39538. }
  39539. return OneOffTimer;
  39540. }(abstract_timer));
  39541. var PeriodicTimer = (function (_super) {
  39542. __extends(PeriodicTimer, _super);
  39543. function PeriodicTimer(delay, callback) {
  39544. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39545. callback();
  39546. return timer;
  39547. }) || this;
  39548. }
  39549. return PeriodicTimer;
  39550. }(abstract_timer));
  39551. // CONCATENATED MODULE: ./src/core/util.ts
  39552. var Util = {
  39553. now: function () {
  39554. if (Date.now) {
  39555. return Date.now();
  39556. }
  39557. else {
  39558. return new Date().valueOf();
  39559. }
  39560. },
  39561. defer: function (callback) {
  39562. return new OneOffTimer(0, callback);
  39563. },
  39564. method: function (name) {
  39565. var args = [];
  39566. for (var _i = 1; _i < arguments.length; _i++) {
  39567. args[_i - 1] = arguments[_i];
  39568. }
  39569. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39570. return function (object) {
  39571. return object[name].apply(object, boundArguments.concat(arguments));
  39572. };
  39573. }
  39574. };
  39575. /* harmony default export */ var util = (Util);
  39576. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39577. function extend(target) {
  39578. var sources = [];
  39579. for (var _i = 1; _i < arguments.length; _i++) {
  39580. sources[_i - 1] = arguments[_i];
  39581. }
  39582. for (var i = 0; i < sources.length; i++) {
  39583. var extensions = sources[i];
  39584. for (var property in extensions) {
  39585. if (extensions[property] && extensions[property].constructor &&
  39586. extensions[property].constructor === Object) {
  39587. target[property] = extend(target[property] || {}, extensions[property]);
  39588. }
  39589. else {
  39590. target[property] = extensions[property];
  39591. }
  39592. }
  39593. }
  39594. return target;
  39595. }
  39596. function stringify() {
  39597. var m = ["Pusher"];
  39598. for (var i = 0; i < arguments.length; i++) {
  39599. if (typeof arguments[i] === "string") {
  39600. m.push(arguments[i]);
  39601. }
  39602. else {
  39603. m.push(safeJSONStringify(arguments[i]));
  39604. }
  39605. }
  39606. return m.join(" : ");
  39607. }
  39608. function arrayIndexOf(array, item) {
  39609. var nativeIndexOf = Array.prototype.indexOf;
  39610. if (array === null) {
  39611. return -1;
  39612. }
  39613. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39614. return array.indexOf(item);
  39615. }
  39616. for (var i = 0, l = array.length; i < l; i++) {
  39617. if (array[i] === item) {
  39618. return i;
  39619. }
  39620. }
  39621. return -1;
  39622. }
  39623. function objectApply(object, f) {
  39624. for (var key in object) {
  39625. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39626. f(object[key], key, object);
  39627. }
  39628. }
  39629. }
  39630. function keys(object) {
  39631. var keys = [];
  39632. objectApply(object, function (_, key) {
  39633. keys.push(key);
  39634. });
  39635. return keys;
  39636. }
  39637. function values(object) {
  39638. var values = [];
  39639. objectApply(object, function (value) {
  39640. values.push(value);
  39641. });
  39642. return values;
  39643. }
  39644. function apply(array, f, context) {
  39645. for (var i = 0; i < array.length; i++) {
  39646. f.call(context || window, array[i], i, array);
  39647. }
  39648. }
  39649. function map(array, f) {
  39650. var result = [];
  39651. for (var i = 0; i < array.length; i++) {
  39652. result.push(f(array[i], i, array, result));
  39653. }
  39654. return result;
  39655. }
  39656. function mapObject(object, f) {
  39657. var result = {};
  39658. objectApply(object, function (value, key) {
  39659. result[key] = f(value);
  39660. });
  39661. return result;
  39662. }
  39663. function filter(array, test) {
  39664. test = test || function (value) { return !!value; };
  39665. var result = [];
  39666. for (var i = 0; i < array.length; i++) {
  39667. if (test(array[i], i, array, result)) {
  39668. result.push(array[i]);
  39669. }
  39670. }
  39671. return result;
  39672. }
  39673. function filterObject(object, test) {
  39674. var result = {};
  39675. objectApply(object, function (value, key) {
  39676. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39677. result[key] = value;
  39678. }
  39679. });
  39680. return result;
  39681. }
  39682. function flatten(object) {
  39683. var result = [];
  39684. objectApply(object, function (value, key) {
  39685. result.push([key, value]);
  39686. });
  39687. return result;
  39688. }
  39689. function any(array, test) {
  39690. for (var i = 0; i < array.length; i++) {
  39691. if (test(array[i], i, array)) {
  39692. return true;
  39693. }
  39694. }
  39695. return false;
  39696. }
  39697. function collections_all(array, test) {
  39698. for (var i = 0; i < array.length; i++) {
  39699. if (!test(array[i], i, array)) {
  39700. return false;
  39701. }
  39702. }
  39703. return true;
  39704. }
  39705. function encodeParamsObject(data) {
  39706. return mapObject(data, function (value) {
  39707. if (typeof value === "object") {
  39708. value = safeJSONStringify(value);
  39709. }
  39710. return encodeURIComponent(encode(value.toString()));
  39711. });
  39712. }
  39713. function buildQueryString(data) {
  39714. var params = filterObject(data, function (value) {
  39715. return value !== undefined;
  39716. });
  39717. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39718. return query;
  39719. }
  39720. function decycleObject(object) {
  39721. var objects = [], paths = [];
  39722. return (function derez(value, path) {
  39723. var i, name, nu;
  39724. switch (typeof value) {
  39725. case 'object':
  39726. if (!value) {
  39727. return null;
  39728. }
  39729. for (i = 0; i < objects.length; i += 1) {
  39730. if (objects[i] === value) {
  39731. return { $ref: paths[i] };
  39732. }
  39733. }
  39734. objects.push(value);
  39735. paths.push(path);
  39736. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39737. nu = [];
  39738. for (i = 0; i < value.length; i += 1) {
  39739. nu[i] = derez(value[i], path + '[' + i + ']');
  39740. }
  39741. }
  39742. else {
  39743. nu = {};
  39744. for (name in value) {
  39745. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39746. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39747. }
  39748. }
  39749. }
  39750. return nu;
  39751. case 'number':
  39752. case 'string':
  39753. case 'boolean':
  39754. return value;
  39755. }
  39756. }(object, '$'));
  39757. }
  39758. function safeJSONStringify(source) {
  39759. try {
  39760. return JSON.stringify(source);
  39761. }
  39762. catch (e) {
  39763. return JSON.stringify(decycleObject(source));
  39764. }
  39765. }
  39766. // CONCATENATED MODULE: ./src/core/logger.ts
  39767. var logger_Logger = (function () {
  39768. function Logger() {
  39769. this.globalLog = function (message) {
  39770. if (window.console && window.console.log) {
  39771. window.console.log(message);
  39772. }
  39773. };
  39774. }
  39775. Logger.prototype.debug = function () {
  39776. var args = [];
  39777. for (var _i = 0; _i < arguments.length; _i++) {
  39778. args[_i] = arguments[_i];
  39779. }
  39780. this.log(this.globalLog, args);
  39781. };
  39782. Logger.prototype.warn = function () {
  39783. var args = [];
  39784. for (var _i = 0; _i < arguments.length; _i++) {
  39785. args[_i] = arguments[_i];
  39786. }
  39787. this.log(this.globalLogWarn, args);
  39788. };
  39789. Logger.prototype.error = function () {
  39790. var args = [];
  39791. for (var _i = 0; _i < arguments.length; _i++) {
  39792. args[_i] = arguments[_i];
  39793. }
  39794. this.log(this.globalLogError, args);
  39795. };
  39796. Logger.prototype.globalLogWarn = function (message) {
  39797. if (window.console && window.console.warn) {
  39798. window.console.warn(message);
  39799. }
  39800. else {
  39801. this.globalLog(message);
  39802. }
  39803. };
  39804. Logger.prototype.globalLogError = function (message) {
  39805. if (window.console && window.console.error) {
  39806. window.console.error(message);
  39807. }
  39808. else {
  39809. this.globalLogWarn(message);
  39810. }
  39811. };
  39812. Logger.prototype.log = function (defaultLoggingFunction) {
  39813. var args = [];
  39814. for (var _i = 1; _i < arguments.length; _i++) {
  39815. args[_i - 1] = arguments[_i];
  39816. }
  39817. var message = stringify.apply(this, arguments);
  39818. if (core_pusher.log) {
  39819. core_pusher.log(message);
  39820. }
  39821. else if (core_pusher.logToConsole) {
  39822. var log = defaultLoggingFunction.bind(this);
  39823. log(message);
  39824. }
  39825. };
  39826. return Logger;
  39827. }());
  39828. /* harmony default export */ var logger = (new logger_Logger());
  39829. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39830. var urlStore = {
  39831. baseUrl: "https://pusher.com",
  39832. urls: {
  39833. authenticationEndpoint: {
  39834. path: "/docs/authenticating_users",
  39835. },
  39836. javascriptQuickStart: {
  39837. path: "/docs/javascript_quick_start"
  39838. },
  39839. triggeringClientEvents: {
  39840. path: "/docs/client_api_guide/client_events#trigger-events"
  39841. }
  39842. }
  39843. };
  39844. var buildLogSuffix = function (key) {
  39845. var urlPrefix = "See:";
  39846. var urlObj = urlStore.urls[key];
  39847. if (!urlObj)
  39848. return "";
  39849. var url;
  39850. if (urlObj.fullUrl) {
  39851. url = urlObj.fullUrl;
  39852. }
  39853. else if (urlObj.path) {
  39854. url = urlStore.baseUrl + urlObj.path;
  39855. }
  39856. if (!url)
  39857. return "";
  39858. return urlPrefix + " " + url;
  39859. };
  39860. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39861. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39862. var ajax = function (context, socketId, callback) {
  39863. var self = this, xhr;
  39864. xhr = runtime.createXHR();
  39865. xhr.open("POST", self.options.authEndpoint, true);
  39866. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39867. for (var headerName in this.authOptions.headers) {
  39868. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39869. }
  39870. xhr.onreadystatechange = function () {
  39871. if (xhr.readyState === 4) {
  39872. if (xhr.status === 200) {
  39873. var data, parsed = false;
  39874. try {
  39875. data = JSON.parse(xhr.responseText);
  39876. parsed = true;
  39877. }
  39878. catch (e) {
  39879. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39880. }
  39881. if (parsed) {
  39882. callback(false, data);
  39883. }
  39884. }
  39885. else {
  39886. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39887. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39888. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39889. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39890. callback(true, xhr.status);
  39891. }
  39892. }
  39893. };
  39894. xhr.send(this.composeQuery(socketId));
  39895. return xhr;
  39896. };
  39897. /* harmony default export */ var xhr_auth = (ajax);
  39898. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39899. var jsonp = function (context, socketId, callback) {
  39900. if (this.authOptions.headers !== undefined) {
  39901. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39902. }
  39903. var callbackName = context.nextAuthCallbackID.toString();
  39904. context.nextAuthCallbackID++;
  39905. var document = context.getDocument();
  39906. var script = document.createElement("script");
  39907. context.auth_callbacks[callbackName] = function (data) {
  39908. callback(false, data);
  39909. };
  39910. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39911. script.src = this.options.authEndpoint +
  39912. '?callback=' +
  39913. encodeURIComponent(callback_name) +
  39914. '&' +
  39915. this.composeQuery(socketId);
  39916. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39917. head.insertBefore(script, head.firstChild);
  39918. };
  39919. /* harmony default export */ var jsonp_auth = (jsonp);
  39920. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39921. var ScriptRequest = (function () {
  39922. function ScriptRequest(src) {
  39923. this.src = src;
  39924. }
  39925. ScriptRequest.prototype.send = function (receiver) {
  39926. var self = this;
  39927. var errorString = "Error loading " + self.src;
  39928. self.script = document.createElement("script");
  39929. self.script.id = receiver.id;
  39930. self.script.src = self.src;
  39931. self.script.type = "text/javascript";
  39932. self.script.charset = "UTF-8";
  39933. if (self.script.addEventListener) {
  39934. self.script.onerror = function () {
  39935. receiver.callback(errorString);
  39936. };
  39937. self.script.onload = function () {
  39938. receiver.callback(null);
  39939. };
  39940. }
  39941. else {
  39942. self.script.onreadystatechange = function () {
  39943. if (self.script.readyState === 'loaded' ||
  39944. self.script.readyState === 'complete') {
  39945. receiver.callback(null);
  39946. }
  39947. };
  39948. }
  39949. if (self.script.async === undefined && document.attachEvent &&
  39950. /opera/i.test(navigator.userAgent)) {
  39951. self.errorScript = document.createElement("script");
  39952. self.errorScript.id = receiver.id + "_error";
  39953. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39954. self.script.async = self.errorScript.async = false;
  39955. }
  39956. else {
  39957. self.script.async = true;
  39958. }
  39959. var head = document.getElementsByTagName('head')[0];
  39960. head.insertBefore(self.script, head.firstChild);
  39961. if (self.errorScript) {
  39962. head.insertBefore(self.errorScript, self.script.nextSibling);
  39963. }
  39964. };
  39965. ScriptRequest.prototype.cleanup = function () {
  39966. if (this.script) {
  39967. this.script.onload = this.script.onerror = null;
  39968. this.script.onreadystatechange = null;
  39969. }
  39970. if (this.script && this.script.parentNode) {
  39971. this.script.parentNode.removeChild(this.script);
  39972. }
  39973. if (this.errorScript && this.errorScript.parentNode) {
  39974. this.errorScript.parentNode.removeChild(this.errorScript);
  39975. }
  39976. this.script = null;
  39977. this.errorScript = null;
  39978. };
  39979. return ScriptRequest;
  39980. }());
  39981. /* harmony default export */ var script_request = (ScriptRequest);
  39982. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39983. var jsonp_request_JSONPRequest = (function () {
  39984. function JSONPRequest(url, data) {
  39985. this.url = url;
  39986. this.data = data;
  39987. }
  39988. JSONPRequest.prototype.send = function (receiver) {
  39989. if (this.request) {
  39990. return;
  39991. }
  39992. var query = buildQueryString(this.data);
  39993. var url = this.url + "/" + receiver.number + "?" + query;
  39994. this.request = runtime.createScriptRequest(url);
  39995. this.request.send(receiver);
  39996. };
  39997. JSONPRequest.prototype.cleanup = function () {
  39998. if (this.request) {
  39999. this.request.cleanup();
  40000. }
  40001. };
  40002. return JSONPRequest;
  40003. }());
  40004. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40005. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40006. var getAgent = function (sender, useTLS) {
  40007. return function (data, callback) {
  40008. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40009. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40010. var request = runtime.createJSONPRequest(url, data);
  40011. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40012. ScriptReceivers.remove(receiver);
  40013. request.cleanup();
  40014. if (result && result.host) {
  40015. sender.host = result.host;
  40016. }
  40017. if (callback) {
  40018. callback(error, result);
  40019. }
  40020. });
  40021. request.send(receiver);
  40022. };
  40023. };
  40024. var jsonp_timeline_jsonp = {
  40025. name: 'jsonp',
  40026. getAgent: getAgent
  40027. };
  40028. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40029. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40030. function getGenericURL(baseScheme, params, path) {
  40031. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40032. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40033. return scheme + "://" + host + path;
  40034. }
  40035. function getGenericPath(key, queryString) {
  40036. var path = "/app/" + key;
  40037. var query = "?protocol=" + defaults.PROTOCOL +
  40038. "&client=js" +
  40039. "&version=" + defaults.VERSION +
  40040. (queryString ? ("&" + queryString) : "");
  40041. return path + query;
  40042. }
  40043. var ws = {
  40044. getInitial: function (key, params) {
  40045. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40046. return getGenericURL("ws", params, path);
  40047. }
  40048. };
  40049. var http = {
  40050. getInitial: function (key, params) {
  40051. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40052. return getGenericURL("http", params, path);
  40053. }
  40054. };
  40055. var sockjs = {
  40056. getInitial: function (key, params) {
  40057. return getGenericURL("http", params, params.httpPath || "/pusher");
  40058. },
  40059. getPath: function (key, params) {
  40060. return getGenericPath(key);
  40061. }
  40062. };
  40063. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40064. var callback_registry_CallbackRegistry = (function () {
  40065. function CallbackRegistry() {
  40066. this._callbacks = {};
  40067. }
  40068. CallbackRegistry.prototype.get = function (name) {
  40069. return this._callbacks[prefix(name)];
  40070. };
  40071. CallbackRegistry.prototype.add = function (name, callback, context) {
  40072. var prefixedEventName = prefix(name);
  40073. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40074. this._callbacks[prefixedEventName].push({
  40075. fn: callback,
  40076. context: context
  40077. });
  40078. };
  40079. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40080. if (!name && !callback && !context) {
  40081. this._callbacks = {};
  40082. return;
  40083. }
  40084. var names = name ? [prefix(name)] : keys(this._callbacks);
  40085. if (callback || context) {
  40086. this.removeCallback(names, callback, context);
  40087. }
  40088. else {
  40089. this.removeAllCallbacks(names);
  40090. }
  40091. };
  40092. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40093. apply(names, function (name) {
  40094. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40095. return (callback && callback !== binding.fn) ||
  40096. (context && context !== binding.context);
  40097. });
  40098. if (this._callbacks[name].length === 0) {
  40099. delete this._callbacks[name];
  40100. }
  40101. }, this);
  40102. };
  40103. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40104. apply(names, function (name) {
  40105. delete this._callbacks[name];
  40106. }, this);
  40107. };
  40108. return CallbackRegistry;
  40109. }());
  40110. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40111. function prefix(name) {
  40112. return "_" + name;
  40113. }
  40114. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40115. var dispatcher_Dispatcher = (function () {
  40116. function Dispatcher(failThrough) {
  40117. this.callbacks = new callback_registry();
  40118. this.global_callbacks = [];
  40119. this.failThrough = failThrough;
  40120. }
  40121. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40122. this.callbacks.add(eventName, callback, context);
  40123. return this;
  40124. };
  40125. Dispatcher.prototype.bind_global = function (callback) {
  40126. this.global_callbacks.push(callback);
  40127. return this;
  40128. };
  40129. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40130. this.callbacks.remove(eventName, callback, context);
  40131. return this;
  40132. };
  40133. Dispatcher.prototype.unbind_global = function (callback) {
  40134. if (!callback) {
  40135. this.global_callbacks = [];
  40136. return this;
  40137. }
  40138. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40139. return this;
  40140. };
  40141. Dispatcher.prototype.unbind_all = function () {
  40142. this.unbind();
  40143. this.unbind_global();
  40144. return this;
  40145. };
  40146. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40147. for (var i = 0; i < this.global_callbacks.length; i++) {
  40148. this.global_callbacks[i](eventName, data);
  40149. }
  40150. var callbacks = this.callbacks.get(eventName);
  40151. var args = [];
  40152. if (metadata) {
  40153. args.push(data, metadata);
  40154. }
  40155. else if (data) {
  40156. args.push(data);
  40157. }
  40158. if (callbacks && callbacks.length > 0) {
  40159. for (var i = 0; i < callbacks.length; i++) {
  40160. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40161. }
  40162. }
  40163. else if (this.failThrough) {
  40164. this.failThrough(eventName, data);
  40165. }
  40166. return this;
  40167. };
  40168. return Dispatcher;
  40169. }());
  40170. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40171. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40172. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40173. var extendStatics = function (d, b) {
  40174. extendStatics = Object.setPrototypeOf ||
  40175. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40176. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40177. return extendStatics(d, b);
  40178. };
  40179. return function (d, b) {
  40180. extendStatics(d, b);
  40181. function __() { this.constructor = d; }
  40182. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40183. };
  40184. })();
  40185. var transport_connection_TransportConnection = (function (_super) {
  40186. transport_connection_extends(TransportConnection, _super);
  40187. function TransportConnection(hooks, name, priority, key, options) {
  40188. var _this = _super.call(this) || this;
  40189. _this.initialize = runtime.transportConnectionInitializer;
  40190. _this.hooks = hooks;
  40191. _this.name = name;
  40192. _this.priority = priority;
  40193. _this.key = key;
  40194. _this.options = options;
  40195. _this.state = "new";
  40196. _this.timeline = options.timeline;
  40197. _this.activityTimeout = options.activityTimeout;
  40198. _this.id = _this.timeline.generateUniqueID();
  40199. return _this;
  40200. }
  40201. TransportConnection.prototype.handlesActivityChecks = function () {
  40202. return Boolean(this.hooks.handlesActivityChecks);
  40203. };
  40204. TransportConnection.prototype.supportsPing = function () {
  40205. return Boolean(this.hooks.supportsPing);
  40206. };
  40207. TransportConnection.prototype.connect = function () {
  40208. var _this = this;
  40209. if (this.socket || this.state !== "initialized") {
  40210. return false;
  40211. }
  40212. var url = this.hooks.urls.getInitial(this.key, this.options);
  40213. try {
  40214. this.socket = this.hooks.getSocket(url, this.options);
  40215. }
  40216. catch (e) {
  40217. util.defer(function () {
  40218. _this.onError(e);
  40219. _this.changeState("closed");
  40220. });
  40221. return false;
  40222. }
  40223. this.bindListeners();
  40224. logger.debug("Connecting", { transport: this.name, url: url });
  40225. this.changeState("connecting");
  40226. return true;
  40227. };
  40228. TransportConnection.prototype.close = function () {
  40229. if (this.socket) {
  40230. this.socket.close();
  40231. return true;
  40232. }
  40233. else {
  40234. return false;
  40235. }
  40236. };
  40237. TransportConnection.prototype.send = function (data) {
  40238. var _this = this;
  40239. if (this.state === "open") {
  40240. util.defer(function () {
  40241. if (_this.socket) {
  40242. _this.socket.send(data);
  40243. }
  40244. });
  40245. return true;
  40246. }
  40247. else {
  40248. return false;
  40249. }
  40250. };
  40251. TransportConnection.prototype.ping = function () {
  40252. if (this.state === "open" && this.supportsPing()) {
  40253. this.socket.ping();
  40254. }
  40255. };
  40256. TransportConnection.prototype.onOpen = function () {
  40257. if (this.hooks.beforeOpen) {
  40258. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40259. }
  40260. this.changeState("open");
  40261. this.socket.onopen = undefined;
  40262. };
  40263. TransportConnection.prototype.onError = function (error) {
  40264. this.emit("error", { type: 'WebSocketError', error: error });
  40265. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40266. };
  40267. TransportConnection.prototype.onClose = function (closeEvent) {
  40268. if (closeEvent) {
  40269. this.changeState("closed", {
  40270. code: closeEvent.code,
  40271. reason: closeEvent.reason,
  40272. wasClean: closeEvent.wasClean
  40273. });
  40274. }
  40275. else {
  40276. this.changeState("closed");
  40277. }
  40278. this.unbindListeners();
  40279. this.socket = undefined;
  40280. };
  40281. TransportConnection.prototype.onMessage = function (message) {
  40282. this.emit("message", message);
  40283. };
  40284. TransportConnection.prototype.onActivity = function () {
  40285. this.emit("activity");
  40286. };
  40287. TransportConnection.prototype.bindListeners = function () {
  40288. var _this = this;
  40289. this.socket.onopen = function () {
  40290. _this.onOpen();
  40291. };
  40292. this.socket.onerror = function (error) {
  40293. _this.onError(error);
  40294. };
  40295. this.socket.onclose = function (closeEvent) {
  40296. _this.onClose(closeEvent);
  40297. };
  40298. this.socket.onmessage = function (message) {
  40299. _this.onMessage(message);
  40300. };
  40301. if (this.supportsPing()) {
  40302. this.socket.onactivity = function () { _this.onActivity(); };
  40303. }
  40304. };
  40305. TransportConnection.prototype.unbindListeners = function () {
  40306. if (this.socket) {
  40307. this.socket.onopen = undefined;
  40308. this.socket.onerror = undefined;
  40309. this.socket.onclose = undefined;
  40310. this.socket.onmessage = undefined;
  40311. if (this.supportsPing()) {
  40312. this.socket.onactivity = undefined;
  40313. }
  40314. }
  40315. };
  40316. TransportConnection.prototype.changeState = function (state, params) {
  40317. this.state = state;
  40318. this.timeline.info(this.buildTimelineMessage({
  40319. state: state,
  40320. params: params
  40321. }));
  40322. this.emit(state, params);
  40323. };
  40324. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40325. return extend({ cid: this.id }, message);
  40326. };
  40327. return TransportConnection;
  40328. }(dispatcher));
  40329. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40330. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40331. var transport_Transport = (function () {
  40332. function Transport(hooks) {
  40333. this.hooks = hooks;
  40334. }
  40335. Transport.prototype.isSupported = function (environment) {
  40336. return this.hooks.isSupported(environment);
  40337. };
  40338. Transport.prototype.createConnection = function (name, priority, key, options) {
  40339. return new transport_connection(this.hooks, name, priority, key, options);
  40340. };
  40341. return Transport;
  40342. }());
  40343. /* harmony default export */ var transports_transport = (transport_Transport);
  40344. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40345. var WSTransport = new transports_transport({
  40346. urls: ws,
  40347. handlesActivityChecks: false,
  40348. supportsPing: false,
  40349. isInitialized: function () {
  40350. return Boolean(runtime.getWebSocketAPI());
  40351. },
  40352. isSupported: function () {
  40353. return Boolean(runtime.getWebSocketAPI());
  40354. },
  40355. getSocket: function (url) {
  40356. return runtime.createWebSocket(url);
  40357. }
  40358. });
  40359. var httpConfiguration = {
  40360. urls: http,
  40361. handlesActivityChecks: false,
  40362. supportsPing: true,
  40363. isInitialized: function () {
  40364. return true;
  40365. }
  40366. };
  40367. var streamingConfiguration = extend({ getSocket: function (url) {
  40368. return runtime.HTTPFactory.createStreamingSocket(url);
  40369. }
  40370. }, httpConfiguration);
  40371. var pollingConfiguration = extend({ getSocket: function (url) {
  40372. return runtime.HTTPFactory.createPollingSocket(url);
  40373. }
  40374. }, httpConfiguration);
  40375. var xhrConfiguration = {
  40376. isSupported: function () {
  40377. return runtime.isXHRSupported();
  40378. }
  40379. };
  40380. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40381. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40382. var Transports = {
  40383. ws: WSTransport,
  40384. xhr_streaming: XHRStreamingTransport,
  40385. xhr_polling: XHRPollingTransport
  40386. };
  40387. /* harmony default export */ var transports = (Transports);
  40388. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40389. var SockJSTransport = new transports_transport({
  40390. file: "sockjs",
  40391. urls: sockjs,
  40392. handlesActivityChecks: true,
  40393. supportsPing: false,
  40394. isSupported: function () {
  40395. return true;
  40396. },
  40397. isInitialized: function () {
  40398. return window.SockJS !== undefined;
  40399. },
  40400. getSocket: function (url, options) {
  40401. return new window.SockJS(url, null, {
  40402. js_path: Dependencies.getPath("sockjs", {
  40403. useTLS: options.useTLS
  40404. }),
  40405. ignore_null_origin: options.ignoreNullOrigin
  40406. });
  40407. },
  40408. beforeOpen: function (socket, path) {
  40409. socket.send(JSON.stringify({
  40410. path: path
  40411. }));
  40412. }
  40413. });
  40414. var xdrConfiguration = {
  40415. isSupported: function (environment) {
  40416. var yes = runtime.isXDRSupported(environment.useTLS);
  40417. return yes;
  40418. }
  40419. };
  40420. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40421. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40422. transports.xdr_streaming = XDRStreamingTransport;
  40423. transports.xdr_polling = XDRPollingTransport;
  40424. transports.sockjs = SockJSTransport;
  40425. /* harmony default export */ var transports_transports = (transports);
  40426. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40427. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40428. var extendStatics = function (d, b) {
  40429. extendStatics = Object.setPrototypeOf ||
  40430. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40431. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40432. return extendStatics(d, b);
  40433. };
  40434. return function (d, b) {
  40435. extendStatics(d, b);
  40436. function __() { this.constructor = d; }
  40437. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40438. };
  40439. })();
  40440. var NetInfo = (function (_super) {
  40441. net_info_extends(NetInfo, _super);
  40442. function NetInfo() {
  40443. var _this = _super.call(this) || this;
  40444. var self = _this;
  40445. if (window.addEventListener !== undefined) {
  40446. window.addEventListener("online", function () {
  40447. self.emit('online');
  40448. }, false);
  40449. window.addEventListener("offline", function () {
  40450. self.emit('offline');
  40451. }, false);
  40452. }
  40453. return _this;
  40454. }
  40455. NetInfo.prototype.isOnline = function () {
  40456. if (window.navigator.onLine === undefined) {
  40457. return true;
  40458. }
  40459. else {
  40460. return window.navigator.onLine;
  40461. }
  40462. };
  40463. return NetInfo;
  40464. }(dispatcher));
  40465. var net_info_Network = new NetInfo();
  40466. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40467. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40468. function AssistantToTheTransportManager(manager, transport, options) {
  40469. this.manager = manager;
  40470. this.transport = transport;
  40471. this.minPingDelay = options.minPingDelay;
  40472. this.maxPingDelay = options.maxPingDelay;
  40473. this.pingDelay = undefined;
  40474. }
  40475. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40476. var _this = this;
  40477. options = extend({}, options, {
  40478. activityTimeout: this.pingDelay
  40479. });
  40480. var connection = this.transport.createConnection(name, priority, key, options);
  40481. var openTimestamp = null;
  40482. var onOpen = function () {
  40483. connection.unbind("open", onOpen);
  40484. connection.bind("closed", onClosed);
  40485. openTimestamp = util.now();
  40486. };
  40487. var onClosed = function (closeEvent) {
  40488. connection.unbind("closed", onClosed);
  40489. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40490. _this.manager.reportDeath();
  40491. }
  40492. else if (!closeEvent.wasClean && openTimestamp) {
  40493. var lifespan = util.now() - openTimestamp;
  40494. if (lifespan < 2 * _this.maxPingDelay) {
  40495. _this.manager.reportDeath();
  40496. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40497. }
  40498. }
  40499. };
  40500. connection.bind("open", onOpen);
  40501. return connection;
  40502. };
  40503. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40504. return this.manager.isAlive() && this.transport.isSupported(environment);
  40505. };
  40506. return AssistantToTheTransportManager;
  40507. }());
  40508. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40509. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40510. var Protocol = {
  40511. decodeMessage: function (messageEvent) {
  40512. try {
  40513. var messageData = JSON.parse(messageEvent.data);
  40514. var pusherEventData = messageData.data;
  40515. if (typeof pusherEventData === 'string') {
  40516. try {
  40517. pusherEventData = JSON.parse(messageData.data);
  40518. }
  40519. catch (e) { }
  40520. }
  40521. var pusherEvent = {
  40522. event: messageData.event,
  40523. channel: messageData.channel,
  40524. data: pusherEventData,
  40525. };
  40526. if (messageData.user_id) {
  40527. pusherEvent.user_id = messageData.user_id;
  40528. }
  40529. return pusherEvent;
  40530. }
  40531. catch (e) {
  40532. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40533. }
  40534. },
  40535. encodeMessage: function (event) {
  40536. return JSON.stringify(event);
  40537. },
  40538. processHandshake: function (messageEvent) {
  40539. var message = Protocol.decodeMessage(messageEvent);
  40540. if (message.event === "pusher:connection_established") {
  40541. if (!message.data.activity_timeout) {
  40542. throw "No activity timeout specified in handshake";
  40543. }
  40544. return {
  40545. action: "connected",
  40546. id: message.data.socket_id,
  40547. activityTimeout: message.data.activity_timeout * 1000
  40548. };
  40549. }
  40550. else if (message.event === "pusher:error") {
  40551. return {
  40552. action: this.getCloseAction(message.data),
  40553. error: this.getCloseError(message.data)
  40554. };
  40555. }
  40556. else {
  40557. throw "Invalid handshake";
  40558. }
  40559. },
  40560. getCloseAction: function (closeEvent) {
  40561. if (closeEvent.code < 4000) {
  40562. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40563. return "backoff";
  40564. }
  40565. else {
  40566. return null;
  40567. }
  40568. }
  40569. else if (closeEvent.code === 4000) {
  40570. return "tls_only";
  40571. }
  40572. else if (closeEvent.code < 4100) {
  40573. return "refused";
  40574. }
  40575. else if (closeEvent.code < 4200) {
  40576. return "backoff";
  40577. }
  40578. else if (closeEvent.code < 4300) {
  40579. return "retry";
  40580. }
  40581. else {
  40582. return "refused";
  40583. }
  40584. },
  40585. getCloseError: function (closeEvent) {
  40586. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40587. return {
  40588. type: 'PusherError',
  40589. data: {
  40590. code: closeEvent.code,
  40591. message: closeEvent.reason || closeEvent.message
  40592. }
  40593. };
  40594. }
  40595. else {
  40596. return null;
  40597. }
  40598. }
  40599. };
  40600. /* harmony default export */ var protocol_protocol = (Protocol);
  40601. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40602. var connection_extends = (undefined && undefined.__extends) || (function () {
  40603. var extendStatics = function (d, b) {
  40604. extendStatics = Object.setPrototypeOf ||
  40605. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40606. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40607. return extendStatics(d, b);
  40608. };
  40609. return function (d, b) {
  40610. extendStatics(d, b);
  40611. function __() { this.constructor = d; }
  40612. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40613. };
  40614. })();
  40615. var connection_Connection = (function (_super) {
  40616. connection_extends(Connection, _super);
  40617. function Connection(id, transport) {
  40618. var _this = _super.call(this) || this;
  40619. _this.id = id;
  40620. _this.transport = transport;
  40621. _this.activityTimeout = transport.activityTimeout;
  40622. _this.bindListeners();
  40623. return _this;
  40624. }
  40625. Connection.prototype.handlesActivityChecks = function () {
  40626. return this.transport.handlesActivityChecks();
  40627. };
  40628. Connection.prototype.send = function (data) {
  40629. return this.transport.send(data);
  40630. };
  40631. Connection.prototype.send_event = function (name, data, channel) {
  40632. var event = { event: name, data: data };
  40633. if (channel) {
  40634. event.channel = channel;
  40635. }
  40636. logger.debug('Event sent', event);
  40637. return this.send(protocol_protocol.encodeMessage(event));
  40638. };
  40639. Connection.prototype.ping = function () {
  40640. if (this.transport.supportsPing()) {
  40641. this.transport.ping();
  40642. }
  40643. else {
  40644. this.send_event('pusher:ping', {});
  40645. }
  40646. };
  40647. Connection.prototype.close = function () {
  40648. this.transport.close();
  40649. };
  40650. Connection.prototype.bindListeners = function () {
  40651. var _this = this;
  40652. var listeners = {
  40653. message: function (messageEvent) {
  40654. var pusherEvent;
  40655. try {
  40656. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40657. }
  40658. catch (e) {
  40659. _this.emit('error', {
  40660. type: 'MessageParseError',
  40661. error: e,
  40662. data: messageEvent.data
  40663. });
  40664. }
  40665. if (pusherEvent !== undefined) {
  40666. logger.debug('Event recd', pusherEvent);
  40667. switch (pusherEvent.event) {
  40668. case 'pusher:error':
  40669. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40670. break;
  40671. case 'pusher:ping':
  40672. _this.emit("ping");
  40673. break;
  40674. case 'pusher:pong':
  40675. _this.emit("pong");
  40676. break;
  40677. }
  40678. _this.emit('message', pusherEvent);
  40679. }
  40680. },
  40681. activity: function () {
  40682. _this.emit("activity");
  40683. },
  40684. error: function (error) {
  40685. _this.emit("error", { type: "WebSocketError", error: error });
  40686. },
  40687. closed: function (closeEvent) {
  40688. unbindListeners();
  40689. if (closeEvent && closeEvent.code) {
  40690. _this.handleCloseEvent(closeEvent);
  40691. }
  40692. _this.transport = null;
  40693. _this.emit("closed");
  40694. }
  40695. };
  40696. var unbindListeners = function () {
  40697. objectApply(listeners, function (listener, event) {
  40698. _this.transport.unbind(event, listener);
  40699. });
  40700. };
  40701. objectApply(listeners, function (listener, event) {
  40702. _this.transport.bind(event, listener);
  40703. });
  40704. };
  40705. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40706. var action = protocol_protocol.getCloseAction(closeEvent);
  40707. var error = protocol_protocol.getCloseError(closeEvent);
  40708. if (error) {
  40709. this.emit('error', error);
  40710. }
  40711. if (action) {
  40712. this.emit(action, { action: action, error: error });
  40713. }
  40714. };
  40715. return Connection;
  40716. }(dispatcher));
  40717. /* harmony default export */ var connection_connection = (connection_Connection);
  40718. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40719. var handshake_Handshake = (function () {
  40720. function Handshake(transport, callback) {
  40721. this.transport = transport;
  40722. this.callback = callback;
  40723. this.bindListeners();
  40724. }
  40725. Handshake.prototype.close = function () {
  40726. this.unbindListeners();
  40727. this.transport.close();
  40728. };
  40729. Handshake.prototype.bindListeners = function () {
  40730. var _this = this;
  40731. this.onMessage = function (m) {
  40732. _this.unbindListeners();
  40733. var result;
  40734. try {
  40735. result = protocol_protocol.processHandshake(m);
  40736. }
  40737. catch (e) {
  40738. _this.finish("error", { error: e });
  40739. _this.transport.close();
  40740. return;
  40741. }
  40742. if (result.action === "connected") {
  40743. _this.finish("connected", {
  40744. connection: new connection_connection(result.id, _this.transport),
  40745. activityTimeout: result.activityTimeout
  40746. });
  40747. }
  40748. else {
  40749. _this.finish(result.action, { error: result.error });
  40750. _this.transport.close();
  40751. }
  40752. };
  40753. this.onClosed = function (closeEvent) {
  40754. _this.unbindListeners();
  40755. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40756. var error = protocol_protocol.getCloseError(closeEvent);
  40757. _this.finish(action, { error: error });
  40758. };
  40759. this.transport.bind("message", this.onMessage);
  40760. this.transport.bind("closed", this.onClosed);
  40761. };
  40762. Handshake.prototype.unbindListeners = function () {
  40763. this.transport.unbind("message", this.onMessage);
  40764. this.transport.unbind("closed", this.onClosed);
  40765. };
  40766. Handshake.prototype.finish = function (action, params) {
  40767. this.callback(extend({ transport: this.transport, action: action }, params));
  40768. };
  40769. return Handshake;
  40770. }());
  40771. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40772. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40773. var pusher_authorizer_PusherAuthorizer = (function () {
  40774. function PusherAuthorizer(channel, options) {
  40775. this.channel = channel;
  40776. var authTransport = options.authTransport;
  40777. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40778. throw "'" + authTransport + "' is not a recognized auth transport";
  40779. }
  40780. this.type = authTransport;
  40781. this.options = options;
  40782. this.authOptions = (options || {}).auth || {};
  40783. }
  40784. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40785. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40786. '&channel_name=' + encodeURIComponent(this.channel.name);
  40787. for (var i in this.authOptions.params) {
  40788. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40789. }
  40790. return query;
  40791. };
  40792. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40793. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40794. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40795. };
  40796. return PusherAuthorizer;
  40797. }());
  40798. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40799. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40800. var timeline_sender_TimelineSender = (function () {
  40801. function TimelineSender(timeline, options) {
  40802. this.timeline = timeline;
  40803. this.options = options || {};
  40804. }
  40805. TimelineSender.prototype.send = function (useTLS, callback) {
  40806. if (this.timeline.isEmpty()) {
  40807. return;
  40808. }
  40809. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40810. };
  40811. return TimelineSender;
  40812. }());
  40813. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40814. // CONCATENATED MODULE: ./src/core/errors.ts
  40815. var errors_extends = (undefined && undefined.__extends) || (function () {
  40816. var extendStatics = function (d, b) {
  40817. extendStatics = Object.setPrototypeOf ||
  40818. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40819. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40820. return extendStatics(d, b);
  40821. };
  40822. return function (d, b) {
  40823. extendStatics(d, b);
  40824. function __() { this.constructor = d; }
  40825. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40826. };
  40827. })();
  40828. var BadEventName = (function (_super) {
  40829. errors_extends(BadEventName, _super);
  40830. function BadEventName(msg) {
  40831. var _newTarget = this.constructor;
  40832. var _this = _super.call(this, msg) || this;
  40833. Object.setPrototypeOf(_this, _newTarget.prototype);
  40834. return _this;
  40835. }
  40836. return BadEventName;
  40837. }(Error));
  40838. var RequestTimedOut = (function (_super) {
  40839. errors_extends(RequestTimedOut, _super);
  40840. function RequestTimedOut(msg) {
  40841. var _newTarget = this.constructor;
  40842. var _this = _super.call(this, msg) || this;
  40843. Object.setPrototypeOf(_this, _newTarget.prototype);
  40844. return _this;
  40845. }
  40846. return RequestTimedOut;
  40847. }(Error));
  40848. var TransportPriorityTooLow = (function (_super) {
  40849. errors_extends(TransportPriorityTooLow, _super);
  40850. function TransportPriorityTooLow(msg) {
  40851. var _newTarget = this.constructor;
  40852. var _this = _super.call(this, msg) || this;
  40853. Object.setPrototypeOf(_this, _newTarget.prototype);
  40854. return _this;
  40855. }
  40856. return TransportPriorityTooLow;
  40857. }(Error));
  40858. var TransportClosed = (function (_super) {
  40859. errors_extends(TransportClosed, _super);
  40860. function TransportClosed(msg) {
  40861. var _newTarget = this.constructor;
  40862. var _this = _super.call(this, msg) || this;
  40863. Object.setPrototypeOf(_this, _newTarget.prototype);
  40864. return _this;
  40865. }
  40866. return TransportClosed;
  40867. }(Error));
  40868. var UnsupportedFeature = (function (_super) {
  40869. errors_extends(UnsupportedFeature, _super);
  40870. function UnsupportedFeature(msg) {
  40871. var _newTarget = this.constructor;
  40872. var _this = _super.call(this, msg) || this;
  40873. Object.setPrototypeOf(_this, _newTarget.prototype);
  40874. return _this;
  40875. }
  40876. return UnsupportedFeature;
  40877. }(Error));
  40878. var UnsupportedTransport = (function (_super) {
  40879. errors_extends(UnsupportedTransport, _super);
  40880. function UnsupportedTransport(msg) {
  40881. var _newTarget = this.constructor;
  40882. var _this = _super.call(this, msg) || this;
  40883. Object.setPrototypeOf(_this, _newTarget.prototype);
  40884. return _this;
  40885. }
  40886. return UnsupportedTransport;
  40887. }(Error));
  40888. var UnsupportedStrategy = (function (_super) {
  40889. errors_extends(UnsupportedStrategy, _super);
  40890. function UnsupportedStrategy(msg) {
  40891. var _newTarget = this.constructor;
  40892. var _this = _super.call(this, msg) || this;
  40893. Object.setPrototypeOf(_this, _newTarget.prototype);
  40894. return _this;
  40895. }
  40896. return UnsupportedStrategy;
  40897. }(Error));
  40898. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40899. var channel_extends = (undefined && undefined.__extends) || (function () {
  40900. var extendStatics = function (d, b) {
  40901. extendStatics = Object.setPrototypeOf ||
  40902. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40903. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40904. return extendStatics(d, b);
  40905. };
  40906. return function (d, b) {
  40907. extendStatics(d, b);
  40908. function __() { this.constructor = d; }
  40909. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40910. };
  40911. })();
  40912. var channel_Channel = (function (_super) {
  40913. channel_extends(Channel, _super);
  40914. function Channel(name, pusher) {
  40915. var _this = _super.call(this, function (event, data) {
  40916. logger.debug('No callbacks on ' + name + ' for ' + event);
  40917. }) || this;
  40918. _this.name = name;
  40919. _this.pusher = pusher;
  40920. _this.subscribed = false;
  40921. _this.subscriptionPending = false;
  40922. _this.subscriptionCancelled = false;
  40923. return _this;
  40924. }
  40925. Channel.prototype.authorize = function (socketId, callback) {
  40926. return callback(false, {});
  40927. };
  40928. Channel.prototype.trigger = function (event, data) {
  40929. if (event.indexOf("client-") !== 0) {
  40930. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40931. }
  40932. if (!this.subscribed) {
  40933. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40934. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40935. }
  40936. return this.pusher.send_event(event, data, this.name);
  40937. };
  40938. Channel.prototype.disconnect = function () {
  40939. this.subscribed = false;
  40940. this.subscriptionPending = false;
  40941. };
  40942. Channel.prototype.handleEvent = function (event) {
  40943. var eventName = event.event;
  40944. var data = event.data;
  40945. if (eventName === "pusher_internal:subscription_succeeded") {
  40946. this.handleSubscriptionSucceededEvent(event);
  40947. }
  40948. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40949. var metadata = {};
  40950. this.emit(eventName, data, metadata);
  40951. }
  40952. };
  40953. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40954. this.subscriptionPending = false;
  40955. this.subscribed = true;
  40956. if (this.subscriptionCancelled) {
  40957. this.pusher.unsubscribe(this.name);
  40958. }
  40959. else {
  40960. this.emit("pusher:subscription_succeeded", event.data);
  40961. }
  40962. };
  40963. Channel.prototype.subscribe = function () {
  40964. var _this = this;
  40965. if (this.subscribed) {
  40966. return;
  40967. }
  40968. this.subscriptionPending = true;
  40969. this.subscriptionCancelled = false;
  40970. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40971. if (error) {
  40972. logger.error(data);
  40973. _this.emit('pusher:subscription_error', data);
  40974. }
  40975. else {
  40976. _this.pusher.send_event('pusher:subscribe', {
  40977. auth: data.auth,
  40978. channel_data: data.channel_data,
  40979. channel: _this.name
  40980. });
  40981. }
  40982. });
  40983. };
  40984. Channel.prototype.unsubscribe = function () {
  40985. this.subscribed = false;
  40986. this.pusher.send_event('pusher:unsubscribe', {
  40987. channel: this.name
  40988. });
  40989. };
  40990. Channel.prototype.cancelSubscription = function () {
  40991. this.subscriptionCancelled = true;
  40992. };
  40993. Channel.prototype.reinstateSubscription = function () {
  40994. this.subscriptionCancelled = false;
  40995. };
  40996. return Channel;
  40997. }(dispatcher));
  40998. /* harmony default export */ var channels_channel = (channel_Channel);
  40999. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41000. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41001. var extendStatics = function (d, b) {
  41002. extendStatics = Object.setPrototypeOf ||
  41003. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41004. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41005. return extendStatics(d, b);
  41006. };
  41007. return function (d, b) {
  41008. extendStatics(d, b);
  41009. function __() { this.constructor = d; }
  41010. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41011. };
  41012. })();
  41013. var private_channel_PrivateChannel = (function (_super) {
  41014. private_channel_extends(PrivateChannel, _super);
  41015. function PrivateChannel() {
  41016. return _super !== null && _super.apply(this, arguments) || this;
  41017. }
  41018. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41019. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41020. return authorizer.authorize(socketId, callback);
  41021. };
  41022. return PrivateChannel;
  41023. }(channels_channel));
  41024. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41025. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41026. var members_Members = (function () {
  41027. function Members() {
  41028. this.reset();
  41029. }
  41030. Members.prototype.get = function (id) {
  41031. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41032. return {
  41033. id: id,
  41034. info: this.members[id]
  41035. };
  41036. }
  41037. else {
  41038. return null;
  41039. }
  41040. };
  41041. Members.prototype.each = function (callback) {
  41042. var _this = this;
  41043. objectApply(this.members, function (member, id) {
  41044. callback(_this.get(id));
  41045. });
  41046. };
  41047. Members.prototype.setMyID = function (id) {
  41048. this.myID = id;
  41049. };
  41050. Members.prototype.onSubscription = function (subscriptionData) {
  41051. this.members = subscriptionData.presence.hash;
  41052. this.count = subscriptionData.presence.count;
  41053. this.me = this.get(this.myID);
  41054. };
  41055. Members.prototype.addMember = function (memberData) {
  41056. if (this.get(memberData.user_id) === null) {
  41057. this.count++;
  41058. }
  41059. this.members[memberData.user_id] = memberData.user_info;
  41060. return this.get(memberData.user_id);
  41061. };
  41062. Members.prototype.removeMember = function (memberData) {
  41063. var member = this.get(memberData.user_id);
  41064. if (member) {
  41065. delete this.members[memberData.user_id];
  41066. this.count--;
  41067. }
  41068. return member;
  41069. };
  41070. Members.prototype.reset = function () {
  41071. this.members = {};
  41072. this.count = 0;
  41073. this.myID = null;
  41074. this.me = null;
  41075. };
  41076. return Members;
  41077. }());
  41078. /* harmony default export */ var members = (members_Members);
  41079. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41080. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41081. var extendStatics = function (d, b) {
  41082. extendStatics = Object.setPrototypeOf ||
  41083. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41084. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41085. return extendStatics(d, b);
  41086. };
  41087. return function (d, b) {
  41088. extendStatics(d, b);
  41089. function __() { this.constructor = d; }
  41090. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41091. };
  41092. })();
  41093. var presence_channel_PresenceChannel = (function (_super) {
  41094. presence_channel_extends(PresenceChannel, _super);
  41095. function PresenceChannel(name, pusher) {
  41096. var _this = _super.call(this, name, pusher) || this;
  41097. _this.members = new members();
  41098. return _this;
  41099. }
  41100. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41101. var _this = this;
  41102. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41103. if (!error) {
  41104. if (authData.channel_data === undefined) {
  41105. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41106. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41107. ("expected 'channel_data' field. " + suffix));
  41108. callback("Invalid auth response");
  41109. return;
  41110. }
  41111. var channelData = JSON.parse(authData.channel_data);
  41112. _this.members.setMyID(channelData.user_id);
  41113. }
  41114. callback(error, authData);
  41115. });
  41116. };
  41117. PresenceChannel.prototype.handleEvent = function (event) {
  41118. var eventName = event.event;
  41119. if (eventName.indexOf("pusher_internal:") === 0) {
  41120. this.handleInternalEvent(event);
  41121. }
  41122. else {
  41123. var data = event.data;
  41124. var metadata = {};
  41125. if (event.user_id) {
  41126. metadata.user_id = event.user_id;
  41127. }
  41128. this.emit(eventName, data, metadata);
  41129. }
  41130. };
  41131. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41132. var eventName = event.event;
  41133. var data = event.data;
  41134. switch (eventName) {
  41135. case "pusher_internal:subscription_succeeded":
  41136. this.handleSubscriptionSucceededEvent(event);
  41137. break;
  41138. case "pusher_internal:member_added":
  41139. var addedMember = this.members.addMember(data);
  41140. this.emit('pusher:member_added', addedMember);
  41141. break;
  41142. case "pusher_internal:member_removed":
  41143. var removedMember = this.members.removeMember(data);
  41144. if (removedMember) {
  41145. this.emit('pusher:member_removed', removedMember);
  41146. }
  41147. break;
  41148. }
  41149. };
  41150. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41151. this.subscriptionPending = false;
  41152. this.subscribed = true;
  41153. if (this.subscriptionCancelled) {
  41154. this.pusher.unsubscribe(this.name);
  41155. }
  41156. else {
  41157. this.members.onSubscription(event.data);
  41158. this.emit("pusher:subscription_succeeded", this.members);
  41159. }
  41160. };
  41161. PresenceChannel.prototype.disconnect = function () {
  41162. this.members.reset();
  41163. _super.prototype.disconnect.call(this);
  41164. };
  41165. return PresenceChannel;
  41166. }(private_channel));
  41167. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41168. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41169. var nacl_fast = __webpack_require__(0);
  41170. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41171. var nacl_util = __webpack_require__(1);
  41172. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41173. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41174. var extendStatics = function (d, b) {
  41175. extendStatics = Object.setPrototypeOf ||
  41176. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41177. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41178. return extendStatics(d, b);
  41179. };
  41180. return function (d, b) {
  41181. extendStatics(d, b);
  41182. function __() { this.constructor = d; }
  41183. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41184. };
  41185. })();
  41186. var encrypted_channel_EncryptedChannel = (function (_super) {
  41187. encrypted_channel_extends(EncryptedChannel, _super);
  41188. function EncryptedChannel() {
  41189. var _this = _super !== null && _super.apply(this, arguments) || this;
  41190. _this.key = null;
  41191. return _this;
  41192. }
  41193. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41194. var _this = this;
  41195. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41196. if (error) {
  41197. callback(true, authData);
  41198. return;
  41199. }
  41200. var sharedSecret = authData["shared_secret"];
  41201. if (!sharedSecret) {
  41202. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41203. callback(true, errorMsg);
  41204. return;
  41205. }
  41206. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41207. delete authData["shared_secret"];
  41208. callback(false, authData);
  41209. });
  41210. };
  41211. EncryptedChannel.prototype.trigger = function (event, data) {
  41212. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41213. };
  41214. EncryptedChannel.prototype.handleEvent = function (event) {
  41215. var eventName = event.event;
  41216. var data = event.data;
  41217. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41218. _super.prototype.handleEvent.call(this, event);
  41219. return;
  41220. }
  41221. this.handleEncryptedEvent(eventName, data);
  41222. };
  41223. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41224. var _this = this;
  41225. if (!this.key) {
  41226. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41227. return;
  41228. }
  41229. if (!data.ciphertext || !data.nonce) {
  41230. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41231. return;
  41232. }
  41233. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41234. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41235. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41236. return;
  41237. }
  41238. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41239. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41240. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41241. return;
  41242. }
  41243. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41244. if (bytes === null) {
  41245. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41246. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41247. if (error) {
  41248. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41249. return;
  41250. }
  41251. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41252. if (bytes === null) {
  41253. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41254. return;
  41255. }
  41256. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41257. return;
  41258. });
  41259. return;
  41260. }
  41261. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41262. };
  41263. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41264. try {
  41265. this.emit(eventName, JSON.parse(data));
  41266. }
  41267. catch (e) {
  41268. this.emit(eventName, data);
  41269. }
  41270. return this;
  41271. };
  41272. return EncryptedChannel;
  41273. }(private_channel));
  41274. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41275. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41276. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41277. var extendStatics = function (d, b) {
  41278. extendStatics = Object.setPrototypeOf ||
  41279. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41280. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41281. return extendStatics(d, b);
  41282. };
  41283. return function (d, b) {
  41284. extendStatics(d, b);
  41285. function __() { this.constructor = d; }
  41286. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41287. };
  41288. })();
  41289. var connection_manager_ConnectionManager = (function (_super) {
  41290. connection_manager_extends(ConnectionManager, _super);
  41291. function ConnectionManager(key, options) {
  41292. var _this = _super.call(this) || this;
  41293. _this.key = key;
  41294. _this.options = options || {};
  41295. _this.state = "initialized";
  41296. _this.connection = null;
  41297. _this.usingTLS = !!options.useTLS;
  41298. _this.timeline = _this.options.timeline;
  41299. _this.errorCallbacks = _this.buildErrorCallbacks();
  41300. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41301. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41302. var Network = runtime.getNetwork();
  41303. Network.bind("online", function () {
  41304. _this.timeline.info({ netinfo: "online" });
  41305. if (_this.state === "connecting" || _this.state === "unavailable") {
  41306. _this.retryIn(0);
  41307. }
  41308. });
  41309. Network.bind("offline", function () {
  41310. _this.timeline.info({ netinfo: "offline" });
  41311. if (_this.connection) {
  41312. _this.sendActivityCheck();
  41313. }
  41314. });
  41315. _this.updateStrategy();
  41316. return _this;
  41317. }
  41318. ConnectionManager.prototype.connect = function () {
  41319. if (this.connection || this.runner) {
  41320. return;
  41321. }
  41322. if (!this.strategy.isSupported()) {
  41323. this.updateState("failed");
  41324. return;
  41325. }
  41326. this.updateState("connecting");
  41327. this.startConnecting();
  41328. this.setUnavailableTimer();
  41329. };
  41330. ;
  41331. ConnectionManager.prototype.send = function (data) {
  41332. if (this.connection) {
  41333. return this.connection.send(data);
  41334. }
  41335. else {
  41336. return false;
  41337. }
  41338. };
  41339. ;
  41340. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41341. if (this.connection) {
  41342. return this.connection.send_event(name, data, channel);
  41343. }
  41344. else {
  41345. return false;
  41346. }
  41347. };
  41348. ;
  41349. ConnectionManager.prototype.disconnect = function () {
  41350. this.disconnectInternally();
  41351. this.updateState("disconnected");
  41352. };
  41353. ;
  41354. ConnectionManager.prototype.isUsingTLS = function () {
  41355. return this.usingTLS;
  41356. };
  41357. ;
  41358. ConnectionManager.prototype.startConnecting = function () {
  41359. var _this = this;
  41360. var callback = function (error, handshake) {
  41361. if (error) {
  41362. _this.runner = _this.strategy.connect(0, callback);
  41363. }
  41364. else {
  41365. if (handshake.action === "error") {
  41366. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41367. _this.timeline.error({ handshakeError: handshake.error });
  41368. }
  41369. else {
  41370. _this.abortConnecting();
  41371. _this.handshakeCallbacks[handshake.action](handshake);
  41372. }
  41373. }
  41374. };
  41375. this.runner = this.strategy.connect(0, callback);
  41376. };
  41377. ;
  41378. ConnectionManager.prototype.abortConnecting = function () {
  41379. if (this.runner) {
  41380. this.runner.abort();
  41381. this.runner = null;
  41382. }
  41383. };
  41384. ;
  41385. ConnectionManager.prototype.disconnectInternally = function () {
  41386. this.abortConnecting();
  41387. this.clearRetryTimer();
  41388. this.clearUnavailableTimer();
  41389. if (this.connection) {
  41390. var connection = this.abandonConnection();
  41391. connection.close();
  41392. }
  41393. };
  41394. ;
  41395. ConnectionManager.prototype.updateStrategy = function () {
  41396. this.strategy = this.options.getStrategy({
  41397. key: this.key,
  41398. timeline: this.timeline,
  41399. useTLS: this.usingTLS
  41400. });
  41401. };
  41402. ;
  41403. ConnectionManager.prototype.retryIn = function (delay) {
  41404. var _this = this;
  41405. this.timeline.info({ action: "retry", delay: delay });
  41406. if (delay > 0) {
  41407. this.emit("connecting_in", Math.round(delay / 1000));
  41408. }
  41409. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41410. _this.disconnectInternally();
  41411. _this.connect();
  41412. });
  41413. };
  41414. ;
  41415. ConnectionManager.prototype.clearRetryTimer = function () {
  41416. if (this.retryTimer) {
  41417. this.retryTimer.ensureAborted();
  41418. this.retryTimer = null;
  41419. }
  41420. };
  41421. ;
  41422. ConnectionManager.prototype.setUnavailableTimer = function () {
  41423. var _this = this;
  41424. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41425. _this.updateState("unavailable");
  41426. });
  41427. };
  41428. ;
  41429. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41430. if (this.unavailableTimer) {
  41431. this.unavailableTimer.ensureAborted();
  41432. }
  41433. };
  41434. ;
  41435. ConnectionManager.prototype.sendActivityCheck = function () {
  41436. var _this = this;
  41437. this.stopActivityCheck();
  41438. this.connection.ping();
  41439. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41440. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41441. _this.retryIn(0);
  41442. });
  41443. };
  41444. ;
  41445. ConnectionManager.prototype.resetActivityCheck = function () {
  41446. var _this = this;
  41447. this.stopActivityCheck();
  41448. if (this.connection && !this.connection.handlesActivityChecks()) {
  41449. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41450. _this.sendActivityCheck();
  41451. });
  41452. }
  41453. };
  41454. ;
  41455. ConnectionManager.prototype.stopActivityCheck = function () {
  41456. if (this.activityTimer) {
  41457. this.activityTimer.ensureAborted();
  41458. }
  41459. };
  41460. ;
  41461. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41462. var _this = this;
  41463. return extend({}, errorCallbacks, {
  41464. message: function (message) {
  41465. _this.resetActivityCheck();
  41466. _this.emit('message', message);
  41467. },
  41468. ping: function () {
  41469. _this.send_event('pusher:pong', {});
  41470. },
  41471. activity: function () {
  41472. _this.resetActivityCheck();
  41473. },
  41474. error: function (error) {
  41475. _this.emit("error", { type: "WebSocketError", error: error });
  41476. },
  41477. closed: function () {
  41478. _this.abandonConnection();
  41479. if (_this.shouldRetry()) {
  41480. _this.retryIn(1000);
  41481. }
  41482. }
  41483. });
  41484. };
  41485. ;
  41486. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41487. var _this = this;
  41488. return extend({}, errorCallbacks, {
  41489. connected: function (handshake) {
  41490. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41491. _this.clearUnavailableTimer();
  41492. _this.setConnection(handshake.connection);
  41493. _this.socket_id = _this.connection.id;
  41494. _this.updateState("connected", { socket_id: _this.socket_id });
  41495. }
  41496. });
  41497. };
  41498. ;
  41499. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41500. var _this = this;
  41501. var withErrorEmitted = function (callback) {
  41502. return function (result) {
  41503. if (result.error) {
  41504. _this.emit("error", { type: "WebSocketError", error: result.error });
  41505. }
  41506. callback(result);
  41507. };
  41508. };
  41509. return {
  41510. tls_only: withErrorEmitted(function () {
  41511. _this.usingTLS = true;
  41512. _this.updateStrategy();
  41513. _this.retryIn(0);
  41514. }),
  41515. refused: withErrorEmitted(function () {
  41516. _this.disconnect();
  41517. }),
  41518. backoff: withErrorEmitted(function () {
  41519. _this.retryIn(1000);
  41520. }),
  41521. retry: withErrorEmitted(function () {
  41522. _this.retryIn(0);
  41523. })
  41524. };
  41525. };
  41526. ;
  41527. ConnectionManager.prototype.setConnection = function (connection) {
  41528. this.connection = connection;
  41529. for (var event in this.connectionCallbacks) {
  41530. this.connection.bind(event, this.connectionCallbacks[event]);
  41531. }
  41532. this.resetActivityCheck();
  41533. };
  41534. ;
  41535. ConnectionManager.prototype.abandonConnection = function () {
  41536. if (!this.connection) {
  41537. return;
  41538. }
  41539. this.stopActivityCheck();
  41540. for (var event in this.connectionCallbacks) {
  41541. this.connection.unbind(event, this.connectionCallbacks[event]);
  41542. }
  41543. var connection = this.connection;
  41544. this.connection = null;
  41545. return connection;
  41546. };
  41547. ConnectionManager.prototype.updateState = function (newState, data) {
  41548. var previousState = this.state;
  41549. this.state = newState;
  41550. if (previousState !== newState) {
  41551. var newStateDescription = newState;
  41552. if (newStateDescription === "connected") {
  41553. newStateDescription += " with new socket ID " + data.socket_id;
  41554. }
  41555. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41556. this.timeline.info({ state: newState, params: data });
  41557. this.emit('state_change', { previous: previousState, current: newState });
  41558. this.emit(newState, data);
  41559. }
  41560. };
  41561. ConnectionManager.prototype.shouldRetry = function () {
  41562. return this.state === "connecting" || this.state === "connected";
  41563. };
  41564. return ConnectionManager;
  41565. }(dispatcher));
  41566. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41567. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41568. var channels_Channels = (function () {
  41569. function Channels() {
  41570. this.channels = {};
  41571. }
  41572. Channels.prototype.add = function (name, pusher) {
  41573. if (!this.channels[name]) {
  41574. this.channels[name] = createChannel(name, pusher);
  41575. }
  41576. return this.channels[name];
  41577. };
  41578. Channels.prototype.all = function () {
  41579. return values(this.channels);
  41580. };
  41581. Channels.prototype.find = function (name) {
  41582. return this.channels[name];
  41583. };
  41584. Channels.prototype.remove = function (name) {
  41585. var channel = this.channels[name];
  41586. delete this.channels[name];
  41587. return channel;
  41588. };
  41589. Channels.prototype.disconnect = function () {
  41590. objectApply(this.channels, function (channel) {
  41591. channel.disconnect();
  41592. });
  41593. };
  41594. return Channels;
  41595. }());
  41596. /* harmony default export */ var channels = (channels_Channels);
  41597. function createChannel(name, pusher) {
  41598. if (name.indexOf('private-encrypted-') === 0) {
  41599. if (false) { var errorMsg; }
  41600. return factory.createEncryptedChannel(name, pusher);
  41601. }
  41602. else if (name.indexOf('private-') === 0) {
  41603. return factory.createPrivateChannel(name, pusher);
  41604. }
  41605. else if (name.indexOf('presence-') === 0) {
  41606. return factory.createPresenceChannel(name, pusher);
  41607. }
  41608. else {
  41609. return factory.createChannel(name, pusher);
  41610. }
  41611. }
  41612. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41613. var Factory = {
  41614. createChannels: function () {
  41615. return new channels();
  41616. },
  41617. createConnectionManager: function (key, options) {
  41618. return new connection_manager(key, options);
  41619. },
  41620. createChannel: function (name, pusher) {
  41621. return new channels_channel(name, pusher);
  41622. },
  41623. createPrivateChannel: function (name, pusher) {
  41624. return new private_channel(name, pusher);
  41625. },
  41626. createPresenceChannel: function (name, pusher) {
  41627. return new presence_channel(name, pusher);
  41628. },
  41629. createEncryptedChannel: function (name, pusher) {
  41630. return new encrypted_channel(name, pusher);
  41631. },
  41632. createTimelineSender: function (timeline, options) {
  41633. return new timeline_sender(timeline, options);
  41634. },
  41635. createAuthorizer: function (channel, options) {
  41636. if (options.authorizer) {
  41637. return options.authorizer(channel, options);
  41638. }
  41639. return new pusher_authorizer(channel, options);
  41640. },
  41641. createHandshake: function (transport, callback) {
  41642. return new connection_handshake(transport, callback);
  41643. },
  41644. createAssistantToTheTransportManager: function (manager, transport, options) {
  41645. return new assistant_to_the_transport_manager(manager, transport, options);
  41646. }
  41647. };
  41648. /* harmony default export */ var factory = (Factory);
  41649. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41650. var transport_manager_TransportManager = (function () {
  41651. function TransportManager(options) {
  41652. this.options = options || {};
  41653. this.livesLeft = this.options.lives || Infinity;
  41654. }
  41655. TransportManager.prototype.getAssistant = function (transport) {
  41656. return factory.createAssistantToTheTransportManager(this, transport, {
  41657. minPingDelay: this.options.minPingDelay,
  41658. maxPingDelay: this.options.maxPingDelay
  41659. });
  41660. };
  41661. TransportManager.prototype.isAlive = function () {
  41662. return this.livesLeft > 0;
  41663. };
  41664. TransportManager.prototype.reportDeath = function () {
  41665. this.livesLeft -= 1;
  41666. };
  41667. return TransportManager;
  41668. }());
  41669. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41670. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41671. var sequential_strategy_SequentialStrategy = (function () {
  41672. function SequentialStrategy(strategies, options) {
  41673. this.strategies = strategies;
  41674. this.loop = Boolean(options.loop);
  41675. this.failFast = Boolean(options.failFast);
  41676. this.timeout = options.timeout;
  41677. this.timeoutLimit = options.timeoutLimit;
  41678. }
  41679. SequentialStrategy.prototype.isSupported = function () {
  41680. return any(this.strategies, util.method("isSupported"));
  41681. };
  41682. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41683. var _this = this;
  41684. var strategies = this.strategies;
  41685. var current = 0;
  41686. var timeout = this.timeout;
  41687. var runner = null;
  41688. var tryNextStrategy = function (error, handshake) {
  41689. if (handshake) {
  41690. callback(null, handshake);
  41691. }
  41692. else {
  41693. current = current + 1;
  41694. if (_this.loop) {
  41695. current = current % strategies.length;
  41696. }
  41697. if (current < strategies.length) {
  41698. if (timeout) {
  41699. timeout = timeout * 2;
  41700. if (_this.timeoutLimit) {
  41701. timeout = Math.min(timeout, _this.timeoutLimit);
  41702. }
  41703. }
  41704. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41705. }
  41706. else {
  41707. callback(true);
  41708. }
  41709. }
  41710. };
  41711. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41712. return {
  41713. abort: function () {
  41714. runner.abort();
  41715. },
  41716. forceMinPriority: function (p) {
  41717. minPriority = p;
  41718. if (runner) {
  41719. runner.forceMinPriority(p);
  41720. }
  41721. }
  41722. };
  41723. };
  41724. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41725. var timer = null;
  41726. var runner = null;
  41727. if (options.timeout > 0) {
  41728. timer = new OneOffTimer(options.timeout, function () {
  41729. runner.abort();
  41730. callback(true);
  41731. });
  41732. }
  41733. runner = strategy.connect(minPriority, function (error, handshake) {
  41734. if (error && timer && timer.isRunning() && !options.failFast) {
  41735. return;
  41736. }
  41737. if (timer) {
  41738. timer.ensureAborted();
  41739. }
  41740. callback(error, handshake);
  41741. });
  41742. return {
  41743. abort: function () {
  41744. if (timer) {
  41745. timer.ensureAborted();
  41746. }
  41747. runner.abort();
  41748. },
  41749. forceMinPriority: function (p) {
  41750. runner.forceMinPriority(p);
  41751. }
  41752. };
  41753. };
  41754. return SequentialStrategy;
  41755. }());
  41756. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41757. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41758. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41759. function BestConnectedEverStrategy(strategies) {
  41760. this.strategies = strategies;
  41761. }
  41762. BestConnectedEverStrategy.prototype.isSupported = function () {
  41763. return any(this.strategies, util.method("isSupported"));
  41764. };
  41765. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41766. return connect(this.strategies, minPriority, function (i, runners) {
  41767. return function (error, handshake) {
  41768. runners[i].error = error;
  41769. if (error) {
  41770. if (allRunnersFailed(runners)) {
  41771. callback(true);
  41772. }
  41773. return;
  41774. }
  41775. apply(runners, function (runner) {
  41776. runner.forceMinPriority(handshake.transport.priority);
  41777. });
  41778. callback(null, handshake);
  41779. };
  41780. });
  41781. };
  41782. return BestConnectedEverStrategy;
  41783. }());
  41784. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41785. function connect(strategies, minPriority, callbackBuilder) {
  41786. var runners = map(strategies, function (strategy, i, _, rs) {
  41787. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41788. });
  41789. return {
  41790. abort: function () {
  41791. apply(runners, abortRunner);
  41792. },
  41793. forceMinPriority: function (p) {
  41794. apply(runners, function (runner) {
  41795. runner.forceMinPriority(p);
  41796. });
  41797. }
  41798. };
  41799. }
  41800. function allRunnersFailed(runners) {
  41801. return collections_all(runners, function (runner) {
  41802. return Boolean(runner.error);
  41803. });
  41804. }
  41805. function abortRunner(runner) {
  41806. if (!runner.error && !runner.aborted) {
  41807. runner.abort();
  41808. runner.aborted = true;
  41809. }
  41810. }
  41811. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41812. var cached_strategy_CachedStrategy = (function () {
  41813. function CachedStrategy(strategy, transports, options) {
  41814. this.strategy = strategy;
  41815. this.transports = transports;
  41816. this.ttl = options.ttl || 1800 * 1000;
  41817. this.usingTLS = options.useTLS;
  41818. this.timeline = options.timeline;
  41819. }
  41820. CachedStrategy.prototype.isSupported = function () {
  41821. return this.strategy.isSupported();
  41822. };
  41823. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41824. var usingTLS = this.usingTLS;
  41825. var info = fetchTransportCache(usingTLS);
  41826. var strategies = [this.strategy];
  41827. if (info && info.timestamp + this.ttl >= util.now()) {
  41828. var transport = this.transports[info.transport];
  41829. if (transport) {
  41830. this.timeline.info({
  41831. cached: true,
  41832. transport: info.transport,
  41833. latency: info.latency
  41834. });
  41835. strategies.push(new sequential_strategy([transport], {
  41836. timeout: info.latency * 2 + 1000,
  41837. failFast: true
  41838. }));
  41839. }
  41840. }
  41841. var startTimestamp = util.now();
  41842. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41843. if (error) {
  41844. flushTransportCache(usingTLS);
  41845. if (strategies.length > 0) {
  41846. startTimestamp = util.now();
  41847. runner = strategies.pop().connect(minPriority, cb);
  41848. }
  41849. else {
  41850. callback(error);
  41851. }
  41852. }
  41853. else {
  41854. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41855. callback(null, handshake);
  41856. }
  41857. });
  41858. return {
  41859. abort: function () {
  41860. runner.abort();
  41861. },
  41862. forceMinPriority: function (p) {
  41863. minPriority = p;
  41864. if (runner) {
  41865. runner.forceMinPriority(p);
  41866. }
  41867. }
  41868. };
  41869. };
  41870. return CachedStrategy;
  41871. }());
  41872. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41873. function getTransportCacheKey(usingTLS) {
  41874. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41875. }
  41876. function fetchTransportCache(usingTLS) {
  41877. var storage = runtime.getLocalStorage();
  41878. if (storage) {
  41879. try {
  41880. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41881. if (serializedCache) {
  41882. return JSON.parse(serializedCache);
  41883. }
  41884. }
  41885. catch (e) {
  41886. flushTransportCache(usingTLS);
  41887. }
  41888. }
  41889. return null;
  41890. }
  41891. function storeTransportCache(usingTLS, transport, latency) {
  41892. var storage = runtime.getLocalStorage();
  41893. if (storage) {
  41894. try {
  41895. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41896. timestamp: util.now(),
  41897. transport: transport,
  41898. latency: latency
  41899. });
  41900. }
  41901. catch (e) {
  41902. }
  41903. }
  41904. }
  41905. function flushTransportCache(usingTLS) {
  41906. var storage = runtime.getLocalStorage();
  41907. if (storage) {
  41908. try {
  41909. delete storage[getTransportCacheKey(usingTLS)];
  41910. }
  41911. catch (e) {
  41912. }
  41913. }
  41914. }
  41915. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41916. var delayed_strategy_DelayedStrategy = (function () {
  41917. function DelayedStrategy(strategy, _a) {
  41918. var number = _a.delay;
  41919. this.strategy = strategy;
  41920. this.options = { delay: number };
  41921. }
  41922. DelayedStrategy.prototype.isSupported = function () {
  41923. return this.strategy.isSupported();
  41924. };
  41925. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41926. var strategy = this.strategy;
  41927. var runner;
  41928. var timer = new OneOffTimer(this.options.delay, function () {
  41929. runner = strategy.connect(minPriority, callback);
  41930. });
  41931. return {
  41932. abort: function () {
  41933. timer.ensureAborted();
  41934. if (runner) {
  41935. runner.abort();
  41936. }
  41937. },
  41938. forceMinPriority: function (p) {
  41939. minPriority = p;
  41940. if (runner) {
  41941. runner.forceMinPriority(p);
  41942. }
  41943. }
  41944. };
  41945. };
  41946. return DelayedStrategy;
  41947. }());
  41948. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41949. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41950. var IfStrategy = (function () {
  41951. function IfStrategy(test, trueBranch, falseBranch) {
  41952. this.test = test;
  41953. this.trueBranch = trueBranch;
  41954. this.falseBranch = falseBranch;
  41955. }
  41956. IfStrategy.prototype.isSupported = function () {
  41957. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41958. return branch.isSupported();
  41959. };
  41960. IfStrategy.prototype.connect = function (minPriority, callback) {
  41961. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41962. return branch.connect(minPriority, callback);
  41963. };
  41964. return IfStrategy;
  41965. }());
  41966. /* harmony default export */ var if_strategy = (IfStrategy);
  41967. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41968. var FirstConnectedStrategy = (function () {
  41969. function FirstConnectedStrategy(strategy) {
  41970. this.strategy = strategy;
  41971. }
  41972. FirstConnectedStrategy.prototype.isSupported = function () {
  41973. return this.strategy.isSupported();
  41974. };
  41975. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41976. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41977. if (handshake) {
  41978. runner.abort();
  41979. }
  41980. callback(error, handshake);
  41981. });
  41982. return runner;
  41983. };
  41984. return FirstConnectedStrategy;
  41985. }());
  41986. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41987. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41988. function testSupportsStrategy(strategy) {
  41989. return function () {
  41990. return strategy.isSupported();
  41991. };
  41992. }
  41993. var getDefaultStrategy = function (config, defineTransport) {
  41994. var definedTransports = {};
  41995. function defineTransportStrategy(name, type, priority, options, manager) {
  41996. var transport = defineTransport(config, name, type, priority, options, manager);
  41997. definedTransports[name] = transport;
  41998. return transport;
  41999. }
  42000. var ws_options = {
  42001. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42002. hostTLS: config.wsHost + ":" + config.wssPort,
  42003. httpPath: config.wsPath
  42004. };
  42005. var wss_options = extend({}, ws_options, {
  42006. useTLS: true
  42007. });
  42008. var sockjs_options = {
  42009. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42010. hostTLS: config.httpHost + ":" + config.httpsPort,
  42011. httpPath: config.httpPath
  42012. };
  42013. var timeouts = {
  42014. loop: true,
  42015. timeout: 15000,
  42016. timeoutLimit: 60000
  42017. };
  42018. var ws_manager = new transport_manager({
  42019. lives: 2,
  42020. minPingDelay: 10000,
  42021. maxPingDelay: config.activity_timeout
  42022. });
  42023. var streaming_manager = new transport_manager({
  42024. lives: 2,
  42025. minPingDelay: 10000,
  42026. maxPingDelay: config.activity_timeout
  42027. });
  42028. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42029. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42030. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42031. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42032. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42033. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42034. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42035. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42036. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42037. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42038. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42039. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42040. 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);
  42041. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42042. var wsStrategy;
  42043. if (config.useTLS) {
  42044. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42045. }
  42046. else {
  42047. wsStrategy = new best_connected_ever_strategy([
  42048. ws_loop,
  42049. new delayed_strategy(wss_loop, { delay: 2000 }),
  42050. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42051. ]);
  42052. }
  42053. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42054. ttl: 1800000,
  42055. timeline: config.timeline,
  42056. useTLS: config.useTLS
  42057. });
  42058. };
  42059. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42060. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42061. /* harmony default export */ var transport_connection_initializer = (function () {
  42062. var self = this;
  42063. self.timeline.info(self.buildTimelineMessage({
  42064. transport: self.name + (self.options.useTLS ? "s" : "")
  42065. }));
  42066. if (self.hooks.isInitialized()) {
  42067. self.changeState("initialized");
  42068. }
  42069. else if (self.hooks.file) {
  42070. self.changeState("initializing");
  42071. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42072. if (self.hooks.isInitialized()) {
  42073. self.changeState("initialized");
  42074. callback(true);
  42075. }
  42076. else {
  42077. if (error) {
  42078. self.onError(error);
  42079. }
  42080. self.onClose();
  42081. callback(false);
  42082. }
  42083. });
  42084. }
  42085. else {
  42086. self.onClose();
  42087. }
  42088. });
  42089. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42090. var http_xdomain_request_hooks = {
  42091. getRequest: function (socket) {
  42092. var xdr = new window.XDomainRequest();
  42093. xdr.ontimeout = function () {
  42094. socket.emit("error", new RequestTimedOut());
  42095. socket.close();
  42096. };
  42097. xdr.onerror = function (e) {
  42098. socket.emit("error", e);
  42099. socket.close();
  42100. };
  42101. xdr.onprogress = function () {
  42102. if (xdr.responseText && xdr.responseText.length > 0) {
  42103. socket.onChunk(200, xdr.responseText);
  42104. }
  42105. };
  42106. xdr.onload = function () {
  42107. if (xdr.responseText && xdr.responseText.length > 0) {
  42108. socket.onChunk(200, xdr.responseText);
  42109. }
  42110. socket.emit("finished", 200);
  42111. socket.close();
  42112. };
  42113. return xdr;
  42114. },
  42115. abortRequest: function (xdr) {
  42116. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42117. xdr.abort();
  42118. }
  42119. };
  42120. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42121. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42122. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42123. var extendStatics = function (d, b) {
  42124. extendStatics = Object.setPrototypeOf ||
  42125. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42126. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42127. return extendStatics(d, b);
  42128. };
  42129. return function (d, b) {
  42130. extendStatics(d, b);
  42131. function __() { this.constructor = d; }
  42132. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42133. };
  42134. })();
  42135. var MAX_BUFFER_LENGTH = 256 * 1024;
  42136. var http_request_HTTPRequest = (function (_super) {
  42137. http_request_extends(HTTPRequest, _super);
  42138. function HTTPRequest(hooks, method, url) {
  42139. var _this = _super.call(this) || this;
  42140. _this.hooks = hooks;
  42141. _this.method = method;
  42142. _this.url = url;
  42143. return _this;
  42144. }
  42145. HTTPRequest.prototype.start = function (payload) {
  42146. var _this = this;
  42147. this.position = 0;
  42148. this.xhr = this.hooks.getRequest(this);
  42149. this.unloader = function () {
  42150. _this.close();
  42151. };
  42152. runtime.addUnloadListener(this.unloader);
  42153. this.xhr.open(this.method, this.url, true);
  42154. if (this.xhr.setRequestHeader) {
  42155. this.xhr.setRequestHeader("Content-Type", "application/json");
  42156. }
  42157. this.xhr.send(payload);
  42158. };
  42159. HTTPRequest.prototype.close = function () {
  42160. if (this.unloader) {
  42161. runtime.removeUnloadListener(this.unloader);
  42162. this.unloader = null;
  42163. }
  42164. if (this.xhr) {
  42165. this.hooks.abortRequest(this.xhr);
  42166. this.xhr = null;
  42167. }
  42168. };
  42169. HTTPRequest.prototype.onChunk = function (status, data) {
  42170. while (true) {
  42171. var chunk = this.advanceBuffer(data);
  42172. if (chunk) {
  42173. this.emit("chunk", { status: status, data: chunk });
  42174. }
  42175. else {
  42176. break;
  42177. }
  42178. }
  42179. if (this.isBufferTooLong(data)) {
  42180. this.emit("buffer_too_long");
  42181. }
  42182. };
  42183. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42184. var unreadData = buffer.slice(this.position);
  42185. var endOfLinePosition = unreadData.indexOf("\n");
  42186. if (endOfLinePosition !== -1) {
  42187. this.position += endOfLinePosition + 1;
  42188. return unreadData.slice(0, endOfLinePosition);
  42189. }
  42190. else {
  42191. return null;
  42192. }
  42193. };
  42194. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42195. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42196. };
  42197. return HTTPRequest;
  42198. }(dispatcher));
  42199. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42200. // CONCATENATED MODULE: ./src/core/http/state.ts
  42201. var State;
  42202. (function (State) {
  42203. State[State["CONNECTING"] = 0] = "CONNECTING";
  42204. State[State["OPEN"] = 1] = "OPEN";
  42205. State[State["CLOSED"] = 3] = "CLOSED";
  42206. })(State || (State = {}));
  42207. /* harmony default export */ var state = (State);
  42208. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42209. var autoIncrement = 1;
  42210. var http_socket_HTTPSocket = (function () {
  42211. function HTTPSocket(hooks, url) {
  42212. this.hooks = hooks;
  42213. this.session = randomNumber(1000) + "/" + randomString(8);
  42214. this.location = getLocation(url);
  42215. this.readyState = state.CONNECTING;
  42216. this.openStream();
  42217. }
  42218. HTTPSocket.prototype.send = function (payload) {
  42219. return this.sendRaw(JSON.stringify([payload]));
  42220. };
  42221. HTTPSocket.prototype.ping = function () {
  42222. this.hooks.sendHeartbeat(this);
  42223. };
  42224. HTTPSocket.prototype.close = function (code, reason) {
  42225. this.onClose(code, reason, true);
  42226. };
  42227. HTTPSocket.prototype.sendRaw = function (payload) {
  42228. if (this.readyState === state.OPEN) {
  42229. try {
  42230. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42231. return true;
  42232. }
  42233. catch (e) {
  42234. return false;
  42235. }
  42236. }
  42237. else {
  42238. return false;
  42239. }
  42240. };
  42241. HTTPSocket.prototype.reconnect = function () {
  42242. this.closeStream();
  42243. this.openStream();
  42244. };
  42245. ;
  42246. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42247. this.closeStream();
  42248. this.readyState = state.CLOSED;
  42249. if (this.onclose) {
  42250. this.onclose({
  42251. code: code,
  42252. reason: reason,
  42253. wasClean: wasClean
  42254. });
  42255. }
  42256. };
  42257. HTTPSocket.prototype.onChunk = function (chunk) {
  42258. if (chunk.status !== 200) {
  42259. return;
  42260. }
  42261. if (this.readyState === state.OPEN) {
  42262. this.onActivity();
  42263. }
  42264. var payload;
  42265. var type = chunk.data.slice(0, 1);
  42266. switch (type) {
  42267. case 'o':
  42268. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42269. this.onOpen(payload);
  42270. break;
  42271. case 'a':
  42272. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42273. for (var i = 0; i < payload.length; i++) {
  42274. this.onEvent(payload[i]);
  42275. }
  42276. break;
  42277. case 'm':
  42278. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42279. this.onEvent(payload);
  42280. break;
  42281. case 'h':
  42282. this.hooks.onHeartbeat(this);
  42283. break;
  42284. case 'c':
  42285. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42286. this.onClose(payload[0], payload[1], true);
  42287. break;
  42288. }
  42289. };
  42290. HTTPSocket.prototype.onOpen = function (options) {
  42291. if (this.readyState === state.CONNECTING) {
  42292. if (options && options.hostname) {
  42293. this.location.base = replaceHost(this.location.base, options.hostname);
  42294. }
  42295. this.readyState = state.OPEN;
  42296. if (this.onopen) {
  42297. this.onopen();
  42298. }
  42299. }
  42300. else {
  42301. this.onClose(1006, "Server lost session", true);
  42302. }
  42303. };
  42304. HTTPSocket.prototype.onEvent = function (event) {
  42305. if (this.readyState === state.OPEN && this.onmessage) {
  42306. this.onmessage({ data: event });
  42307. }
  42308. };
  42309. HTTPSocket.prototype.onActivity = function () {
  42310. if (this.onactivity) {
  42311. this.onactivity();
  42312. }
  42313. };
  42314. HTTPSocket.prototype.onError = function (error) {
  42315. if (this.onerror) {
  42316. this.onerror(error);
  42317. }
  42318. };
  42319. HTTPSocket.prototype.openStream = function () {
  42320. var _this = this;
  42321. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42322. this.stream.bind("chunk", function (chunk) {
  42323. _this.onChunk(chunk);
  42324. });
  42325. this.stream.bind("finished", function (status) {
  42326. _this.hooks.onFinished(_this, status);
  42327. });
  42328. this.stream.bind("buffer_too_long", function () {
  42329. _this.reconnect();
  42330. });
  42331. try {
  42332. this.stream.start();
  42333. }
  42334. catch (error) {
  42335. util.defer(function () {
  42336. _this.onError(error);
  42337. _this.onClose(1006, "Could not start streaming", false);
  42338. });
  42339. }
  42340. };
  42341. HTTPSocket.prototype.closeStream = function () {
  42342. if (this.stream) {
  42343. this.stream.unbind_all();
  42344. this.stream.close();
  42345. this.stream = null;
  42346. }
  42347. };
  42348. return HTTPSocket;
  42349. }());
  42350. function getLocation(url) {
  42351. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42352. return {
  42353. base: parts[1],
  42354. queryString: parts[2]
  42355. };
  42356. }
  42357. function getSendURL(url, session) {
  42358. return url.base + "/" + session + "/xhr_send";
  42359. }
  42360. function getUniqueURL(url) {
  42361. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42362. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42363. }
  42364. function replaceHost(url, hostname) {
  42365. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42366. return urlParts[1] + hostname + urlParts[3];
  42367. }
  42368. function randomNumber(max) {
  42369. return Math.floor(Math.random() * max);
  42370. }
  42371. function randomString(length) {
  42372. var result = [];
  42373. for (var i = 0; i < length; i++) {
  42374. result.push(randomNumber(32).toString(32));
  42375. }
  42376. return result.join('');
  42377. }
  42378. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42379. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42380. var http_streaming_socket_hooks = {
  42381. getReceiveURL: function (url, session) {
  42382. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42383. },
  42384. onHeartbeat: function (socket) {
  42385. socket.sendRaw("[]");
  42386. },
  42387. sendHeartbeat: function (socket) {
  42388. socket.sendRaw("[]");
  42389. },
  42390. onFinished: function (socket, status) {
  42391. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42392. }
  42393. };
  42394. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42395. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42396. var http_polling_socket_hooks = {
  42397. getReceiveURL: function (url, session) {
  42398. return url.base + "/" + session + "/xhr" + url.queryString;
  42399. },
  42400. onHeartbeat: function () {
  42401. },
  42402. sendHeartbeat: function (socket) {
  42403. socket.sendRaw("[]");
  42404. },
  42405. onFinished: function (socket, status) {
  42406. if (status === 200) {
  42407. socket.reconnect();
  42408. }
  42409. else {
  42410. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42411. }
  42412. }
  42413. };
  42414. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42415. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42416. var http_xhr_request_hooks = {
  42417. getRequest: function (socket) {
  42418. var Constructor = runtime.getXHRAPI();
  42419. var xhr = new Constructor();
  42420. xhr.onreadystatechange = xhr.onprogress = function () {
  42421. switch (xhr.readyState) {
  42422. case 3:
  42423. if (xhr.responseText && xhr.responseText.length > 0) {
  42424. socket.onChunk(xhr.status, xhr.responseText);
  42425. }
  42426. break;
  42427. case 4:
  42428. if (xhr.responseText && xhr.responseText.length > 0) {
  42429. socket.onChunk(xhr.status, xhr.responseText);
  42430. }
  42431. socket.emit("finished", xhr.status);
  42432. socket.close();
  42433. break;
  42434. }
  42435. };
  42436. return xhr;
  42437. },
  42438. abortRequest: function (xhr) {
  42439. xhr.onreadystatechange = null;
  42440. xhr.abort();
  42441. }
  42442. };
  42443. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42444. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42445. var HTTP = {
  42446. createStreamingSocket: function (url) {
  42447. return this.createSocket(http_streaming_socket, url);
  42448. },
  42449. createPollingSocket: function (url) {
  42450. return this.createSocket(http_polling_socket, url);
  42451. },
  42452. createSocket: function (hooks, url) {
  42453. return new http_socket(hooks, url);
  42454. },
  42455. createXHR: function (method, url) {
  42456. return this.createRequest(http_xhr_request, method, url);
  42457. },
  42458. createRequest: function (hooks, method, url) {
  42459. return new http_request(hooks, method, url);
  42460. }
  42461. };
  42462. /* harmony default export */ var http_http = (HTTP);
  42463. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42464. http_http.createXDR = function (method, url) {
  42465. return this.createRequest(http_xdomain_request, method, url);
  42466. };
  42467. /* harmony default export */ var web_http_http = (http_http);
  42468. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42469. var Runtime = {
  42470. nextAuthCallbackID: 1,
  42471. auth_callbacks: {},
  42472. ScriptReceivers: ScriptReceivers,
  42473. DependenciesReceivers: DependenciesReceivers,
  42474. getDefaultStrategy: default_strategy,
  42475. Transports: transports_transports,
  42476. transportConnectionInitializer: transport_connection_initializer,
  42477. HTTPFactory: web_http_http,
  42478. TimelineTransport: jsonp_timeline,
  42479. getXHRAPI: function () {
  42480. return window.XMLHttpRequest;
  42481. },
  42482. getWebSocketAPI: function () {
  42483. return window.WebSocket || window.MozWebSocket;
  42484. },
  42485. setup: function (PusherClass) {
  42486. var _this = this;
  42487. window.Pusher = PusherClass;
  42488. var initializeOnDocumentBody = function () {
  42489. _this.onDocumentBody(PusherClass.ready);
  42490. };
  42491. if (!window.JSON) {
  42492. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42493. }
  42494. else {
  42495. initializeOnDocumentBody();
  42496. }
  42497. },
  42498. getDocument: function () {
  42499. return document;
  42500. },
  42501. getProtocol: function () {
  42502. return this.getDocument().location.protocol;
  42503. },
  42504. getAuthorizers: function () {
  42505. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42506. },
  42507. onDocumentBody: function (callback) {
  42508. var _this = this;
  42509. if (document.body) {
  42510. callback();
  42511. }
  42512. else {
  42513. setTimeout(function () {
  42514. _this.onDocumentBody(callback);
  42515. }, 0);
  42516. }
  42517. },
  42518. createJSONPRequest: function (url, data) {
  42519. return new jsonp_request(url, data);
  42520. },
  42521. createScriptRequest: function (src) {
  42522. return new script_request(src);
  42523. },
  42524. getLocalStorage: function () {
  42525. try {
  42526. return window.localStorage;
  42527. }
  42528. catch (e) {
  42529. return undefined;
  42530. }
  42531. },
  42532. createXHR: function () {
  42533. if (this.getXHRAPI()) {
  42534. return this.createXMLHttpRequest();
  42535. }
  42536. else {
  42537. return this.createMicrosoftXHR();
  42538. }
  42539. },
  42540. createXMLHttpRequest: function () {
  42541. var Constructor = this.getXHRAPI();
  42542. return new Constructor();
  42543. },
  42544. createMicrosoftXHR: function () {
  42545. return new ActiveXObject("Microsoft.XMLHTTP");
  42546. },
  42547. getNetwork: function () {
  42548. return net_info_Network;
  42549. },
  42550. createWebSocket: function (url) {
  42551. var Constructor = this.getWebSocketAPI();
  42552. return new Constructor(url);
  42553. },
  42554. createSocketRequest: function (method, url) {
  42555. if (this.isXHRSupported()) {
  42556. return this.HTTPFactory.createXHR(method, url);
  42557. }
  42558. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42559. return this.HTTPFactory.createXDR(method, url);
  42560. }
  42561. else {
  42562. throw "Cross-origin HTTP requests are not supported";
  42563. }
  42564. },
  42565. isXHRSupported: function () {
  42566. var Constructor = this.getXHRAPI();
  42567. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42568. },
  42569. isXDRSupported: function (useTLS) {
  42570. var protocol = useTLS ? "https:" : "http:";
  42571. var documentProtocol = this.getProtocol();
  42572. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42573. },
  42574. addUnloadListener: function (listener) {
  42575. if (window.addEventListener !== undefined) {
  42576. window.addEventListener("unload", listener, false);
  42577. }
  42578. else if (window.attachEvent !== undefined) {
  42579. window.attachEvent("onunload", listener);
  42580. }
  42581. },
  42582. removeUnloadListener: function (listener) {
  42583. if (window.addEventListener !== undefined) {
  42584. window.removeEventListener("unload", listener, false);
  42585. }
  42586. else if (window.detachEvent !== undefined) {
  42587. window.detachEvent("onunload", listener);
  42588. }
  42589. }
  42590. };
  42591. /* harmony default export */ var runtime = (Runtime);
  42592. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42593. var TimelineLevel;
  42594. (function (TimelineLevel) {
  42595. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42596. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42597. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42598. })(TimelineLevel || (TimelineLevel = {}));
  42599. /* harmony default export */ var timeline_level = (TimelineLevel);
  42600. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42601. var timeline_Timeline = (function () {
  42602. function Timeline(key, session, options) {
  42603. this.key = key;
  42604. this.session = session;
  42605. this.events = [];
  42606. this.options = options || {};
  42607. this.sent = 0;
  42608. this.uniqueID = 0;
  42609. }
  42610. Timeline.prototype.log = function (level, event) {
  42611. if (level <= this.options.level) {
  42612. this.events.push(extend({}, event, { timestamp: util.now() }));
  42613. if (this.options.limit && this.events.length > this.options.limit) {
  42614. this.events.shift();
  42615. }
  42616. }
  42617. };
  42618. Timeline.prototype.error = function (event) {
  42619. this.log(timeline_level.ERROR, event);
  42620. };
  42621. Timeline.prototype.info = function (event) {
  42622. this.log(timeline_level.INFO, event);
  42623. };
  42624. Timeline.prototype.debug = function (event) {
  42625. this.log(timeline_level.DEBUG, event);
  42626. };
  42627. Timeline.prototype.isEmpty = function () {
  42628. return this.events.length === 0;
  42629. };
  42630. Timeline.prototype.send = function (sendfn, callback) {
  42631. var _this = this;
  42632. var data = extend({
  42633. session: this.session,
  42634. bundle: this.sent + 1,
  42635. key: this.key,
  42636. lib: "js",
  42637. version: this.options.version,
  42638. cluster: this.options.cluster,
  42639. features: this.options.features,
  42640. timeline: this.events
  42641. }, this.options.params);
  42642. this.events = [];
  42643. sendfn(data, function (error, result) {
  42644. if (!error) {
  42645. _this.sent++;
  42646. }
  42647. if (callback) {
  42648. callback(error, result);
  42649. }
  42650. });
  42651. return true;
  42652. };
  42653. Timeline.prototype.generateUniqueID = function () {
  42654. this.uniqueID++;
  42655. return this.uniqueID;
  42656. };
  42657. return Timeline;
  42658. }());
  42659. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42660. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42661. var transport_strategy_TransportStrategy = (function () {
  42662. function TransportStrategy(name, priority, transport, options) {
  42663. this.name = name;
  42664. this.priority = priority;
  42665. this.transport = transport;
  42666. this.options = options || {};
  42667. }
  42668. TransportStrategy.prototype.isSupported = function () {
  42669. return this.transport.isSupported({
  42670. useTLS: this.options.useTLS
  42671. });
  42672. };
  42673. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42674. var _this = this;
  42675. if (!this.isSupported()) {
  42676. return failAttempt(new UnsupportedStrategy(), callback);
  42677. }
  42678. else if (this.priority < minPriority) {
  42679. return failAttempt(new TransportPriorityTooLow(), callback);
  42680. }
  42681. var connected = false;
  42682. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42683. var handshake = null;
  42684. var onInitialized = function () {
  42685. transport.unbind("initialized", onInitialized);
  42686. transport.connect();
  42687. };
  42688. var onOpen = function () {
  42689. handshake = factory.createHandshake(transport, function (result) {
  42690. connected = true;
  42691. unbindListeners();
  42692. callback(null, result);
  42693. });
  42694. };
  42695. var onError = function (error) {
  42696. unbindListeners();
  42697. callback(error);
  42698. };
  42699. var onClosed = function () {
  42700. unbindListeners();
  42701. var serializedTransport;
  42702. serializedTransport = safeJSONStringify(transport);
  42703. callback(new TransportClosed(serializedTransport));
  42704. };
  42705. var unbindListeners = function () {
  42706. transport.unbind("initialized", onInitialized);
  42707. transport.unbind("open", onOpen);
  42708. transport.unbind("error", onError);
  42709. transport.unbind("closed", onClosed);
  42710. };
  42711. transport.bind("initialized", onInitialized);
  42712. transport.bind("open", onOpen);
  42713. transport.bind("error", onError);
  42714. transport.bind("closed", onClosed);
  42715. transport.initialize();
  42716. return {
  42717. abort: function () {
  42718. if (connected) {
  42719. return;
  42720. }
  42721. unbindListeners();
  42722. if (handshake) {
  42723. handshake.close();
  42724. }
  42725. else {
  42726. transport.close();
  42727. }
  42728. },
  42729. forceMinPriority: function (p) {
  42730. if (connected) {
  42731. return;
  42732. }
  42733. if (_this.priority < p) {
  42734. if (handshake) {
  42735. handshake.close();
  42736. }
  42737. else {
  42738. transport.close();
  42739. }
  42740. }
  42741. }
  42742. };
  42743. };
  42744. return TransportStrategy;
  42745. }());
  42746. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42747. function failAttempt(error, callback) {
  42748. util.defer(function () {
  42749. callback(error);
  42750. });
  42751. return {
  42752. abort: function () { },
  42753. forceMinPriority: function () { }
  42754. };
  42755. }
  42756. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42757. var strategy_builder_Transports = runtime.Transports;
  42758. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42759. var transportClass = strategy_builder_Transports[type];
  42760. if (!transportClass) {
  42761. throw new UnsupportedTransport(type);
  42762. }
  42763. var enabled = (!config.enabledTransports ||
  42764. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42765. (!config.disabledTransports ||
  42766. arrayIndexOf(config.disabledTransports, name) === -1);
  42767. var transport;
  42768. if (enabled) {
  42769. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42770. key: config.key,
  42771. useTLS: config.useTLS,
  42772. timeline: config.timeline,
  42773. ignoreNullOrigin: config.ignoreNullOrigin
  42774. }, options));
  42775. }
  42776. else {
  42777. transport = strategy_builder_UnsupportedStrategy;
  42778. }
  42779. return transport;
  42780. };
  42781. var strategy_builder_UnsupportedStrategy = {
  42782. isSupported: function () {
  42783. return false;
  42784. },
  42785. connect: function (_, callback) {
  42786. var deferred = util.defer(function () {
  42787. callback(new UnsupportedStrategy());
  42788. });
  42789. return {
  42790. abort: function () {
  42791. deferred.ensureAborted();
  42792. },
  42793. forceMinPriority: function () { }
  42794. };
  42795. }
  42796. };
  42797. // CONCATENATED MODULE: ./src/core/config.ts
  42798. var getGlobalConfig = function () {
  42799. return {
  42800. wsHost: defaults.host,
  42801. wsPort: defaults.ws_port,
  42802. wssPort: defaults.wss_port,
  42803. wsPath: defaults.ws_path,
  42804. httpHost: defaults.sockjs_host,
  42805. httpPort: defaults.sockjs_http_port,
  42806. httpsPort: defaults.sockjs_https_port,
  42807. httpPath: defaults.sockjs_path,
  42808. statsHost: defaults.stats_host,
  42809. authEndpoint: defaults.channel_auth_endpoint,
  42810. authTransport: defaults.channel_auth_transport,
  42811. activity_timeout: defaults.activity_timeout,
  42812. pong_timeout: defaults.pong_timeout,
  42813. unavailable_timeout: defaults.unavailable_timeout
  42814. };
  42815. };
  42816. var getClusterConfig = function (clusterName) {
  42817. return {
  42818. wsHost: 'ws-' + clusterName + '.pusher.com',
  42819. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42820. };
  42821. };
  42822. // CONCATENATED MODULE: ./src/core/pusher.ts
  42823. var pusher_Pusher = (function () {
  42824. function Pusher(app_key, options) {
  42825. var _this = this;
  42826. checkAppKey(app_key);
  42827. options = options || {};
  42828. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42829. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42830. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42831. }
  42832. this.key = app_key;
  42833. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42834. this.channels = factory.createChannels();
  42835. this.global_emitter = new dispatcher();
  42836. this.sessionID = Math.floor(Math.random() * 1000000000);
  42837. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42838. cluster: this.config.cluster,
  42839. features: Pusher.getClientFeatures(),
  42840. params: this.config.timelineParams || {},
  42841. limit: 50,
  42842. level: timeline_level.INFO,
  42843. version: defaults.VERSION
  42844. });
  42845. if (!this.config.disableStats) {
  42846. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42847. host: this.config.statsHost,
  42848. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42849. });
  42850. }
  42851. var getStrategy = function (options) {
  42852. var config = extend({}, _this.config, options);
  42853. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42854. };
  42855. this.connection = factory.createConnectionManager(this.key, extend({
  42856. getStrategy: getStrategy,
  42857. timeline: this.timeline,
  42858. activityTimeout: this.config.activity_timeout,
  42859. pongTimeout: this.config.pong_timeout,
  42860. unavailableTimeout: this.config.unavailable_timeout
  42861. }, this.config, { useTLS: this.shouldUseTLS() }));
  42862. this.connection.bind('connected', function () {
  42863. _this.subscribeAll();
  42864. if (_this.timelineSender) {
  42865. _this.timelineSender.send(_this.connection.isUsingTLS());
  42866. }
  42867. });
  42868. this.connection.bind('message', function (event) {
  42869. var eventName = event.event;
  42870. var internal = eventName.indexOf('pusher_internal:') === 0;
  42871. if (event.channel) {
  42872. var channel = _this.channel(event.channel);
  42873. if (channel) {
  42874. channel.handleEvent(event);
  42875. }
  42876. }
  42877. if (!internal) {
  42878. _this.global_emitter.emit(event.event, event.data);
  42879. }
  42880. });
  42881. this.connection.bind('connecting', function () {
  42882. _this.channels.disconnect();
  42883. });
  42884. this.connection.bind('disconnected', function () {
  42885. _this.channels.disconnect();
  42886. });
  42887. this.connection.bind('error', function (err) {
  42888. logger.warn(err);
  42889. });
  42890. Pusher.instances.push(this);
  42891. this.timeline.info({ instances: Pusher.instances.length });
  42892. if (Pusher.isReady) {
  42893. this.connect();
  42894. }
  42895. }
  42896. Pusher.ready = function () {
  42897. Pusher.isReady = true;
  42898. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42899. Pusher.instances[i].connect();
  42900. }
  42901. };
  42902. Pusher.getClientFeatures = function () {
  42903. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42904. return t.isSupported({});
  42905. }));
  42906. };
  42907. Pusher.prototype.channel = function (name) {
  42908. return this.channels.find(name);
  42909. };
  42910. Pusher.prototype.allChannels = function () {
  42911. return this.channels.all();
  42912. };
  42913. Pusher.prototype.connect = function () {
  42914. this.connection.connect();
  42915. if (this.timelineSender) {
  42916. if (!this.timelineSenderTimer) {
  42917. var usingTLS = this.connection.isUsingTLS();
  42918. var timelineSender = this.timelineSender;
  42919. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42920. timelineSender.send(usingTLS);
  42921. });
  42922. }
  42923. }
  42924. };
  42925. Pusher.prototype.disconnect = function () {
  42926. this.connection.disconnect();
  42927. if (this.timelineSenderTimer) {
  42928. this.timelineSenderTimer.ensureAborted();
  42929. this.timelineSenderTimer = null;
  42930. }
  42931. };
  42932. Pusher.prototype.bind = function (event_name, callback, context) {
  42933. this.global_emitter.bind(event_name, callback, context);
  42934. return this;
  42935. };
  42936. Pusher.prototype.unbind = function (event_name, callback, context) {
  42937. this.global_emitter.unbind(event_name, callback, context);
  42938. return this;
  42939. };
  42940. Pusher.prototype.bind_global = function (callback) {
  42941. this.global_emitter.bind_global(callback);
  42942. return this;
  42943. };
  42944. Pusher.prototype.unbind_global = function (callback) {
  42945. this.global_emitter.unbind_global(callback);
  42946. return this;
  42947. };
  42948. Pusher.prototype.unbind_all = function (callback) {
  42949. this.global_emitter.unbind_all();
  42950. return this;
  42951. };
  42952. Pusher.prototype.subscribeAll = function () {
  42953. var channelName;
  42954. for (channelName in this.channels.channels) {
  42955. if (this.channels.channels.hasOwnProperty(channelName)) {
  42956. this.subscribe(channelName);
  42957. }
  42958. }
  42959. };
  42960. Pusher.prototype.subscribe = function (channel_name) {
  42961. var channel = this.channels.add(channel_name, this);
  42962. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42963. channel.reinstateSubscription();
  42964. }
  42965. else if (!channel.subscriptionPending &&
  42966. this.connection.state === 'connected') {
  42967. channel.subscribe();
  42968. }
  42969. return channel;
  42970. };
  42971. Pusher.prototype.unsubscribe = function (channel_name) {
  42972. var channel = this.channels.find(channel_name);
  42973. if (channel && channel.subscriptionPending) {
  42974. channel.cancelSubscription();
  42975. }
  42976. else {
  42977. channel = this.channels.remove(channel_name);
  42978. if (channel && this.connection.state === 'connected') {
  42979. channel.unsubscribe();
  42980. }
  42981. }
  42982. };
  42983. Pusher.prototype.send_event = function (event_name, data, channel) {
  42984. return this.connection.send_event(event_name, data, channel);
  42985. };
  42986. Pusher.prototype.shouldUseTLS = function () {
  42987. if (runtime.getProtocol() === 'https:') {
  42988. return true;
  42989. }
  42990. else if (this.config.forceTLS === true) {
  42991. return true;
  42992. }
  42993. else {
  42994. return Boolean(this.config.encrypted);
  42995. }
  42996. };
  42997. Pusher.instances = [];
  42998. Pusher.isReady = false;
  42999. Pusher.logToConsole = false;
  43000. Pusher.Runtime = runtime;
  43001. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43002. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43003. Pusher.auth_callbacks = runtime.auth_callbacks;
  43004. return Pusher;
  43005. }());
  43006. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43007. function checkAppKey(key) {
  43008. if (key === null || key === undefined) {
  43009. throw 'You must pass your app key when you instantiate Pusher.';
  43010. }
  43011. }
  43012. runtime.setup(pusher_Pusher);
  43013. /***/ })
  43014. /******/ ]);
  43015. });
  43016. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43017. /***/ }),
  43018. /***/ "./node_modules/setimmediate/setImmediate.js":
  43019. /*!***************************************************!*\
  43020. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43021. \***************************************************/
  43022. /*! no static exports found */
  43023. /***/ (function(module, exports, __webpack_require__) {
  43024. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43025. "use strict";
  43026. if (global.setImmediate) {
  43027. return;
  43028. }
  43029. var nextHandle = 1; // Spec says greater than zero
  43030. var tasksByHandle = {};
  43031. var currentlyRunningATask = false;
  43032. var doc = global.document;
  43033. var registerImmediate;
  43034. function setImmediate(callback) {
  43035. // Callback can either be a function or a string
  43036. if (typeof callback !== "function") {
  43037. callback = new Function("" + callback);
  43038. }
  43039. // Copy function arguments
  43040. var args = new Array(arguments.length - 1);
  43041. for (var i = 0; i < args.length; i++) {
  43042. args[i] = arguments[i + 1];
  43043. }
  43044. // Store and register the task
  43045. var task = { callback: callback, args: args };
  43046. tasksByHandle[nextHandle] = task;
  43047. registerImmediate(nextHandle);
  43048. return nextHandle++;
  43049. }
  43050. function clearImmediate(handle) {
  43051. delete tasksByHandle[handle];
  43052. }
  43053. function run(task) {
  43054. var callback = task.callback;
  43055. var args = task.args;
  43056. switch (args.length) {
  43057. case 0:
  43058. callback();
  43059. break;
  43060. case 1:
  43061. callback(args[0]);
  43062. break;
  43063. case 2:
  43064. callback(args[0], args[1]);
  43065. break;
  43066. case 3:
  43067. callback(args[0], args[1], args[2]);
  43068. break;
  43069. default:
  43070. callback.apply(undefined, args);
  43071. break;
  43072. }
  43073. }
  43074. function runIfPresent(handle) {
  43075. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43076. // So if we're currently running a task, we'll need to delay this invocation.
  43077. if (currentlyRunningATask) {
  43078. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43079. // "too much recursion" error.
  43080. setTimeout(runIfPresent, 0, handle);
  43081. } else {
  43082. var task = tasksByHandle[handle];
  43083. if (task) {
  43084. currentlyRunningATask = true;
  43085. try {
  43086. run(task);
  43087. } finally {
  43088. clearImmediate(handle);
  43089. currentlyRunningATask = false;
  43090. }
  43091. }
  43092. }
  43093. }
  43094. function installNextTickImplementation() {
  43095. registerImmediate = function(handle) {
  43096. process.nextTick(function () { runIfPresent(handle); });
  43097. };
  43098. }
  43099. function canUsePostMessage() {
  43100. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43101. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43102. if (global.postMessage && !global.importScripts) {
  43103. var postMessageIsAsynchronous = true;
  43104. var oldOnMessage = global.onmessage;
  43105. global.onmessage = function() {
  43106. postMessageIsAsynchronous = false;
  43107. };
  43108. global.postMessage("", "*");
  43109. global.onmessage = oldOnMessage;
  43110. return postMessageIsAsynchronous;
  43111. }
  43112. }
  43113. function installPostMessageImplementation() {
  43114. // Installs an event handler on `global` for the `message` event: see
  43115. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43116. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43117. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43118. var onGlobalMessage = function(event) {
  43119. if (event.source === global &&
  43120. typeof event.data === "string" &&
  43121. event.data.indexOf(messagePrefix) === 0) {
  43122. runIfPresent(+event.data.slice(messagePrefix.length));
  43123. }
  43124. };
  43125. if (global.addEventListener) {
  43126. global.addEventListener("message", onGlobalMessage, false);
  43127. } else {
  43128. global.attachEvent("onmessage", onGlobalMessage);
  43129. }
  43130. registerImmediate = function(handle) {
  43131. global.postMessage(messagePrefix + handle, "*");
  43132. };
  43133. }
  43134. function installMessageChannelImplementation() {
  43135. var channel = new MessageChannel();
  43136. channel.port1.onmessage = function(event) {
  43137. var handle = event.data;
  43138. runIfPresent(handle);
  43139. };
  43140. registerImmediate = function(handle) {
  43141. channel.port2.postMessage(handle);
  43142. };
  43143. }
  43144. function installReadyStateChangeImplementation() {
  43145. var html = doc.documentElement;
  43146. registerImmediate = function(handle) {
  43147. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43148. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43149. var script = doc.createElement("script");
  43150. script.onreadystatechange = function () {
  43151. runIfPresent(handle);
  43152. script.onreadystatechange = null;
  43153. html.removeChild(script);
  43154. script = null;
  43155. };
  43156. html.appendChild(script);
  43157. };
  43158. }
  43159. function installSetTimeoutImplementation() {
  43160. registerImmediate = function(handle) {
  43161. setTimeout(runIfPresent, 0, handle);
  43162. };
  43163. }
  43164. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43165. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43166. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43167. // Don't get fooled by e.g. browserify environments.
  43168. if ({}.toString.call(global.process) === "[object process]") {
  43169. // For Node.js before 0.9
  43170. installNextTickImplementation();
  43171. } else if (canUsePostMessage()) {
  43172. // For non-IE10 modern browsers
  43173. installPostMessageImplementation();
  43174. } else if (global.MessageChannel) {
  43175. // For web workers, where supported
  43176. installMessageChannelImplementation();
  43177. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43178. // For IE 6–8
  43179. installReadyStateChangeImplementation();
  43180. } else {
  43181. // For older browsers
  43182. installSetTimeoutImplementation();
  43183. }
  43184. attachTo.setImmediate = setImmediate;
  43185. attachTo.clearImmediate = clearImmediate;
  43186. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43187. /* 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")))
  43188. /***/ }),
  43189. /***/ "./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&":
  43190. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43191. !*** ./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& ***!
  43192. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43193. /*! no static exports found */
  43194. /***/ (function(module, exports, __webpack_require__) {
  43195. 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&");
  43196. if(typeof content === 'string') content = [[module.i, content, '']];
  43197. var transform;
  43198. var insertInto;
  43199. var options = {"hmr":true}
  43200. options.transform = transform
  43201. options.insertInto = undefined;
  43202. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43203. if(content.locals) module.exports = content.locals;
  43204. if(false) {}
  43205. /***/ }),
  43206. /***/ "./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&":
  43207. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43208. !*** ./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& ***!
  43209. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43210. /*! no static exports found */
  43211. /***/ (function(module, exports, __webpack_require__) {
  43212. 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&");
  43213. if(typeof content === 'string') content = [[module.i, content, '']];
  43214. var transform;
  43215. var insertInto;
  43216. var options = {"hmr":true}
  43217. options.transform = transform
  43218. options.insertInto = undefined;
  43219. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43220. if(content.locals) module.exports = content.locals;
  43221. if(false) {}
  43222. /***/ }),
  43223. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43224. /*!****************************************************!*\
  43225. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43226. \****************************************************/
  43227. /*! no static exports found */
  43228. /***/ (function(module, exports, __webpack_require__) {
  43229. /*
  43230. MIT License http://www.opensource.org/licenses/mit-license.php
  43231. Author Tobias Koppers @sokra
  43232. */
  43233. var stylesInDom = {};
  43234. var memoize = function (fn) {
  43235. var memo;
  43236. return function () {
  43237. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43238. return memo;
  43239. };
  43240. };
  43241. var isOldIE = memoize(function () {
  43242. // Test for IE <= 9 as proposed by Browserhacks
  43243. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43244. // Tests for existence of standard globals is to allow style-loader
  43245. // to operate correctly into non-standard environments
  43246. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43247. return window && document && document.all && !window.atob;
  43248. });
  43249. var getTarget = function (target, parent) {
  43250. if (parent){
  43251. return parent.querySelector(target);
  43252. }
  43253. return document.querySelector(target);
  43254. };
  43255. var getElement = (function (fn) {
  43256. var memo = {};
  43257. return function(target, parent) {
  43258. // If passing function in options, then use it for resolve "head" element.
  43259. // Useful for Shadow Root style i.e
  43260. // {
  43261. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43262. // }
  43263. if (typeof target === 'function') {
  43264. return target();
  43265. }
  43266. if (typeof memo[target] === "undefined") {
  43267. var styleTarget = getTarget.call(this, target, parent);
  43268. // Special case to return head of iframe instead of iframe itself
  43269. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43270. try {
  43271. // This will throw an exception if access to iframe is blocked
  43272. // due to cross-origin restrictions
  43273. styleTarget = styleTarget.contentDocument.head;
  43274. } catch(e) {
  43275. styleTarget = null;
  43276. }
  43277. }
  43278. memo[target] = styleTarget;
  43279. }
  43280. return memo[target]
  43281. };
  43282. })();
  43283. var singleton = null;
  43284. var singletonCounter = 0;
  43285. var stylesInsertedAtTop = [];
  43286. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43287. module.exports = function(list, options) {
  43288. if (typeof DEBUG !== "undefined" && DEBUG) {
  43289. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43290. }
  43291. options = options || {};
  43292. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43293. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43294. // tags it will allow on a page
  43295. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43296. // By default, add <style> tags to the <head> element
  43297. if (!options.insertInto) options.insertInto = "head";
  43298. // By default, add <style> tags to the bottom of the target
  43299. if (!options.insertAt) options.insertAt = "bottom";
  43300. var styles = listToStyles(list, options);
  43301. addStylesToDom(styles, options);
  43302. return function update (newList) {
  43303. var mayRemove = [];
  43304. for (var i = 0; i < styles.length; i++) {
  43305. var item = styles[i];
  43306. var domStyle = stylesInDom[item.id];
  43307. domStyle.refs--;
  43308. mayRemove.push(domStyle);
  43309. }
  43310. if(newList) {
  43311. var newStyles = listToStyles(newList, options);
  43312. addStylesToDom(newStyles, options);
  43313. }
  43314. for (var i = 0; i < mayRemove.length; i++) {
  43315. var domStyle = mayRemove[i];
  43316. if(domStyle.refs === 0) {
  43317. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43318. delete stylesInDom[domStyle.id];
  43319. }
  43320. }
  43321. };
  43322. };
  43323. function addStylesToDom (styles, options) {
  43324. for (var i = 0; i < styles.length; i++) {
  43325. var item = styles[i];
  43326. var domStyle = stylesInDom[item.id];
  43327. if(domStyle) {
  43328. domStyle.refs++;
  43329. for(var j = 0; j < domStyle.parts.length; j++) {
  43330. domStyle.parts[j](item.parts[j]);
  43331. }
  43332. for(; j < item.parts.length; j++) {
  43333. domStyle.parts.push(addStyle(item.parts[j], options));
  43334. }
  43335. } else {
  43336. var parts = [];
  43337. for(var j = 0; j < item.parts.length; j++) {
  43338. parts.push(addStyle(item.parts[j], options));
  43339. }
  43340. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43341. }
  43342. }
  43343. }
  43344. function listToStyles (list, options) {
  43345. var styles = [];
  43346. var newStyles = {};
  43347. for (var i = 0; i < list.length; i++) {
  43348. var item = list[i];
  43349. var id = options.base ? item[0] + options.base : item[0];
  43350. var css = item[1];
  43351. var media = item[2];
  43352. var sourceMap = item[3];
  43353. var part = {css: css, media: media, sourceMap: sourceMap};
  43354. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43355. else newStyles[id].parts.push(part);
  43356. }
  43357. return styles;
  43358. }
  43359. function insertStyleElement (options, style) {
  43360. var target = getElement(options.insertInto)
  43361. if (!target) {
  43362. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43363. }
  43364. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43365. if (options.insertAt === "top") {
  43366. if (!lastStyleElementInsertedAtTop) {
  43367. target.insertBefore(style, target.firstChild);
  43368. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43369. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43370. } else {
  43371. target.appendChild(style);
  43372. }
  43373. stylesInsertedAtTop.push(style);
  43374. } else if (options.insertAt === "bottom") {
  43375. target.appendChild(style);
  43376. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43377. var nextSibling = getElement(options.insertAt.before, target);
  43378. target.insertBefore(style, nextSibling);
  43379. } else {
  43380. 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");
  43381. }
  43382. }
  43383. function removeStyleElement (style) {
  43384. if (style.parentNode === null) return false;
  43385. style.parentNode.removeChild(style);
  43386. var idx = stylesInsertedAtTop.indexOf(style);
  43387. if(idx >= 0) {
  43388. stylesInsertedAtTop.splice(idx, 1);
  43389. }
  43390. }
  43391. function createStyleElement (options) {
  43392. var style = document.createElement("style");
  43393. if(options.attrs.type === undefined) {
  43394. options.attrs.type = "text/css";
  43395. }
  43396. if(options.attrs.nonce === undefined) {
  43397. var nonce = getNonce();
  43398. if (nonce) {
  43399. options.attrs.nonce = nonce;
  43400. }
  43401. }
  43402. addAttrs(style, options.attrs);
  43403. insertStyleElement(options, style);
  43404. return style;
  43405. }
  43406. function createLinkElement (options) {
  43407. var link = document.createElement("link");
  43408. if(options.attrs.type === undefined) {
  43409. options.attrs.type = "text/css";
  43410. }
  43411. options.attrs.rel = "stylesheet";
  43412. addAttrs(link, options.attrs);
  43413. insertStyleElement(options, link);
  43414. return link;
  43415. }
  43416. function addAttrs (el, attrs) {
  43417. Object.keys(attrs).forEach(function (key) {
  43418. el.setAttribute(key, attrs[key]);
  43419. });
  43420. }
  43421. function getNonce() {
  43422. if (false) {}
  43423. return __webpack_require__.nc;
  43424. }
  43425. function addStyle (obj, options) {
  43426. var style, update, remove, result;
  43427. // If a transform function was defined, run it on the css
  43428. if (options.transform && obj.css) {
  43429. result = typeof options.transform === 'function'
  43430. ? options.transform(obj.css)
  43431. : options.transform.default(obj.css);
  43432. if (result) {
  43433. // If transform returns a value, use that instead of the original css.
  43434. // This allows running runtime transformations on the css.
  43435. obj.css = result;
  43436. } else {
  43437. // If the transform function returns a falsy value, don't add this css.
  43438. // This allows conditional loading of css
  43439. return function() {
  43440. // noop
  43441. };
  43442. }
  43443. }
  43444. if (options.singleton) {
  43445. var styleIndex = singletonCounter++;
  43446. style = singleton || (singleton = createStyleElement(options));
  43447. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43448. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43449. } else if (
  43450. obj.sourceMap &&
  43451. typeof URL === "function" &&
  43452. typeof URL.createObjectURL === "function" &&
  43453. typeof URL.revokeObjectURL === "function" &&
  43454. typeof Blob === "function" &&
  43455. typeof btoa === "function"
  43456. ) {
  43457. style = createLinkElement(options);
  43458. update = updateLink.bind(null, style, options);
  43459. remove = function () {
  43460. removeStyleElement(style);
  43461. if(style.href) URL.revokeObjectURL(style.href);
  43462. };
  43463. } else {
  43464. style = createStyleElement(options);
  43465. update = applyToTag.bind(null, style);
  43466. remove = function () {
  43467. removeStyleElement(style);
  43468. };
  43469. }
  43470. update(obj);
  43471. return function updateStyle (newObj) {
  43472. if (newObj) {
  43473. if (
  43474. newObj.css === obj.css &&
  43475. newObj.media === obj.media &&
  43476. newObj.sourceMap === obj.sourceMap
  43477. ) {
  43478. return;
  43479. }
  43480. update(obj = newObj);
  43481. } else {
  43482. remove();
  43483. }
  43484. };
  43485. }
  43486. var replaceText = (function () {
  43487. var textStore = [];
  43488. return function (index, replacement) {
  43489. textStore[index] = replacement;
  43490. return textStore.filter(Boolean).join('\n');
  43491. };
  43492. })();
  43493. function applyToSingletonTag (style, index, remove, obj) {
  43494. var css = remove ? "" : obj.css;
  43495. if (style.styleSheet) {
  43496. style.styleSheet.cssText = replaceText(index, css);
  43497. } else {
  43498. var cssNode = document.createTextNode(css);
  43499. var childNodes = style.childNodes;
  43500. if (childNodes[index]) style.removeChild(childNodes[index]);
  43501. if (childNodes.length) {
  43502. style.insertBefore(cssNode, childNodes[index]);
  43503. } else {
  43504. style.appendChild(cssNode);
  43505. }
  43506. }
  43507. }
  43508. function applyToTag (style, obj) {
  43509. var css = obj.css;
  43510. var media = obj.media;
  43511. if(media) {
  43512. style.setAttribute("media", media)
  43513. }
  43514. if(style.styleSheet) {
  43515. style.styleSheet.cssText = css;
  43516. } else {
  43517. while(style.firstChild) {
  43518. style.removeChild(style.firstChild);
  43519. }
  43520. style.appendChild(document.createTextNode(css));
  43521. }
  43522. }
  43523. function updateLink (link, options, obj) {
  43524. var css = obj.css;
  43525. var sourceMap = obj.sourceMap;
  43526. /*
  43527. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43528. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43529. on by default. Otherwise default to the convertToAbsoluteUrls option
  43530. directly
  43531. */
  43532. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43533. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43534. css = fixUrls(css);
  43535. }
  43536. if (sourceMap) {
  43537. // http://stackoverflow.com/a/26603875
  43538. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43539. }
  43540. var blob = new Blob([css], { type: "text/css" });
  43541. var oldSrc = link.href;
  43542. link.href = URL.createObjectURL(blob);
  43543. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43544. }
  43545. /***/ }),
  43546. /***/ "./node_modules/style-loader/lib/urls.js":
  43547. /*!***********************************************!*\
  43548. !*** ./node_modules/style-loader/lib/urls.js ***!
  43549. \***********************************************/
  43550. /*! no static exports found */
  43551. /***/ (function(module, exports) {
  43552. /**
  43553. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43554. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43555. * bundle instead of the current page.
  43556. *
  43557. * One solution is to only use full urls, but that may be impossible.
  43558. *
  43559. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43560. *
  43561. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43562. *
  43563. */
  43564. module.exports = function (css) {
  43565. // get current location
  43566. var location = typeof window !== "undefined" && window.location;
  43567. if (!location) {
  43568. throw new Error("fixUrls requires window.location");
  43569. }
  43570. // blank or null?
  43571. if (!css || typeof css !== "string") {
  43572. return css;
  43573. }
  43574. var baseUrl = location.protocol + "//" + location.host;
  43575. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43576. // convert each url(...)
  43577. /*
  43578. This regular expression is just a way to recursively match brackets within
  43579. a string.
  43580. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43581. ( = Start a capturing group
  43582. (?: = Start a non-capturing group
  43583. [^)(] = Match anything that isn't a parentheses
  43584. | = OR
  43585. \( = Match a start parentheses
  43586. (?: = Start another non-capturing groups
  43587. [^)(]+ = Match anything that isn't a parentheses
  43588. | = OR
  43589. \( = Match a start parentheses
  43590. [^)(]* = Match anything that isn't a parentheses
  43591. \) = Match a end parentheses
  43592. ) = End Group
  43593. *\) = Match anything and then a close parens
  43594. ) = Close non-capturing group
  43595. * = Match anything
  43596. ) = Close capturing group
  43597. \) = Match a close parens
  43598. /gi = Get all matches, not the first. Be case insensitive.
  43599. */
  43600. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43601. // strip quotes (if they exist)
  43602. var unquotedOrigUrl = origUrl
  43603. .trim()
  43604. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43605. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43606. // already a full url? no change
  43607. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43608. return fullMatch;
  43609. }
  43610. // convert the url to a full url
  43611. var newUrl;
  43612. if (unquotedOrigUrl.indexOf("//") === 0) {
  43613. //TODO: should we add protocol?
  43614. newUrl = unquotedOrigUrl;
  43615. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43616. // path should be relative to the base url
  43617. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43618. } else {
  43619. // path should be relative to current directory
  43620. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43621. }
  43622. // send back the fixed url(...)
  43623. return "url(" + JSON.stringify(newUrl) + ")";
  43624. });
  43625. // send back the fixed css
  43626. return fixedCss;
  43627. };
  43628. /***/ }),
  43629. /***/ "./node_modules/timers-browserify/main.js":
  43630. /*!************************************************!*\
  43631. !*** ./node_modules/timers-browserify/main.js ***!
  43632. \************************************************/
  43633. /*! no static exports found */
  43634. /***/ (function(module, exports, __webpack_require__) {
  43635. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43636. (typeof self !== "undefined" && self) ||
  43637. window;
  43638. var apply = Function.prototype.apply;
  43639. // DOM APIs, for completeness
  43640. exports.setTimeout = function() {
  43641. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43642. };
  43643. exports.setInterval = function() {
  43644. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43645. };
  43646. exports.clearTimeout =
  43647. exports.clearInterval = function(timeout) {
  43648. if (timeout) {
  43649. timeout.close();
  43650. }
  43651. };
  43652. function Timeout(id, clearFn) {
  43653. this._id = id;
  43654. this._clearFn = clearFn;
  43655. }
  43656. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43657. Timeout.prototype.close = function() {
  43658. this._clearFn.call(scope, this._id);
  43659. };
  43660. // Does not start the time, just sets up the members needed.
  43661. exports.enroll = function(item, msecs) {
  43662. clearTimeout(item._idleTimeoutId);
  43663. item._idleTimeout = msecs;
  43664. };
  43665. exports.unenroll = function(item) {
  43666. clearTimeout(item._idleTimeoutId);
  43667. item._idleTimeout = -1;
  43668. };
  43669. exports._unrefActive = exports.active = function(item) {
  43670. clearTimeout(item._idleTimeoutId);
  43671. var msecs = item._idleTimeout;
  43672. if (msecs >= 0) {
  43673. item._idleTimeoutId = setTimeout(function onTimeout() {
  43674. if (item._onTimeout)
  43675. item._onTimeout();
  43676. }, msecs);
  43677. }
  43678. };
  43679. // setimmediate attaches itself to the global object
  43680. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43681. // On some exotic environments, it's not clear which object `setimmediate` was
  43682. // able to install onto. Search each possibility in the same order as the
  43683. // `setimmediate` library.
  43684. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43685. (typeof global !== "undefined" && global.setImmediate) ||
  43686. (this && this.setImmediate);
  43687. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43688. (typeof global !== "undefined" && global.clearImmediate) ||
  43689. (this && this.clearImmediate);
  43690. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43691. /***/ }),
  43692. /***/ "./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&":
  43693. /*!************************************************************************************************************************************************************************************************************!*\
  43694. !*** ./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& ***!
  43695. \************************************************************************************************************************************************************************************************************/
  43696. /*! exports provided: render, staticRenderFns */
  43697. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43698. "use strict";
  43699. __webpack_require__.r(__webpack_exports__);
  43700. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43701. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43702. var render = function() {
  43703. var _vm = this
  43704. var _h = _vm.$createElement
  43705. var _c = _vm._self._c || _h
  43706. return _c(
  43707. "div",
  43708. [
  43709. _c("asset-info-edit-modal", {
  43710. attrs: {
  43711. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  43712. "populate-with": _vm.asset
  43713. }
  43714. }),
  43715. _vm._v(" "),
  43716. _c("h4", { staticClass: "text-center" }, [
  43717. _vm._v(
  43718. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  43719. ),
  43720. _c("small", { staticClass: "text-muted" }, [
  43721. _vm._v(_vm._s(this.asset.pcnickname))
  43722. ])
  43723. ]),
  43724. _vm._v(" "),
  43725. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  43726. _vm._v(" "),
  43727. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  43728. _vm._v(" "),
  43729. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  43730. _vm._v(" "),
  43731. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  43732. _vm._v(" "),
  43733. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  43734. _vm._v(" "),
  43735. _c(
  43736. "button",
  43737. {
  43738. staticClass: "btn btn-primary",
  43739. attrs: {
  43740. type: "button",
  43741. "data-toggle": "modal",
  43742. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  43743. }
  43744. },
  43745. [_vm._v("Edit")]
  43746. )
  43747. ],
  43748. 1
  43749. )
  43750. }
  43751. var staticRenderFns = []
  43752. render._withStripped = true
  43753. /***/ }),
  43754. /***/ "./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&":
  43755. /*!*********************************************************************************************************************************************************************************************************************!*\
  43756. !*** ./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& ***!
  43757. \*********************************************************************************************************************************************************************************************************************/
  43758. /*! exports provided: render, staticRenderFns */
  43759. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43760. "use strict";
  43761. __webpack_require__.r(__webpack_exports__);
  43762. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43763. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43764. var render = function() {
  43765. var _vm = this
  43766. var _h = _vm.$createElement
  43767. var _c = _vm._self._c || _h
  43768. return _c(
  43769. "modal",
  43770. {
  43771. attrs: {
  43772. id: _vm.modalId,
  43773. tabindex: "-1",
  43774. role: "dialog",
  43775. "aria-labelledby": _vm.modalId + "Label"
  43776. }
  43777. },
  43778. [
  43779. _c(
  43780. "h5",
  43781. {
  43782. staticClass: "modal-title",
  43783. attrs: { slot: "header", id: _vm.modalId + "Label" },
  43784. slot: "header"
  43785. },
  43786. [_vm._v("\n Edit Work Order Information\n ")]
  43787. ),
  43788. _vm._v(" "),
  43789. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43790. _c("div", { staticClass: "form-group" }, [
  43791. _c("label", { attrs: { for: "manufacturer" } }, [
  43792. _vm._v("Manufacturer")
  43793. ]),
  43794. _vm._v(" "),
  43795. _c("input", {
  43796. directives: [
  43797. {
  43798. name: "model",
  43799. rawName: "v-model",
  43800. value: _vm.asset.pcmanu,
  43801. expression: "asset.pcmanu"
  43802. }
  43803. ],
  43804. staticClass: "form-control",
  43805. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  43806. domProps: { value: _vm.asset.pcmanu },
  43807. on: {
  43808. input: function($event) {
  43809. if ($event.target.composing) {
  43810. return
  43811. }
  43812. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  43813. }
  43814. }
  43815. })
  43816. ]),
  43817. _vm._v(" "),
  43818. _c("div", { staticClass: "form-group" }, [
  43819. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43820. _vm._v(" "),
  43821. _c("input", {
  43822. directives: [
  43823. {
  43824. name: "model",
  43825. rawName: "v-model",
  43826. value: _vm.asset.pcmake,
  43827. expression: "asset.pcmake"
  43828. }
  43829. ],
  43830. staticClass: "form-control",
  43831. attrs: { type: "text", name: "make", id: "make" },
  43832. domProps: { value: _vm.asset.pcmake },
  43833. on: {
  43834. input: function($event) {
  43835. if ($event.target.composing) {
  43836. return
  43837. }
  43838. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  43839. }
  43840. }
  43841. })
  43842. ]),
  43843. _vm._v(" "),
  43844. _c("div", { staticClass: "form-group" }, [
  43845. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43846. _vm._v(" "),
  43847. _c("input", {
  43848. directives: [
  43849. {
  43850. name: "model",
  43851. rawName: "v-model",
  43852. value: _vm.asset.pcnickname,
  43853. expression: "asset.pcnickname"
  43854. }
  43855. ],
  43856. staticClass: "form-control",
  43857. attrs: { type: "text", name: "nickname", id: "nickname" },
  43858. domProps: { value: _vm.asset.pcnickname },
  43859. on: {
  43860. input: function($event) {
  43861. if ($event.target.composing) {
  43862. return
  43863. }
  43864. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  43865. }
  43866. }
  43867. })
  43868. ]),
  43869. _vm._v(" "),
  43870. _c("div", { staticClass: "form-group" }, [
  43871. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43872. _vm._v(" "),
  43873. _c("input", {
  43874. directives: [
  43875. {
  43876. name: "model",
  43877. rawName: "v-model",
  43878. value: _vm.asset.pcextra[2],
  43879. expression: "asset.pcextra[2]"
  43880. }
  43881. ],
  43882. staticClass: "form-control",
  43883. attrs: { type: "text", name: "os", id: "os" },
  43884. domProps: { value: _vm.asset.pcextra[2] },
  43885. on: {
  43886. input: function($event) {
  43887. if ($event.target.composing) {
  43888. return
  43889. }
  43890. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  43891. }
  43892. }
  43893. })
  43894. ]),
  43895. _vm._v(" "),
  43896. _c("div", { staticClass: "form-group" }, [
  43897. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  43898. _vm._v(" "),
  43899. _c("input", {
  43900. directives: [
  43901. {
  43902. name: "model",
  43903. rawName: "v-model",
  43904. value: _vm.asset.pcextra[104],
  43905. expression: "asset.pcextra[104]"
  43906. }
  43907. ],
  43908. staticClass: "form-control",
  43909. attrs: { type: "text", id: "serial", name: "serial" },
  43910. domProps: { value: _vm.asset.pcextra[104] },
  43911. on: {
  43912. input: function($event) {
  43913. if ($event.target.composing) {
  43914. return
  43915. }
  43916. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  43917. }
  43918. }
  43919. })
  43920. ]),
  43921. _vm._v(" "),
  43922. _c("div", { staticClass: "form-group" }, [
  43923. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43924. _vm._v(" "),
  43925. _c("input", {
  43926. directives: [
  43927. {
  43928. name: "model",
  43929. rawName: "v-model",
  43930. value: _vm.asset.pcextra[101],
  43931. expression: "asset.pcextra[101]"
  43932. }
  43933. ],
  43934. staticClass: "form-control",
  43935. attrs: { type: "text", id: "cpu", name: "cpu" },
  43936. domProps: { value: _vm.asset.pcextra[101] },
  43937. on: {
  43938. input: function($event) {
  43939. if ($event.target.composing) {
  43940. return
  43941. }
  43942. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  43943. }
  43944. }
  43945. })
  43946. ]),
  43947. _vm._v(" "),
  43948. _c("div", { staticClass: "form-group" }, [
  43949. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43950. _vm._v(" "),
  43951. _c("input", {
  43952. directives: [
  43953. {
  43954. name: "model",
  43955. rawName: "v-model",
  43956. value: _vm.asset.pcextra[100],
  43957. expression: "asset.pcextra[100]"
  43958. }
  43959. ],
  43960. staticClass: "form-control",
  43961. attrs: { type: "text", name: "ram", id: "ram" },
  43962. domProps: { value: _vm.asset.pcextra[100] },
  43963. on: {
  43964. input: function($event) {
  43965. if ($event.target.composing) {
  43966. return
  43967. }
  43968. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  43969. }
  43970. }
  43971. })
  43972. ]),
  43973. _vm._v(" "),
  43974. _c("div", { staticClass: "form-group" }, [
  43975. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43976. _vm._v(" "),
  43977. _c("input", {
  43978. directives: [
  43979. {
  43980. name: "model",
  43981. rawName: "v-model",
  43982. value: _vm.asset.pcextra[4],
  43983. expression: "asset.pcextra[4]"
  43984. }
  43985. ],
  43986. staticClass: "form-control",
  43987. attrs: { type: "text", name: "graphics", id: "grapics" },
  43988. domProps: { value: _vm.asset.pcextra[4] },
  43989. on: {
  43990. input: function($event) {
  43991. if ($event.target.composing) {
  43992. return
  43993. }
  43994. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  43995. }
  43996. }
  43997. })
  43998. ])
  43999. ]),
  44000. _vm._v(" "),
  44001. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44002. _c(
  44003. "button",
  44004. {
  44005. staticClass: "btn btn-secondary",
  44006. attrs: { type: "button", "data-dismiss": "modal" }
  44007. },
  44008. [_vm._v("Close")]
  44009. ),
  44010. _vm._v(" "),
  44011. _c(
  44012. "button",
  44013. {
  44014. staticClass: "btn btn-primary",
  44015. attrs: { type: "button" },
  44016. on: {
  44017. click: function($event) {
  44018. return _vm.updateAsset()
  44019. }
  44020. }
  44021. },
  44022. [
  44023. !_vm.assetSaving
  44024. ? _c("div", [_vm._v("Save")])
  44025. : _c("circle-spinner", { attrs: { size: 2 } })
  44026. ],
  44027. 1
  44028. )
  44029. ])
  44030. ]
  44031. )
  44032. }
  44033. var staticRenderFns = []
  44034. render._withStripped = true
  44035. /***/ }),
  44036. /***/ "./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&":
  44037. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44038. !*** ./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& ***!
  44039. \*****************************************************************************************************************************************************************************************************************************/
  44040. /*! exports provided: render, staticRenderFns */
  44041. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44042. "use strict";
  44043. __webpack_require__.r(__webpack_exports__);
  44044. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44045. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44046. var render = function() {
  44047. var _vm = this
  44048. var _h = _vm.$createElement
  44049. var _c = _vm._self._c || _h
  44050. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44051. _c("div", { staticClass: "input-group" }, [
  44052. _c("input", {
  44053. directives: [
  44054. {
  44055. name: "model",
  44056. rawName: "v-model",
  44057. value: _vm.searchText,
  44058. expression: "searchText"
  44059. }
  44060. ],
  44061. staticClass: "form-control",
  44062. attrs: { type: "text" },
  44063. domProps: { value: _vm.searchText },
  44064. on: {
  44065. input: [
  44066. function($event) {
  44067. if ($event.target.composing) {
  44068. return
  44069. }
  44070. _vm.searchText = $event.target.value
  44071. },
  44072. _vm.searchChanged
  44073. ]
  44074. }
  44075. }),
  44076. _vm._v(" "),
  44077. _c("div", { staticClass: "form-group-append" }, [
  44078. _c(
  44079. "a",
  44080. {
  44081. staticClass: "toggle input-group-text bg-primary text-light",
  44082. on: {
  44083. mousedown: function($event) {
  44084. $event.preventDefault()
  44085. },
  44086. click: function($event) {
  44087. return _vm.setOpen(!_vm.open)
  44088. }
  44089. }
  44090. },
  44091. [
  44092. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44093. _vm._v(" "),
  44094. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44095. ]
  44096. )
  44097. ])
  44098. ]),
  44099. _vm._v(" "),
  44100. _c(
  44101. "ul",
  44102. { staticClass: "suggestion-list list-unstyled" },
  44103. _vm._l(_vm.matches, function(suggestion, index) {
  44104. return _c(
  44105. "li",
  44106. {
  44107. key: index,
  44108. on: {
  44109. mousedown: function($event) {
  44110. $event.preventDefault()
  44111. },
  44112. click: function($event) {
  44113. return _vm.suggestionSelected(suggestion)
  44114. }
  44115. }
  44116. },
  44117. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44118. )
  44119. }),
  44120. 0
  44121. )
  44122. ])
  44123. }
  44124. var staticRenderFns = []
  44125. render._withStripped = true
  44126. /***/ }),
  44127. /***/ "./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&":
  44128. /*!****************************************************************************************************************************************************************************************************************************!*\
  44129. !*** ./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& ***!
  44130. \****************************************************************************************************************************************************************************************************************************/
  44131. /*! exports provided: render, staticRenderFns */
  44132. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44133. "use strict";
  44134. __webpack_require__.r(__webpack_exports__);
  44135. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44136. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44137. var render = function() {
  44138. var _vm = this
  44139. var _h = _vm.$createElement
  44140. var _c = _vm._self._c || _h
  44141. return _c(
  44142. "div",
  44143. {
  44144. staticClass: "loader",
  44145. style: {
  44146. fontSize: _vm.size + "px",
  44147. borderLeft: "1.1em solid " + _vm.color
  44148. }
  44149. },
  44150. [_vm._v("Loading...")]
  44151. )
  44152. }
  44153. var staticRenderFns = []
  44154. render._withStripped = true
  44155. /***/ }),
  44156. /***/ "./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&":
  44157. /*!********************************************************************************************************************************************************************************************************!*\
  44158. !*** ./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& ***!
  44159. \********************************************************************************************************************************************************************************************************/
  44160. /*! exports provided: render, staticRenderFns */
  44161. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44162. "use strict";
  44163. __webpack_require__.r(__webpack_exports__);
  44164. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44166. var render = function() {
  44167. var _vm = this
  44168. var _h = _vm.$createElement
  44169. var _c = _vm._self._c || _h
  44170. return _c("div", { staticClass: "modal fade" }, [
  44171. _c(
  44172. "div",
  44173. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44174. [
  44175. _c("div", { staticClass: "modal-content" }, [
  44176. _c(
  44177. "div",
  44178. { staticClass: "modal-header" },
  44179. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44180. 2
  44181. ),
  44182. _vm._v(" "),
  44183. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44184. _vm._v(" "),
  44185. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44186. ])
  44187. ]
  44188. )
  44189. ])
  44190. }
  44191. var staticRenderFns = [
  44192. function() {
  44193. var _vm = this
  44194. var _h = _vm.$createElement
  44195. var _c = _vm._self._c || _h
  44196. return _c(
  44197. "button",
  44198. {
  44199. staticClass: "close",
  44200. attrs: {
  44201. type: "button",
  44202. "data-dismiss": "modal",
  44203. "aria-label": "Close"
  44204. }
  44205. },
  44206. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44207. )
  44208. }
  44209. ]
  44210. render._withStripped = true
  44211. /***/ }),
  44212. /***/ "./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&":
  44213. /*!******************************************************************************************************************************************************************************************************************!*\
  44214. !*** ./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& ***!
  44215. \******************************************************************************************************************************************************************************************************************/
  44216. /*! exports provided: render, staticRenderFns */
  44217. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44218. "use strict";
  44219. __webpack_require__.r(__webpack_exports__);
  44220. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44221. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44222. var render = function() {
  44223. var _vm = this
  44224. var _h = _vm.$createElement
  44225. var _c = _vm._self._c || _h
  44226. return _c(
  44227. "modal",
  44228. {
  44229. attrs: {
  44230. id: _vm.id,
  44231. tabindex: "-1",
  44232. role: "dialog",
  44233. "aria-labelledby": _vm.id + "Label"
  44234. }
  44235. },
  44236. [
  44237. _c(
  44238. "h5",
  44239. {
  44240. staticClass: "modal-title",
  44241. attrs: { slot: "header", id: _vm.id + "Label" },
  44242. slot: "header"
  44243. },
  44244. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44245. ),
  44246. _vm._v(" "),
  44247. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44248. _c(
  44249. "div",
  44250. { staticClass: "form-group" },
  44251. [
  44252. _c("label", { attrs: { for: "probdesc" } }, [
  44253. _vm._v("Problem Description")
  44254. ]),
  44255. _vm._v(" "),
  44256. _c("textarea", {
  44257. directives: [
  44258. {
  44259. name: "model",
  44260. rawName: "v-model",
  44261. value: _vm.data.probdesc,
  44262. expression: "data.probdesc"
  44263. }
  44264. ],
  44265. class: {
  44266. "form-control": true,
  44267. "is-invalid": _vm.errors.probdesc
  44268. },
  44269. attrs: { id: "probdesc", name: "probdesc" },
  44270. domProps: { value: _vm.data.probdesc },
  44271. on: {
  44272. input: function($event) {
  44273. if ($event.target.composing) {
  44274. return
  44275. }
  44276. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44277. }
  44278. }
  44279. }),
  44280. _vm._v(" "),
  44281. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44282. ],
  44283. 1
  44284. ),
  44285. _vm._v(" "),
  44286. _c(
  44287. "div",
  44288. { staticClass: "form-group" },
  44289. [
  44290. _c("label", { attrs: { for: "suggested" } }, [
  44291. _vm._v("Suggested Solution")
  44292. ]),
  44293. _vm._v(" "),
  44294. _c("textarea", {
  44295. directives: [
  44296. {
  44297. name: "model",
  44298. rawName: "v-model",
  44299. value: _vm.data.suggested,
  44300. expression: "data.suggested"
  44301. }
  44302. ],
  44303. class: {
  44304. "form-control": true,
  44305. "is-invalid": _vm.errors.suggested
  44306. },
  44307. attrs: { id: "suggested", name: "suggested" },
  44308. domProps: { value: _vm.data.suggested },
  44309. on: {
  44310. input: function($event) {
  44311. if ($event.target.composing) {
  44312. return
  44313. }
  44314. _vm.$set(_vm.data, "suggested", $event.target.value)
  44315. }
  44316. }
  44317. }),
  44318. _vm._v(" "),
  44319. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44320. ],
  44321. 1
  44322. ),
  44323. _vm._v(" "),
  44324. _c(
  44325. "div",
  44326. { staticClass: "form-group" },
  44327. [
  44328. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44329. _vm._v(" "),
  44330. _c("autocomplete-custom-dropdown", {
  44331. attrs: { options: _vm.storeList, value: this.store },
  44332. model: {
  44333. value: _vm.store,
  44334. callback: function($$v) {
  44335. _vm.store = $$v
  44336. },
  44337. expression: "store"
  44338. }
  44339. })
  44340. ],
  44341. 1
  44342. )
  44343. ]),
  44344. _vm._v(" "),
  44345. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44346. _c(
  44347. "button",
  44348. {
  44349. staticClass: "btn btn-secondary",
  44350. attrs: { type: "button", "data-dismiss": "modal" }
  44351. },
  44352. [_vm._v("Close")]
  44353. ),
  44354. _vm._v(" "),
  44355. _c(
  44356. "button",
  44357. {
  44358. staticClass: "btn btn-primary",
  44359. attrs: { type: "button" },
  44360. on: {
  44361. click: function($event) {
  44362. return _vm.updateWorkOrder()
  44363. }
  44364. }
  44365. },
  44366. [_vm._v("Save")]
  44367. )
  44368. ])
  44369. ]
  44370. )
  44371. }
  44372. var staticRenderFns = []
  44373. render._withStripped = true
  44374. /***/ }),
  44375. /***/ "./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&":
  44376. /*!****************************************************************************************************************************************************************************************************************!*\
  44377. !*** ./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& ***!
  44378. \****************************************************************************************************************************************************************************************************************/
  44379. /*! exports provided: render, staticRenderFns */
  44380. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44381. "use strict";
  44382. __webpack_require__.r(__webpack_exports__);
  44383. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44384. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44385. var render = function() {
  44386. var _vm = this
  44387. var _h = _vm.$createElement
  44388. var _c = _vm._self._c || _h
  44389. return _c(
  44390. "div",
  44391. [
  44392. _c("wo-info-edit-modal", {
  44393. attrs: {
  44394. "modal-id": "workordereditModal",
  44395. "populate-with": _vm.workOrder,
  44396. "store-list": this.storeList
  44397. }
  44398. }),
  44399. _vm._v(" "),
  44400. _c("p", [
  44401. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44402. _vm._v(" "),
  44403. _c("span", {
  44404. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  44405. })
  44406. ]),
  44407. _vm._v(" "),
  44408. _c("p", [
  44409. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44410. _vm._v(" "),
  44411. _c("span", {
  44412. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  44413. })
  44414. ]),
  44415. _vm._v(" "),
  44416. _c("p", [
  44417. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44418. _vm._v(" "),
  44419. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  44420. ]),
  44421. _vm._v(" "),
  44422. _c("p", [
  44423. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44424. _vm._v(" "),
  44425. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  44426. ]),
  44427. _vm._v(" "),
  44428. _c("p", [
  44429. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44430. _vm._v(" "),
  44431. _c(
  44432. "span",
  44433. {
  44434. staticClass: "dashed-underline",
  44435. attrs: {
  44436. "data-toggle": "tooltip",
  44437. "data-placement": "bottom",
  44438. title: this.getHRDate(_vm.workOrder.dropdate)
  44439. }
  44440. },
  44441. [
  44442. _vm._v(
  44443. "\n " +
  44444. _vm._s(
  44445. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  44446. ) +
  44447. " days ago\n "
  44448. )
  44449. ]
  44450. )
  44451. ]),
  44452. _vm._v(" "),
  44453. _c("p", [
  44454. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44455. _vm._v(" "),
  44456. !this.isZero(_vm.workOrder.pickupdate)
  44457. ? _c(
  44458. "span",
  44459. {
  44460. staticClass: "dashed-underline",
  44461. attrs: {
  44462. "data-toggle": "tooltip",
  44463. "data-placement": "bottom",
  44464. title: this.getHRDate(_vm.workOrder.pickupdate)
  44465. }
  44466. },
  44467. [
  44468. _vm._v(
  44469. "\n " +
  44470. _vm._s(
  44471. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  44472. ) +
  44473. " days ago\n "
  44474. )
  44475. ]
  44476. )
  44477. : _vm._e()
  44478. ]),
  44479. _vm._v(" "),
  44480. _c(
  44481. "button",
  44482. {
  44483. staticClass: "btn btn-primary",
  44484. attrs: {
  44485. type: "button",
  44486. "data-toggle": "modal",
  44487. "data-target": "#workordereditModal"
  44488. }
  44489. },
  44490. [_vm._v("Edit")]
  44491. )
  44492. ],
  44493. 1
  44494. )
  44495. }
  44496. var staticRenderFns = []
  44497. render._withStripped = true
  44498. /***/ }),
  44499. /***/ "./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&":
  44500. /*!*************************************************************************************************************************************************************************************************!*\
  44501. !*** ./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& ***!
  44502. \*************************************************************************************************************************************************************************************************/
  44503. /*! exports provided: render, staticRenderFns */
  44504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44505. "use strict";
  44506. __webpack_require__.r(__webpack_exports__);
  44507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44509. var render = function() {
  44510. var _vm = this
  44511. var _h = _vm.$createElement
  44512. var _c = _vm._self._c || _h
  44513. return _c("div", [
  44514. _c(
  44515. "nav",
  44516. {
  44517. staticClass:
  44518. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  44519. },
  44520. [
  44521. _c(
  44522. "div",
  44523. { staticClass: "container-fluid" },
  44524. [
  44525. _c(
  44526. "router-link",
  44527. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  44528. [_vm._v("\n UPCCRT\n ")]
  44529. ),
  44530. _vm._v(" "),
  44531. _vm._m(0),
  44532. _vm._v(" "),
  44533. _c(
  44534. "div",
  44535. {
  44536. staticClass: "collapse navbar-collapse",
  44537. attrs: { id: "navbarSupportedContent" }
  44538. },
  44539. [
  44540. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  44541. _vm._m(1),
  44542. _vm._v(" "),
  44543. _vm._m(2),
  44544. _vm._v(" "),
  44545. _c(
  44546. "li",
  44547. { staticClass: "nav-item" },
  44548. [
  44549. _c(
  44550. "router-link",
  44551. {
  44552. staticClass: "nav-link",
  44553. attrs: { to: { name: "dashboard" } }
  44554. },
  44555. [
  44556. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  44557. _vm._v(" "),
  44558. _c(
  44559. "span",
  44560. { staticClass: "d-none d-sm-block d-md-inline" },
  44561. [_vm._v("Dashboard")]
  44562. )
  44563. ]
  44564. )
  44565. ],
  44566. 1
  44567. ),
  44568. _vm._v(" "),
  44569. _vm._m(3)
  44570. ]),
  44571. _vm._v(" "),
  44572. _c(
  44573. "ul",
  44574. { staticClass: "navbar-nav ml-auto" },
  44575. [
  44576. !_vm.isLoggedIn
  44577. ? _c(
  44578. "router-link",
  44579. {
  44580. staticClass: "nav-link",
  44581. attrs: { to: { name: "login" } }
  44582. },
  44583. [_vm._v("Login")]
  44584. )
  44585. : _vm._e(),
  44586. _vm._v(" "),
  44587. _vm.isLoggedIn
  44588. ? _c("li", { staticClass: "nav-link" }, [
  44589. _vm._v(_vm._s(_vm.username))
  44590. ])
  44591. : _vm._e(),
  44592. _vm._v(" "),
  44593. _vm.isLoggedIn
  44594. ? _c(
  44595. "router-link",
  44596. {
  44597. staticClass: "nav-link",
  44598. attrs: { to: { name: "home" } }
  44599. },
  44600. [_vm._v("Home")]
  44601. )
  44602. : _vm._e()
  44603. ],
  44604. 1
  44605. )
  44606. ]
  44607. )
  44608. ],
  44609. 1
  44610. )
  44611. ]
  44612. ),
  44613. _vm._v(" "),
  44614. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  44615. ])
  44616. }
  44617. var staticRenderFns = [
  44618. function() {
  44619. var _vm = this
  44620. var _h = _vm.$createElement
  44621. var _c = _vm._self._c || _h
  44622. return _c(
  44623. "button",
  44624. {
  44625. staticClass: "navbar-toggler",
  44626. attrs: {
  44627. type: "button",
  44628. "data-toggle": "collapse",
  44629. "data-target": "#navbarSupportedContent",
  44630. "aria-controls": "navbarSupportedContent",
  44631. "aria-expanded": "false"
  44632. }
  44633. },
  44634. [_c("span", { staticClass: "navbar-toggler-icon" })]
  44635. )
  44636. },
  44637. function() {
  44638. var _vm = this
  44639. var _h = _vm.$createElement
  44640. var _c = _vm._self._c || _h
  44641. return _c("li", { staticClass: "nav-item" }, [
  44642. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44643. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  44644. _vm._v(" "),
  44645. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44646. _vm._v("Check-In")
  44647. ])
  44648. ])
  44649. ])
  44650. },
  44651. function() {
  44652. var _vm = this
  44653. var _h = _vm.$createElement
  44654. var _c = _vm._self._c || _h
  44655. return _c("li", { staticClass: "nav-item" }, [
  44656. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44657. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44658. _vm._v(" "),
  44659. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44660. _vm._v("Check-Out")
  44661. ])
  44662. ])
  44663. ])
  44664. },
  44665. function() {
  44666. var _vm = this
  44667. var _h = _vm.$createElement
  44668. var _c = _vm._self._c || _h
  44669. return _c("li", { staticClass: "nav-item" }, [
  44670. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44671. _c("i", { staticClass: "fas fa-chart-bar" }),
  44672. _vm._v(" "),
  44673. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44674. _vm._v("Reports")
  44675. ])
  44676. ])
  44677. ])
  44678. }
  44679. ]
  44680. render._withStripped = true
  44681. /***/ }),
  44682. /***/ "./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&":
  44683. /*!*******************************************************************************************************************************************************************************************************!*\
  44684. !*** ./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& ***!
  44685. \*******************************************************************************************************************************************************************************************************/
  44686. /*! exports provided: render, staticRenderFns */
  44687. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44688. "use strict";
  44689. __webpack_require__.r(__webpack_exports__);
  44690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44692. var render = function() {
  44693. var _vm = this
  44694. var _h = _vm.$createElement
  44695. var _c = _vm._self._c || _h
  44696. return _c("div", { staticClass: "container" }, [
  44697. _c("div", { staticClass: "row justify-content-center" }, [
  44698. !_vm.isLoading
  44699. ? _c(
  44700. "div",
  44701. { staticClass: "col-md-12" },
  44702. _vm._l(_vm.workOrders, function(workOrder, index) {
  44703. return _c(
  44704. "div",
  44705. { key: workOrder.woid, staticClass: "col-md-4" },
  44706. [
  44707. _c("div", { staticClass: "card" }, [
  44708. _c(
  44709. "div",
  44710. { staticClass: "card-header" },
  44711. [
  44712. _c(
  44713. "router-link",
  44714. {
  44715. staticClass: "h4 card-title",
  44716. attrs: {
  44717. to: {
  44718. name: "workorders",
  44719. params: { id: workOrder.woid }
  44720. }
  44721. }
  44722. },
  44723. [_vm._v(_vm._s(workOrder.woid))]
  44724. )
  44725. ],
  44726. 1
  44727. ),
  44728. _vm._v(" "),
  44729. _c("div", { staticClass: "card-body card-body-dark" }, [
  44730. _c("div", [
  44731. _vm._v(
  44732. "\n " +
  44733. _vm._s(workOrder.probdesc) +
  44734. "\n "
  44735. )
  44736. ]),
  44737. _vm._v(" "),
  44738. _c("div", [
  44739. _vm._v(
  44740. "\n " +
  44741. _vm._s(workOrder.suggested) +
  44742. "\n "
  44743. )
  44744. ])
  44745. ])
  44746. ])
  44747. ]
  44748. )
  44749. }),
  44750. 0
  44751. )
  44752. : _c(
  44753. "div",
  44754. { staticClass: "col-md-12" },
  44755. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  44756. 1
  44757. )
  44758. ])
  44759. ])
  44760. }
  44761. var staticRenderFns = []
  44762. render._withStripped = true
  44763. /***/ }),
  44764. /***/ "./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&":
  44765. /*!***************************************************************************************************************************************************************************************************!*\
  44766. !*** ./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& ***!
  44767. \***************************************************************************************************************************************************************************************************/
  44768. /*! exports provided: render, staticRenderFns */
  44769. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44770. "use strict";
  44771. __webpack_require__.r(__webpack_exports__);
  44772. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44773. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44774. var render = function() {
  44775. var _vm = this
  44776. var _h = _vm.$createElement
  44777. var _c = _vm._self._c || _h
  44778. return _c("div", { staticClass: "container" }, [
  44779. _c("div", { staticClass: "row justify-content-center" }, [
  44780. _c("div", { staticClass: "col-md-8" }, [
  44781. _c("div", { staticClass: "card card-default" }, [
  44782. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  44783. _vm._v(" "),
  44784. _c("div", { staticClass: "card-body" }, [
  44785. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  44786. _c("div", { staticClass: "form-group row" }, [
  44787. _c(
  44788. "label",
  44789. {
  44790. staticClass: "col-sm-4 col-form-label text-md-right",
  44791. attrs: { for: "username" }
  44792. },
  44793. [_vm._v("Username")]
  44794. ),
  44795. _vm._v(" "),
  44796. _c("div", { staticClass: "col-md-6" }, [
  44797. _c("input", {
  44798. directives: [
  44799. {
  44800. name: "model",
  44801. rawName: "v-model",
  44802. value: _vm.username,
  44803. expression: "username"
  44804. }
  44805. ],
  44806. staticClass: "form-control",
  44807. attrs: {
  44808. id: "username",
  44809. type: "username",
  44810. required: "",
  44811. autofocus: ""
  44812. },
  44813. domProps: { value: _vm.username },
  44814. on: {
  44815. input: function($event) {
  44816. if ($event.target.composing) {
  44817. return
  44818. }
  44819. _vm.username = $event.target.value
  44820. }
  44821. }
  44822. })
  44823. ])
  44824. ]),
  44825. _vm._v(" "),
  44826. _c("div", { staticClass: "form-group row" }, [
  44827. _c(
  44828. "label",
  44829. {
  44830. staticClass: "col-md-4 col-form-label text-md-right",
  44831. attrs: { for: "password" }
  44832. },
  44833. [_vm._v("Password")]
  44834. ),
  44835. _vm._v(" "),
  44836. _c("div", { staticClass: "col-md-6" }, [
  44837. _c("input", {
  44838. directives: [
  44839. {
  44840. name: "model",
  44841. rawName: "v-model",
  44842. value: _vm.password,
  44843. expression: "password"
  44844. }
  44845. ],
  44846. staticClass: "form-control",
  44847. attrs: { id: "password", type: "password", required: "" },
  44848. domProps: { value: _vm.password },
  44849. on: {
  44850. input: function($event) {
  44851. if ($event.target.composing) {
  44852. return
  44853. }
  44854. _vm.password = $event.target.value
  44855. }
  44856. }
  44857. })
  44858. ])
  44859. ]),
  44860. _vm._v(" "),
  44861. _c("div", { staticClass: "form-group row mb-0" }, [
  44862. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  44863. _c(
  44864. "button",
  44865. {
  44866. staticClass: "btn btn-primary",
  44867. attrs: { type: "submit" },
  44868. on: { click: _vm.handleSubmit }
  44869. },
  44870. [
  44871. _vm._v(
  44872. "\n Login\n "
  44873. )
  44874. ]
  44875. )
  44876. ])
  44877. ])
  44878. ])
  44879. ])
  44880. ])
  44881. ])
  44882. ])
  44883. ])
  44884. }
  44885. var staticRenderFns = []
  44886. render._withStripped = true
  44887. /***/ }),
  44888. /***/ "./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&":
  44889. /*!*****************************************************************************************************************************************************************************************************************!*\
  44890. !*** ./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& ***!
  44891. \*****************************************************************************************************************************************************************************************************************/
  44892. /*! exports provided: render, staticRenderFns */
  44893. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44894. "use strict";
  44895. __webpack_require__.r(__webpack_exports__);
  44896. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44897. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44898. var render = function() {
  44899. var _vm = this
  44900. var _h = _vm.$createElement
  44901. var _c = _vm._self._c || _h
  44902. return _vm._m(0)
  44903. }
  44904. var staticRenderFns = [
  44905. function() {
  44906. var _vm = this
  44907. var _h = _vm.$createElement
  44908. var _c = _vm._self._c || _h
  44909. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  44910. _c("div", { staticClass: "content" }, [
  44911. _c("div", { staticClass: "m-b-md" }, [
  44912. _c("h2", { staticClass: "title m-b-md" }, [
  44913. _vm._v("\n UPCCRT\n ")
  44914. ]),
  44915. _vm._v(" "),
  44916. _c("h3", [
  44917. _vm._v(
  44918. "\n University PC Care Repair Tracker\n "
  44919. )
  44920. ])
  44921. ])
  44922. ])
  44923. ])
  44924. }
  44925. ]
  44926. render._withStripped = true
  44927. /***/ }),
  44928. /***/ "./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&":
  44929. /*!*******************************************************************************************************************************************************************************************************!*\
  44930. !*** ./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& ***!
  44931. \*******************************************************************************************************************************************************************************************************/
  44932. /*! exports provided: render, staticRenderFns */
  44933. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44934. "use strict";
  44935. __webpack_require__.r(__webpack_exports__);
  44936. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44937. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44938. var render = function() {
  44939. var _vm = this
  44940. var _h = _vm.$createElement
  44941. var _c = _vm._self._c || _h
  44942. return _c("div", { staticClass: "container-fluid" }, [
  44943. _c("div", { staticClass: "row my-3" }, [
  44944. _c("div", { staticClass: "col-lg-6" }, [
  44945. _c("div", { staticClass: "card h-100" }, [
  44946. _vm._m(0),
  44947. _vm._v(" "),
  44948. _c("div", { staticClass: "card-body" }, [
  44949. _c("div", { staticClass: "tab-content" }, [
  44950. _c(
  44951. "div",
  44952. {
  44953. staticClass: "tab-pane active",
  44954. attrs: {
  44955. id: "assetinfo",
  44956. role: "tabpanel",
  44957. "aria-labelledby": "assetinfo-tab"
  44958. }
  44959. },
  44960. [
  44961. !_vm.assetLoading
  44962. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  44963. : _c("circle-spinner", { attrs: { color: "#663399" } })
  44964. ],
  44965. 1
  44966. )
  44967. ])
  44968. ])
  44969. ])
  44970. ]),
  44971. _vm._v(" "),
  44972. _c("div", { staticClass: "col-lg-6" }, [
  44973. _c("div", { staticClass: "card h-100" }, [
  44974. _vm._m(1),
  44975. _vm._v(" "),
  44976. _c("div", { staticClass: "card-body" }, [
  44977. _c("div", { staticClass: "tab-content" }, [
  44978. _c(
  44979. "div",
  44980. {
  44981. staticClass: "tab-pane active",
  44982. attrs: {
  44983. id: "workordersumm",
  44984. role: "tabpanel",
  44985. "aria-labelledby": "workordersumm-tab"
  44986. }
  44987. },
  44988. [
  44989. !_vm.woLoading && !_vm.storesLoading
  44990. ? _c("work-order-info", {
  44991. attrs: {
  44992. "work-order": _vm.workOrder,
  44993. stores: _vm.stores
  44994. }
  44995. })
  44996. : _c("circle-spinner", { attrs: { color: "#663399" } })
  44997. ],
  44998. 1
  44999. ),
  45000. _vm._v(" "),
  45001. _c(
  45002. "div",
  45003. {
  45004. staticClass: "tab-pane",
  45005. attrs: {
  45006. id: "attachments",
  45007. role: "tabpanel",
  45008. "aria-labelledby": "attachments-tab"
  45009. }
  45010. },
  45011. [
  45012. _vm._v(
  45013. "\n TODO 2\n "
  45014. )
  45015. ]
  45016. )
  45017. ])
  45018. ])
  45019. ])
  45020. ])
  45021. ])
  45022. ])
  45023. }
  45024. var staticRenderFns = [
  45025. function() {
  45026. var _vm = this
  45027. var _h = _vm.$createElement
  45028. var _c = _vm._self._c || _h
  45029. return _c("div", { staticClass: "card-header text-right" }, [
  45030. _c(
  45031. "button",
  45032. {
  45033. staticClass: "btn btn-default xs-toggle",
  45034. attrs: {
  45035. type: "button",
  45036. "data-toggle": "collapse",
  45037. "data-target": "#assetTab"
  45038. }
  45039. },
  45040. [
  45041. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45042. _vm._v(" "),
  45043. _c("span", { staticClass: "icon-bar" }),
  45044. _vm._v(" "),
  45045. _c("span", { staticClass: "icon-bar" }),
  45046. _vm._v(" "),
  45047. _c("span", { staticClass: "icon-bar" })
  45048. ]
  45049. ),
  45050. _vm._v(" "),
  45051. _c(
  45052. "ul",
  45053. {
  45054. staticClass:
  45055. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45056. attrs: { id: "assetTab", role: "tablist" }
  45057. },
  45058. [
  45059. _c("li", { staticClass: "nav-item" }, [
  45060. _c(
  45061. "a",
  45062. {
  45063. staticClass: "nav-link active",
  45064. attrs: {
  45065. id: "assetinfo-tab",
  45066. "data-toggle": "pill",
  45067. href: "#assetinfo",
  45068. role: "tab",
  45069. "aria-controls": "assetinfo",
  45070. "aria-selected": "true"
  45071. }
  45072. },
  45073. [_vm._v("Hardware")]
  45074. )
  45075. ]),
  45076. _vm._v(" "),
  45077. _c("li", { staticClass: "nav-item" }, [
  45078. _c(
  45079. "a",
  45080. {
  45081. staticClass: "nav-link",
  45082. attrs: {
  45083. id: "credentials-tab",
  45084. "data-toggle": "pill",
  45085. href: "#credentials",
  45086. role: "tab",
  45087. "aria-controls": "credentials",
  45088. "aria-selected": "false"
  45089. }
  45090. },
  45091. [_vm._v("Credentials")]
  45092. )
  45093. ])
  45094. ]
  45095. )
  45096. ])
  45097. },
  45098. function() {
  45099. var _vm = this
  45100. var _h = _vm.$createElement
  45101. var _c = _vm._self._c || _h
  45102. return _c("div", { staticClass: "card-header text-right" }, [
  45103. _c(
  45104. "button",
  45105. {
  45106. staticClass: "btn btn-default xs-toggle",
  45107. attrs: {
  45108. type: "button",
  45109. "data-toggle": "collapse",
  45110. "data-target": "#workorderTab"
  45111. }
  45112. },
  45113. [
  45114. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45115. _vm._v(" "),
  45116. _c("span", { staticClass: "icon-bar" }),
  45117. _vm._v(" "),
  45118. _c("span", { staticClass: "icon-bar" }),
  45119. _vm._v(" "),
  45120. _c("span", { staticClass: "icon-bar" })
  45121. ]
  45122. ),
  45123. _vm._v(" "),
  45124. _c(
  45125. "ul",
  45126. {
  45127. staticClass:
  45128. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45129. attrs: { id: "workorderTab", role: "tablist" }
  45130. },
  45131. [
  45132. _c("li", { staticClass: "nav-item" }, [
  45133. _c(
  45134. "a",
  45135. {
  45136. staticClass: "nav-link active",
  45137. attrs: {
  45138. id: "workordersumm-tab",
  45139. "data-toggle": "pill",
  45140. href: "#workordersumm",
  45141. role: "tab",
  45142. "aria-controls": "workordersumm",
  45143. "aria-selected": "true"
  45144. }
  45145. },
  45146. [_vm._v("Summary")]
  45147. )
  45148. ]),
  45149. _vm._v(" "),
  45150. _c("li", { staticClass: "nav-item" }, [
  45151. _c(
  45152. "a",
  45153. {
  45154. staticClass: "nav-link",
  45155. attrs: {
  45156. id: "attachments-tab",
  45157. "data-toggle": "pill",
  45158. href: "#attachments",
  45159. role: "tab",
  45160. "aria-controls": "attachments",
  45161. "aria-selected": "false"
  45162. }
  45163. },
  45164. [_vm._v("Attachments")]
  45165. )
  45166. ])
  45167. ]
  45168. )
  45169. ])
  45170. }
  45171. ]
  45172. render._withStripped = true
  45173. /***/ }),
  45174. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  45175. /*!********************************************************************!*\
  45176. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  45177. \********************************************************************/
  45178. /*! exports provided: default */
  45179. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45180. "use strict";
  45181. __webpack_require__.r(__webpack_exports__);
  45182. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  45183. /* globals __VUE_SSR_CONTEXT__ */
  45184. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  45185. // This module is a runtime utility for cleaner component module output and will
  45186. // be included in the final webpack user bundle.
  45187. function normalizeComponent (
  45188. scriptExports,
  45189. render,
  45190. staticRenderFns,
  45191. functionalTemplate,
  45192. injectStyles,
  45193. scopeId,
  45194. moduleIdentifier, /* server only */
  45195. shadowMode /* vue-cli only */
  45196. ) {
  45197. // Vue.extend constructor export interop
  45198. var options = typeof scriptExports === 'function'
  45199. ? scriptExports.options
  45200. : scriptExports
  45201. // render functions
  45202. if (render) {
  45203. options.render = render
  45204. options.staticRenderFns = staticRenderFns
  45205. options._compiled = true
  45206. }
  45207. // functional template
  45208. if (functionalTemplate) {
  45209. options.functional = true
  45210. }
  45211. // scopedId
  45212. if (scopeId) {
  45213. options._scopeId = 'data-v-' + scopeId
  45214. }
  45215. var hook
  45216. if (moduleIdentifier) { // server build
  45217. hook = function (context) {
  45218. // 2.3 injection
  45219. context =
  45220. context || // cached call
  45221. (this.$vnode && this.$vnode.ssrContext) || // stateful
  45222. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  45223. // 2.2 with runInNewContext: true
  45224. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  45225. context = __VUE_SSR_CONTEXT__
  45226. }
  45227. // inject component styles
  45228. if (injectStyles) {
  45229. injectStyles.call(this, context)
  45230. }
  45231. // register component module identifier for async chunk inferrence
  45232. if (context && context._registeredComponents) {
  45233. context._registeredComponents.add(moduleIdentifier)
  45234. }
  45235. }
  45236. // used by ssr in case component is cached and beforeCreate
  45237. // never gets called
  45238. options._ssrRegister = hook
  45239. } else if (injectStyles) {
  45240. hook = shadowMode
  45241. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  45242. : injectStyles
  45243. }
  45244. if (hook) {
  45245. if (options.functional) {
  45246. // for template-only hot-reload because in that case the render fn doesn't
  45247. // go through the normalizer
  45248. options._injectStyles = hook
  45249. // register for functioal component in vue file
  45250. var originalRender = options.render
  45251. options.render = function renderWithStyleInjection (h, context) {
  45252. hook.call(context)
  45253. return originalRender(h, context)
  45254. }
  45255. } else {
  45256. // inject component registration as beforeCreate hook
  45257. var existing = options.beforeCreate
  45258. options.beforeCreate = existing
  45259. ? [].concat(existing, hook)
  45260. : [hook]
  45261. }
  45262. }
  45263. return {
  45264. exports: scriptExports,
  45265. options: options
  45266. }
  45267. }
  45268. /***/ }),
  45269. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  45270. /*!********************************************************!*\
  45271. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  45272. \********************************************************/
  45273. /*! exports provided: default */
  45274. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45275. "use strict";
  45276. __webpack_require__.r(__webpack_exports__);
  45277. /*!
  45278. * vue-router v3.1.6
  45279. * (c) 2020 Evan You
  45280. * @license MIT
  45281. */
  45282. /* */
  45283. function assert (condition, message) {
  45284. if (!condition) {
  45285. throw new Error(("[vue-router] " + message))
  45286. }
  45287. }
  45288. function warn (condition, message) {
  45289. if ( true && !condition) {
  45290. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  45291. }
  45292. }
  45293. function isError (err) {
  45294. return Object.prototype.toString.call(err).indexOf('Error') > -1
  45295. }
  45296. function isExtendedError (constructor, err) {
  45297. return (
  45298. err instanceof constructor ||
  45299. // _name is to support IE9 too
  45300. (err && (err.name === constructor.name || err._name === constructor._name))
  45301. )
  45302. }
  45303. function extend (a, b) {
  45304. for (var key in b) {
  45305. a[key] = b[key];
  45306. }
  45307. return a
  45308. }
  45309. var View = {
  45310. name: 'RouterView',
  45311. functional: true,
  45312. props: {
  45313. name: {
  45314. type: String,
  45315. default: 'default'
  45316. }
  45317. },
  45318. render: function render (_, ref) {
  45319. var props = ref.props;
  45320. var children = ref.children;
  45321. var parent = ref.parent;
  45322. var data = ref.data;
  45323. // used by devtools to display a router-view badge
  45324. data.routerView = true;
  45325. // directly use parent context's createElement() function
  45326. // so that components rendered by router-view can resolve named slots
  45327. var h = parent.$createElement;
  45328. var name = props.name;
  45329. var route = parent.$route;
  45330. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  45331. // determine current view depth, also check to see if the tree
  45332. // has been toggled inactive but kept-alive.
  45333. var depth = 0;
  45334. var inactive = false;
  45335. while (parent && parent._routerRoot !== parent) {
  45336. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  45337. if (vnodeData.routerView) {
  45338. depth++;
  45339. }
  45340. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  45341. inactive = true;
  45342. }
  45343. parent = parent.$parent;
  45344. }
  45345. data.routerViewDepth = depth;
  45346. // render previous view if the tree is inactive and kept-alive
  45347. if (inactive) {
  45348. var cachedData = cache[name];
  45349. var cachedComponent = cachedData && cachedData.component;
  45350. if (cachedComponent) {
  45351. // #2301
  45352. // pass props
  45353. if (cachedData.configProps) {
  45354. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  45355. }
  45356. return h(cachedComponent, data, children)
  45357. } else {
  45358. // render previous empty view
  45359. return h()
  45360. }
  45361. }
  45362. var matched = route.matched[depth];
  45363. var component = matched && matched.components[name];
  45364. // render empty node if no matched route or no config component
  45365. if (!matched || !component) {
  45366. cache[name] = null;
  45367. return h()
  45368. }
  45369. // cache component
  45370. cache[name] = { component: component };
  45371. // attach instance registration hook
  45372. // this will be called in the instance's injected lifecycle hooks
  45373. data.registerRouteInstance = function (vm, val) {
  45374. // val could be undefined for unregistration
  45375. var current = matched.instances[name];
  45376. if (
  45377. (val && current !== vm) ||
  45378. (!val && current === vm)
  45379. ) {
  45380. matched.instances[name] = val;
  45381. }
  45382. }
  45383. // also register instance in prepatch hook
  45384. // in case the same component instance is reused across different routes
  45385. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  45386. matched.instances[name] = vnode.componentInstance;
  45387. };
  45388. // register instance in init hook
  45389. // in case kept-alive component be actived when routes changed
  45390. data.hook.init = function (vnode) {
  45391. if (vnode.data.keepAlive &&
  45392. vnode.componentInstance &&
  45393. vnode.componentInstance !== matched.instances[name]
  45394. ) {
  45395. matched.instances[name] = vnode.componentInstance;
  45396. }
  45397. };
  45398. var configProps = matched.props && matched.props[name];
  45399. // save route and configProps in cachce
  45400. if (configProps) {
  45401. extend(cache[name], {
  45402. route: route,
  45403. configProps: configProps
  45404. });
  45405. fillPropsinData(component, data, route, configProps);
  45406. }
  45407. return h(component, data, children)
  45408. }
  45409. };
  45410. function fillPropsinData (component, data, route, configProps) {
  45411. // resolve props
  45412. var propsToPass = data.props = resolveProps(route, configProps);
  45413. if (propsToPass) {
  45414. // clone to prevent mutation
  45415. propsToPass = data.props = extend({}, propsToPass);
  45416. // pass non-declared props as attrs
  45417. var attrs = data.attrs = data.attrs || {};
  45418. for (var key in propsToPass) {
  45419. if (!component.props || !(key in component.props)) {
  45420. attrs[key] = propsToPass[key];
  45421. delete propsToPass[key];
  45422. }
  45423. }
  45424. }
  45425. }
  45426. function resolveProps (route, config) {
  45427. switch (typeof config) {
  45428. case 'undefined':
  45429. return
  45430. case 'object':
  45431. return config
  45432. case 'function':
  45433. return config(route)
  45434. case 'boolean':
  45435. return config ? route.params : undefined
  45436. default:
  45437. if (true) {
  45438. warn(
  45439. false,
  45440. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  45441. "expecting an object, function or boolean."
  45442. );
  45443. }
  45444. }
  45445. }
  45446. /* */
  45447. var encodeReserveRE = /[!'()*]/g;
  45448. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  45449. var commaRE = /%2C/g;
  45450. // fixed encodeURIComponent which is more conformant to RFC3986:
  45451. // - escapes [!'()*]
  45452. // - preserve commas
  45453. var encode = function (str) { return encodeURIComponent(str)
  45454. .replace(encodeReserveRE, encodeReserveReplacer)
  45455. .replace(commaRE, ','); };
  45456. var decode = decodeURIComponent;
  45457. function resolveQuery (
  45458. query,
  45459. extraQuery,
  45460. _parseQuery
  45461. ) {
  45462. if ( extraQuery === void 0 ) extraQuery = {};
  45463. var parse = _parseQuery || parseQuery;
  45464. var parsedQuery;
  45465. try {
  45466. parsedQuery = parse(query || '');
  45467. } catch (e) {
  45468. true && warn(false, e.message);
  45469. parsedQuery = {};
  45470. }
  45471. for (var key in extraQuery) {
  45472. parsedQuery[key] = extraQuery[key];
  45473. }
  45474. return parsedQuery
  45475. }
  45476. function parseQuery (query) {
  45477. var res = {};
  45478. query = query.trim().replace(/^(\?|#|&)/, '');
  45479. if (!query) {
  45480. return res
  45481. }
  45482. query.split('&').forEach(function (param) {
  45483. var parts = param.replace(/\+/g, ' ').split('=');
  45484. var key = decode(parts.shift());
  45485. var val = parts.length > 0
  45486. ? decode(parts.join('='))
  45487. : null;
  45488. if (res[key] === undefined) {
  45489. res[key] = val;
  45490. } else if (Array.isArray(res[key])) {
  45491. res[key].push(val);
  45492. } else {
  45493. res[key] = [res[key], val];
  45494. }
  45495. });
  45496. return res
  45497. }
  45498. function stringifyQuery (obj) {
  45499. var res = obj ? Object.keys(obj).map(function (key) {
  45500. var val = obj[key];
  45501. if (val === undefined) {
  45502. return ''
  45503. }
  45504. if (val === null) {
  45505. return encode(key)
  45506. }
  45507. if (Array.isArray(val)) {
  45508. var result = [];
  45509. val.forEach(function (val2) {
  45510. if (val2 === undefined) {
  45511. return
  45512. }
  45513. if (val2 === null) {
  45514. result.push(encode(key));
  45515. } else {
  45516. result.push(encode(key) + '=' + encode(val2));
  45517. }
  45518. });
  45519. return result.join('&')
  45520. }
  45521. return encode(key) + '=' + encode(val)
  45522. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  45523. return res ? ("?" + res) : ''
  45524. }
  45525. /* */
  45526. var trailingSlashRE = /\/?$/;
  45527. function createRoute (
  45528. record,
  45529. location,
  45530. redirectedFrom,
  45531. router
  45532. ) {
  45533. var stringifyQuery = router && router.options.stringifyQuery;
  45534. var query = location.query || {};
  45535. try {
  45536. query = clone(query);
  45537. } catch (e) {}
  45538. var route = {
  45539. name: location.name || (record && record.name),
  45540. meta: (record && record.meta) || {},
  45541. path: location.path || '/',
  45542. hash: location.hash || '',
  45543. query: query,
  45544. params: location.params || {},
  45545. fullPath: getFullPath(location, stringifyQuery),
  45546. matched: record ? formatMatch(record) : []
  45547. };
  45548. if (redirectedFrom) {
  45549. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  45550. }
  45551. return Object.freeze(route)
  45552. }
  45553. function clone (value) {
  45554. if (Array.isArray(value)) {
  45555. return value.map(clone)
  45556. } else if (value && typeof value === 'object') {
  45557. var res = {};
  45558. for (var key in value) {
  45559. res[key] = clone(value[key]);
  45560. }
  45561. return res
  45562. } else {
  45563. return value
  45564. }
  45565. }
  45566. // the starting route that represents the initial state
  45567. var START = createRoute(null, {
  45568. path: '/'
  45569. });
  45570. function formatMatch (record) {
  45571. var res = [];
  45572. while (record) {
  45573. res.unshift(record);
  45574. record = record.parent;
  45575. }
  45576. return res
  45577. }
  45578. function getFullPath (
  45579. ref,
  45580. _stringifyQuery
  45581. ) {
  45582. var path = ref.path;
  45583. var query = ref.query; if ( query === void 0 ) query = {};
  45584. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  45585. var stringify = _stringifyQuery || stringifyQuery;
  45586. return (path || '/') + stringify(query) + hash
  45587. }
  45588. function isSameRoute (a, b) {
  45589. if (b === START) {
  45590. return a === b
  45591. } else if (!b) {
  45592. return false
  45593. } else if (a.path && b.path) {
  45594. return (
  45595. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  45596. a.hash === b.hash &&
  45597. isObjectEqual(a.query, b.query)
  45598. )
  45599. } else if (a.name && b.name) {
  45600. return (
  45601. a.name === b.name &&
  45602. a.hash === b.hash &&
  45603. isObjectEqual(a.query, b.query) &&
  45604. isObjectEqual(a.params, b.params)
  45605. )
  45606. } else {
  45607. return false
  45608. }
  45609. }
  45610. function isObjectEqual (a, b) {
  45611. if ( a === void 0 ) a = {};
  45612. if ( b === void 0 ) b = {};
  45613. // handle null value #1566
  45614. if (!a || !b) { return a === b }
  45615. var aKeys = Object.keys(a);
  45616. var bKeys = Object.keys(b);
  45617. if (aKeys.length !== bKeys.length) {
  45618. return false
  45619. }
  45620. return aKeys.every(function (key) {
  45621. var aVal = a[key];
  45622. var bVal = b[key];
  45623. // check nested equality
  45624. if (typeof aVal === 'object' && typeof bVal === 'object') {
  45625. return isObjectEqual(aVal, bVal)
  45626. }
  45627. return String(aVal) === String(bVal)
  45628. })
  45629. }
  45630. function isIncludedRoute (current, target) {
  45631. return (
  45632. current.path.replace(trailingSlashRE, '/').indexOf(
  45633. target.path.replace(trailingSlashRE, '/')
  45634. ) === 0 &&
  45635. (!target.hash || current.hash === target.hash) &&
  45636. queryIncludes(current.query, target.query)
  45637. )
  45638. }
  45639. function queryIncludes (current, target) {
  45640. for (var key in target) {
  45641. if (!(key in current)) {
  45642. return false
  45643. }
  45644. }
  45645. return true
  45646. }
  45647. /* */
  45648. function resolvePath (
  45649. relative,
  45650. base,
  45651. append
  45652. ) {
  45653. var firstChar = relative.charAt(0);
  45654. if (firstChar === '/') {
  45655. return relative
  45656. }
  45657. if (firstChar === '?' || firstChar === '#') {
  45658. return base + relative
  45659. }
  45660. var stack = base.split('/');
  45661. // remove trailing segment if:
  45662. // - not appending
  45663. // - appending to trailing slash (last segment is empty)
  45664. if (!append || !stack[stack.length - 1]) {
  45665. stack.pop();
  45666. }
  45667. // resolve relative path
  45668. var segments = relative.replace(/^\//, '').split('/');
  45669. for (var i = 0; i < segments.length; i++) {
  45670. var segment = segments[i];
  45671. if (segment === '..') {
  45672. stack.pop();
  45673. } else if (segment !== '.') {
  45674. stack.push(segment);
  45675. }
  45676. }
  45677. // ensure leading slash
  45678. if (stack[0] !== '') {
  45679. stack.unshift('');
  45680. }
  45681. return stack.join('/')
  45682. }
  45683. function parsePath (path) {
  45684. var hash = '';
  45685. var query = '';
  45686. var hashIndex = path.indexOf('#');
  45687. if (hashIndex >= 0) {
  45688. hash = path.slice(hashIndex);
  45689. path = path.slice(0, hashIndex);
  45690. }
  45691. var queryIndex = path.indexOf('?');
  45692. if (queryIndex >= 0) {
  45693. query = path.slice(queryIndex + 1);
  45694. path = path.slice(0, queryIndex);
  45695. }
  45696. return {
  45697. path: path,
  45698. query: query,
  45699. hash: hash
  45700. }
  45701. }
  45702. function cleanPath (path) {
  45703. return path.replace(/\/\//g, '/')
  45704. }
  45705. var isarray = Array.isArray || function (arr) {
  45706. return Object.prototype.toString.call(arr) == '[object Array]';
  45707. };
  45708. /**
  45709. * Expose `pathToRegexp`.
  45710. */
  45711. var pathToRegexp_1 = pathToRegexp;
  45712. var parse_1 = parse;
  45713. var compile_1 = compile;
  45714. var tokensToFunction_1 = tokensToFunction;
  45715. var tokensToRegExp_1 = tokensToRegExp;
  45716. /**
  45717. * The main path matching regexp utility.
  45718. *
  45719. * @type {RegExp}
  45720. */
  45721. var PATH_REGEXP = new RegExp([
  45722. // Match escaped characters that would otherwise appear in future matches.
  45723. // This allows the user to escape special characters that won't transform.
  45724. '(\\\\.)',
  45725. // Match Express-style parameters and un-named parameters with a prefix
  45726. // and optional suffixes. Matches appear as:
  45727. //
  45728. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  45729. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  45730. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  45731. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  45732. ].join('|'), 'g');
  45733. /**
  45734. * Parse a string for the raw tokens.
  45735. *
  45736. * @param {string} str
  45737. * @param {Object=} options
  45738. * @return {!Array}
  45739. */
  45740. function parse (str, options) {
  45741. var tokens = [];
  45742. var key = 0;
  45743. var index = 0;
  45744. var path = '';
  45745. var defaultDelimiter = options && options.delimiter || '/';
  45746. var res;
  45747. while ((res = PATH_REGEXP.exec(str)) != null) {
  45748. var m = res[0];
  45749. var escaped = res[1];
  45750. var offset = res.index;
  45751. path += str.slice(index, offset);
  45752. index = offset + m.length;
  45753. // Ignore already escaped sequences.
  45754. if (escaped) {
  45755. path += escaped[1];
  45756. continue
  45757. }
  45758. var next = str[index];
  45759. var prefix = res[2];
  45760. var name = res[3];
  45761. var capture = res[4];
  45762. var group = res[5];
  45763. var modifier = res[6];
  45764. var asterisk = res[7];
  45765. // Push the current path onto the tokens.
  45766. if (path) {
  45767. tokens.push(path);
  45768. path = '';
  45769. }
  45770. var partial = prefix != null && next != null && next !== prefix;
  45771. var repeat = modifier === '+' || modifier === '*';
  45772. var optional = modifier === '?' || modifier === '*';
  45773. var delimiter = res[2] || defaultDelimiter;
  45774. var pattern = capture || group;
  45775. tokens.push({
  45776. name: name || key++,
  45777. prefix: prefix || '',
  45778. delimiter: delimiter,
  45779. optional: optional,
  45780. repeat: repeat,
  45781. partial: partial,
  45782. asterisk: !!asterisk,
  45783. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  45784. });
  45785. }
  45786. // Match any characters still remaining.
  45787. if (index < str.length) {
  45788. path += str.substr(index);
  45789. }
  45790. // If the path exists, push it onto the end.
  45791. if (path) {
  45792. tokens.push(path);
  45793. }
  45794. return tokens
  45795. }
  45796. /**
  45797. * Compile a string to a template function for the path.
  45798. *
  45799. * @param {string} str
  45800. * @param {Object=} options
  45801. * @return {!function(Object=, Object=)}
  45802. */
  45803. function compile (str, options) {
  45804. return tokensToFunction(parse(str, options))
  45805. }
  45806. /**
  45807. * Prettier encoding of URI path segments.
  45808. *
  45809. * @param {string}
  45810. * @return {string}
  45811. */
  45812. function encodeURIComponentPretty (str) {
  45813. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  45814. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45815. })
  45816. }
  45817. /**
  45818. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  45819. *
  45820. * @param {string}
  45821. * @return {string}
  45822. */
  45823. function encodeAsterisk (str) {
  45824. return encodeURI(str).replace(/[?#]/g, function (c) {
  45825. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45826. })
  45827. }
  45828. /**
  45829. * Expose a method for transforming tokens into the path function.
  45830. */
  45831. function tokensToFunction (tokens) {
  45832. // Compile all the tokens into regexps.
  45833. var matches = new Array(tokens.length);
  45834. // Compile all the patterns before compilation.
  45835. for (var i = 0; i < tokens.length; i++) {
  45836. if (typeof tokens[i] === 'object') {
  45837. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  45838. }
  45839. }
  45840. return function (obj, opts) {
  45841. var path = '';
  45842. var data = obj || {};
  45843. var options = opts || {};
  45844. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  45845. for (var i = 0; i < tokens.length; i++) {
  45846. var token = tokens[i];
  45847. if (typeof token === 'string') {
  45848. path += token;
  45849. continue
  45850. }
  45851. var value = data[token.name];
  45852. var segment;
  45853. if (value == null) {
  45854. if (token.optional) {
  45855. // Prepend partial segment prefixes.
  45856. if (token.partial) {
  45857. path += token.prefix;
  45858. }
  45859. continue
  45860. } else {
  45861. throw new TypeError('Expected "' + token.name + '" to be defined')
  45862. }
  45863. }
  45864. if (isarray(value)) {
  45865. if (!token.repeat) {
  45866. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  45867. }
  45868. if (value.length === 0) {
  45869. if (token.optional) {
  45870. continue
  45871. } else {
  45872. throw new TypeError('Expected "' + token.name + '" to not be empty')
  45873. }
  45874. }
  45875. for (var j = 0; j < value.length; j++) {
  45876. segment = encode(value[j]);
  45877. if (!matches[i].test(segment)) {
  45878. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  45879. }
  45880. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  45881. }
  45882. continue
  45883. }
  45884. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  45885. if (!matches[i].test(segment)) {
  45886. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  45887. }
  45888. path += token.prefix + segment;
  45889. }
  45890. return path
  45891. }
  45892. }
  45893. /**
  45894. * Escape a regular expression string.
  45895. *
  45896. * @param {string} str
  45897. * @return {string}
  45898. */
  45899. function escapeString (str) {
  45900. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  45901. }
  45902. /**
  45903. * Escape the capturing group by escaping special characters and meaning.
  45904. *
  45905. * @param {string} group
  45906. * @return {string}
  45907. */
  45908. function escapeGroup (group) {
  45909. return group.replace(/([=!:$\/()])/g, '\\$1')
  45910. }
  45911. /**
  45912. * Attach the keys as a property of the regexp.
  45913. *
  45914. * @param {!RegExp} re
  45915. * @param {Array} keys
  45916. * @return {!RegExp}
  45917. */
  45918. function attachKeys (re, keys) {
  45919. re.keys = keys;
  45920. return re
  45921. }
  45922. /**
  45923. * Get the flags for a regexp from the options.
  45924. *
  45925. * @param {Object} options
  45926. * @return {string}
  45927. */
  45928. function flags (options) {
  45929. return options.sensitive ? '' : 'i'
  45930. }
  45931. /**
  45932. * Pull out keys from a regexp.
  45933. *
  45934. * @param {!RegExp} path
  45935. * @param {!Array} keys
  45936. * @return {!RegExp}
  45937. */
  45938. function regexpToRegexp (path, keys) {
  45939. // Use a negative lookahead to match only capturing groups.
  45940. var groups = path.source.match(/\((?!\?)/g);
  45941. if (groups) {
  45942. for (var i = 0; i < groups.length; i++) {
  45943. keys.push({
  45944. name: i,
  45945. prefix: null,
  45946. delimiter: null,
  45947. optional: false,
  45948. repeat: false,
  45949. partial: false,
  45950. asterisk: false,
  45951. pattern: null
  45952. });
  45953. }
  45954. }
  45955. return attachKeys(path, keys)
  45956. }
  45957. /**
  45958. * Transform an array into a regexp.
  45959. *
  45960. * @param {!Array} path
  45961. * @param {Array} keys
  45962. * @param {!Object} options
  45963. * @return {!RegExp}
  45964. */
  45965. function arrayToRegexp (path, keys, options) {
  45966. var parts = [];
  45967. for (var i = 0; i < path.length; i++) {
  45968. parts.push(pathToRegexp(path[i], keys, options).source);
  45969. }
  45970. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  45971. return attachKeys(regexp, keys)
  45972. }
  45973. /**
  45974. * Create a path regexp from string input.
  45975. *
  45976. * @param {string} path
  45977. * @param {!Array} keys
  45978. * @param {!Object} options
  45979. * @return {!RegExp}
  45980. */
  45981. function stringToRegexp (path, keys, options) {
  45982. return tokensToRegExp(parse(path, options), keys, options)
  45983. }
  45984. /**
  45985. * Expose a function for taking tokens and returning a RegExp.
  45986. *
  45987. * @param {!Array} tokens
  45988. * @param {(Array|Object)=} keys
  45989. * @param {Object=} options
  45990. * @return {!RegExp}
  45991. */
  45992. function tokensToRegExp (tokens, keys, options) {
  45993. if (!isarray(keys)) {
  45994. options = /** @type {!Object} */ (keys || options);
  45995. keys = [];
  45996. }
  45997. options = options || {};
  45998. var strict = options.strict;
  45999. var end = options.end !== false;
  46000. var route = '';
  46001. // Iterate over the tokens and create our regexp string.
  46002. for (var i = 0; i < tokens.length; i++) {
  46003. var token = tokens[i];
  46004. if (typeof token === 'string') {
  46005. route += escapeString(token);
  46006. } else {
  46007. var prefix = escapeString(token.prefix);
  46008. var capture = '(?:' + token.pattern + ')';
  46009. keys.push(token);
  46010. if (token.repeat) {
  46011. capture += '(?:' + prefix + capture + ')*';
  46012. }
  46013. if (token.optional) {
  46014. if (!token.partial) {
  46015. capture = '(?:' + prefix + '(' + capture + '))?';
  46016. } else {
  46017. capture = prefix + '(' + capture + ')?';
  46018. }
  46019. } else {
  46020. capture = prefix + '(' + capture + ')';
  46021. }
  46022. route += capture;
  46023. }
  46024. }
  46025. var delimiter = escapeString(options.delimiter || '/');
  46026. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  46027. // In non-strict mode we allow a slash at the end of match. If the path to
  46028. // match already ends with a slash, we remove it for consistency. The slash
  46029. // is valid at the end of a path match, not in the middle. This is important
  46030. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  46031. if (!strict) {
  46032. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  46033. }
  46034. if (end) {
  46035. route += '$';
  46036. } else {
  46037. // In non-ending mode, we need the capturing groups to match as much as
  46038. // possible by using a positive lookahead to the end or next path segment.
  46039. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  46040. }
  46041. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  46042. }
  46043. /**
  46044. * Normalize the given path string, returning a regular expression.
  46045. *
  46046. * An empty array can be passed in for the keys, which will hold the
  46047. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  46048. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  46049. *
  46050. * @param {(string|RegExp|Array)} path
  46051. * @param {(Array|Object)=} keys
  46052. * @param {Object=} options
  46053. * @return {!RegExp}
  46054. */
  46055. function pathToRegexp (path, keys, options) {
  46056. if (!isarray(keys)) {
  46057. options = /** @type {!Object} */ (keys || options);
  46058. keys = [];
  46059. }
  46060. options = options || {};
  46061. if (path instanceof RegExp) {
  46062. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  46063. }
  46064. if (isarray(path)) {
  46065. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  46066. }
  46067. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  46068. }
  46069. pathToRegexp_1.parse = parse_1;
  46070. pathToRegexp_1.compile = compile_1;
  46071. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  46072. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  46073. /* */
  46074. // $flow-disable-line
  46075. var regexpCompileCache = Object.create(null);
  46076. function fillParams (
  46077. path,
  46078. params,
  46079. routeMsg
  46080. ) {
  46081. params = params || {};
  46082. try {
  46083. var filler =
  46084. regexpCompileCache[path] ||
  46085. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  46086. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  46087. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  46088. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  46089. return filler(params, { pretty: true })
  46090. } catch (e) {
  46091. if (true) {
  46092. // Fix #3072 no warn if `pathMatch` is string
  46093. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  46094. }
  46095. return ''
  46096. } finally {
  46097. // delete the 0 if it was added
  46098. delete params[0];
  46099. }
  46100. }
  46101. /* */
  46102. function normalizeLocation (
  46103. raw,
  46104. current,
  46105. append,
  46106. router
  46107. ) {
  46108. var next = typeof raw === 'string' ? { path: raw } : raw;
  46109. // named target
  46110. if (next._normalized) {
  46111. return next
  46112. } else if (next.name) {
  46113. next = extend({}, raw);
  46114. var params = next.params;
  46115. if (params && typeof params === 'object') {
  46116. next.params = extend({}, params);
  46117. }
  46118. return next
  46119. }
  46120. // relative params
  46121. if (!next.path && next.params && current) {
  46122. next = extend({}, next);
  46123. next._normalized = true;
  46124. var params$1 = extend(extend({}, current.params), next.params);
  46125. if (current.name) {
  46126. next.name = current.name;
  46127. next.params = params$1;
  46128. } else if (current.matched.length) {
  46129. var rawPath = current.matched[current.matched.length - 1].path;
  46130. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  46131. } else if (true) {
  46132. warn(false, "relative params navigation requires a current route.");
  46133. }
  46134. return next
  46135. }
  46136. var parsedPath = parsePath(next.path || '');
  46137. var basePath = (current && current.path) || '/';
  46138. var path = parsedPath.path
  46139. ? resolvePath(parsedPath.path, basePath, append || next.append)
  46140. : basePath;
  46141. var query = resolveQuery(
  46142. parsedPath.query,
  46143. next.query,
  46144. router && router.options.parseQuery
  46145. );
  46146. var hash = next.hash || parsedPath.hash;
  46147. if (hash && hash.charAt(0) !== '#') {
  46148. hash = "#" + hash;
  46149. }
  46150. return {
  46151. _normalized: true,
  46152. path: path,
  46153. query: query,
  46154. hash: hash
  46155. }
  46156. }
  46157. /* */
  46158. // work around weird flow bug
  46159. var toTypes = [String, Object];
  46160. var eventTypes = [String, Array];
  46161. var noop = function () {};
  46162. var Link = {
  46163. name: 'RouterLink',
  46164. props: {
  46165. to: {
  46166. type: toTypes,
  46167. required: true
  46168. },
  46169. tag: {
  46170. type: String,
  46171. default: 'a'
  46172. },
  46173. exact: Boolean,
  46174. append: Boolean,
  46175. replace: Boolean,
  46176. activeClass: String,
  46177. exactActiveClass: String,
  46178. event: {
  46179. type: eventTypes,
  46180. default: 'click'
  46181. }
  46182. },
  46183. render: function render (h) {
  46184. var this$1 = this;
  46185. var router = this.$router;
  46186. var current = this.$route;
  46187. var ref = router.resolve(
  46188. this.to,
  46189. current,
  46190. this.append
  46191. );
  46192. var location = ref.location;
  46193. var route = ref.route;
  46194. var href = ref.href;
  46195. var classes = {};
  46196. var globalActiveClass = router.options.linkActiveClass;
  46197. var globalExactActiveClass = router.options.linkExactActiveClass;
  46198. // Support global empty active class
  46199. var activeClassFallback =
  46200. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  46201. var exactActiveClassFallback =
  46202. globalExactActiveClass == null
  46203. ? 'router-link-exact-active'
  46204. : globalExactActiveClass;
  46205. var activeClass =
  46206. this.activeClass == null ? activeClassFallback : this.activeClass;
  46207. var exactActiveClass =
  46208. this.exactActiveClass == null
  46209. ? exactActiveClassFallback
  46210. : this.exactActiveClass;
  46211. var compareTarget = route.redirectedFrom
  46212. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  46213. : route;
  46214. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  46215. classes[activeClass] = this.exact
  46216. ? classes[exactActiveClass]
  46217. : isIncludedRoute(current, compareTarget);
  46218. var handler = function (e) {
  46219. if (guardEvent(e)) {
  46220. if (this$1.replace) {
  46221. router.replace(location, noop);
  46222. } else {
  46223. router.push(location, noop);
  46224. }
  46225. }
  46226. };
  46227. var on = { click: guardEvent };
  46228. if (Array.isArray(this.event)) {
  46229. this.event.forEach(function (e) {
  46230. on[e] = handler;
  46231. });
  46232. } else {
  46233. on[this.event] = handler;
  46234. }
  46235. var data = { class: classes };
  46236. var scopedSlot =
  46237. !this.$scopedSlots.$hasNormal &&
  46238. this.$scopedSlots.default &&
  46239. this.$scopedSlots.default({
  46240. href: href,
  46241. route: route,
  46242. navigate: handler,
  46243. isActive: classes[activeClass],
  46244. isExactActive: classes[exactActiveClass]
  46245. });
  46246. if (scopedSlot) {
  46247. if (scopedSlot.length === 1) {
  46248. return scopedSlot[0]
  46249. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  46250. if (true) {
  46251. warn(
  46252. false,
  46253. ("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.")
  46254. );
  46255. }
  46256. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  46257. }
  46258. }
  46259. if (this.tag === 'a') {
  46260. data.on = on;
  46261. data.attrs = { href: href };
  46262. } else {
  46263. // find the first <a> child and apply listener and href
  46264. var a = findAnchor(this.$slots.default);
  46265. if (a) {
  46266. // in case the <a> is a static node
  46267. a.isStatic = false;
  46268. var aData = (a.data = extend({}, a.data));
  46269. aData.on = aData.on || {};
  46270. // transform existing events in both objects into arrays so we can push later
  46271. for (var event in aData.on) {
  46272. var handler$1 = aData.on[event];
  46273. if (event in on) {
  46274. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  46275. }
  46276. }
  46277. // append new listeners for router-link
  46278. for (var event$1 in on) {
  46279. if (event$1 in aData.on) {
  46280. // on[event] is always a function
  46281. aData.on[event$1].push(on[event$1]);
  46282. } else {
  46283. aData.on[event$1] = handler;
  46284. }
  46285. }
  46286. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  46287. aAttrs.href = href;
  46288. } else {
  46289. // doesn't have <a> child, apply listener to self
  46290. data.on = on;
  46291. }
  46292. }
  46293. return h(this.tag, data, this.$slots.default)
  46294. }
  46295. };
  46296. function guardEvent (e) {
  46297. // don't redirect with control keys
  46298. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  46299. // don't redirect when preventDefault called
  46300. if (e.defaultPrevented) { return }
  46301. // don't redirect on right click
  46302. if (e.button !== undefined && e.button !== 0) { return }
  46303. // don't redirect if `target="_blank"`
  46304. if (e.currentTarget && e.currentTarget.getAttribute) {
  46305. var target = e.currentTarget.getAttribute('target');
  46306. if (/\b_blank\b/i.test(target)) { return }
  46307. }
  46308. // this may be a Weex event which doesn't have this method
  46309. if (e.preventDefault) {
  46310. e.preventDefault();
  46311. }
  46312. return true
  46313. }
  46314. function findAnchor (children) {
  46315. if (children) {
  46316. var child;
  46317. for (var i = 0; i < children.length; i++) {
  46318. child = children[i];
  46319. if (child.tag === 'a') {
  46320. return child
  46321. }
  46322. if (child.children && (child = findAnchor(child.children))) {
  46323. return child
  46324. }
  46325. }
  46326. }
  46327. }
  46328. var _Vue;
  46329. function install (Vue) {
  46330. if (install.installed && _Vue === Vue) { return }
  46331. install.installed = true;
  46332. _Vue = Vue;
  46333. var isDef = function (v) { return v !== undefined; };
  46334. var registerInstance = function (vm, callVal) {
  46335. var i = vm.$options._parentVnode;
  46336. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  46337. i(vm, callVal);
  46338. }
  46339. };
  46340. Vue.mixin({
  46341. beforeCreate: function beforeCreate () {
  46342. if (isDef(this.$options.router)) {
  46343. this._routerRoot = this;
  46344. this._router = this.$options.router;
  46345. this._router.init(this);
  46346. Vue.util.defineReactive(this, '_route', this._router.history.current);
  46347. } else {
  46348. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  46349. }
  46350. registerInstance(this, this);
  46351. },
  46352. destroyed: function destroyed () {
  46353. registerInstance(this);
  46354. }
  46355. });
  46356. Object.defineProperty(Vue.prototype, '$router', {
  46357. get: function get () { return this._routerRoot._router }
  46358. });
  46359. Object.defineProperty(Vue.prototype, '$route', {
  46360. get: function get () { return this._routerRoot._route }
  46361. });
  46362. Vue.component('RouterView', View);
  46363. Vue.component('RouterLink', Link);
  46364. var strats = Vue.config.optionMergeStrategies;
  46365. // use the same hook merging strategy for route hooks
  46366. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  46367. }
  46368. /* */
  46369. var inBrowser = typeof window !== 'undefined';
  46370. /* */
  46371. function createRouteMap (
  46372. routes,
  46373. oldPathList,
  46374. oldPathMap,
  46375. oldNameMap
  46376. ) {
  46377. // the path list is used to control path matching priority
  46378. var pathList = oldPathList || [];
  46379. // $flow-disable-line
  46380. var pathMap = oldPathMap || Object.create(null);
  46381. // $flow-disable-line
  46382. var nameMap = oldNameMap || Object.create(null);
  46383. routes.forEach(function (route) {
  46384. addRouteRecord(pathList, pathMap, nameMap, route);
  46385. });
  46386. // ensure wildcard routes are always at the end
  46387. for (var i = 0, l = pathList.length; i < l; i++) {
  46388. if (pathList[i] === '*') {
  46389. pathList.push(pathList.splice(i, 1)[0]);
  46390. l--;
  46391. i--;
  46392. }
  46393. }
  46394. if (true) {
  46395. // warn if routes do not include leading slashes
  46396. var found = pathList
  46397. // check for missing leading slash
  46398. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  46399. if (found.length > 0) {
  46400. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  46401. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  46402. }
  46403. }
  46404. return {
  46405. pathList: pathList,
  46406. pathMap: pathMap,
  46407. nameMap: nameMap
  46408. }
  46409. }
  46410. function addRouteRecord (
  46411. pathList,
  46412. pathMap,
  46413. nameMap,
  46414. route,
  46415. parent,
  46416. matchAs
  46417. ) {
  46418. var path = route.path;
  46419. var name = route.name;
  46420. if (true) {
  46421. assert(path != null, "\"path\" is required in a route configuration.");
  46422. assert(
  46423. typeof route.component !== 'string',
  46424. "route config \"component\" for path: " + (String(
  46425. path || name
  46426. )) + " cannot be a " + "string id. Use an actual component instead."
  46427. );
  46428. }
  46429. var pathToRegexpOptions =
  46430. route.pathToRegexpOptions || {};
  46431. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  46432. if (typeof route.caseSensitive === 'boolean') {
  46433. pathToRegexpOptions.sensitive = route.caseSensitive;
  46434. }
  46435. var record = {
  46436. path: normalizedPath,
  46437. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  46438. components: route.components || { default: route.component },
  46439. instances: {},
  46440. name: name,
  46441. parent: parent,
  46442. matchAs: matchAs,
  46443. redirect: route.redirect,
  46444. beforeEnter: route.beforeEnter,
  46445. meta: route.meta || {},
  46446. props:
  46447. route.props == null
  46448. ? {}
  46449. : route.components
  46450. ? route.props
  46451. : { default: route.props }
  46452. };
  46453. if (route.children) {
  46454. // Warn if route is named, does not redirect and has a default child route.
  46455. // If users navigate to this route by name, the default child will
  46456. // not be rendered (GH Issue #629)
  46457. if (true) {
  46458. if (
  46459. route.name &&
  46460. !route.redirect &&
  46461. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  46462. ) {
  46463. warn(
  46464. false,
  46465. "Named Route '" + (route.name) + "' has a default child route. " +
  46466. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  46467. "the default child route will not be rendered. Remove the name from " +
  46468. "this route and use the name of the default child route for named " +
  46469. "links instead."
  46470. );
  46471. }
  46472. }
  46473. route.children.forEach(function (child) {
  46474. var childMatchAs = matchAs
  46475. ? cleanPath((matchAs + "/" + (child.path)))
  46476. : undefined;
  46477. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  46478. });
  46479. }
  46480. if (!pathMap[record.path]) {
  46481. pathList.push(record.path);
  46482. pathMap[record.path] = record;
  46483. }
  46484. if (route.alias !== undefined) {
  46485. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  46486. for (var i = 0; i < aliases.length; ++i) {
  46487. var alias = aliases[i];
  46488. if ( true && alias === path) {
  46489. warn(
  46490. false,
  46491. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  46492. );
  46493. // skip in dev to make it work
  46494. continue
  46495. }
  46496. var aliasRoute = {
  46497. path: alias,
  46498. children: route.children
  46499. };
  46500. addRouteRecord(
  46501. pathList,
  46502. pathMap,
  46503. nameMap,
  46504. aliasRoute,
  46505. parent,
  46506. record.path || '/' // matchAs
  46507. );
  46508. }
  46509. }
  46510. if (name) {
  46511. if (!nameMap[name]) {
  46512. nameMap[name] = record;
  46513. } else if ( true && !matchAs) {
  46514. warn(
  46515. false,
  46516. "Duplicate named routes definition: " +
  46517. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  46518. );
  46519. }
  46520. }
  46521. }
  46522. function compileRouteRegex (
  46523. path,
  46524. pathToRegexpOptions
  46525. ) {
  46526. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  46527. if (true) {
  46528. var keys = Object.create(null);
  46529. regex.keys.forEach(function (key) {
  46530. warn(
  46531. !keys[key.name],
  46532. ("Duplicate param keys in route with path: \"" + path + "\"")
  46533. );
  46534. keys[key.name] = true;
  46535. });
  46536. }
  46537. return regex
  46538. }
  46539. function normalizePath (
  46540. path,
  46541. parent,
  46542. strict
  46543. ) {
  46544. if (!strict) { path = path.replace(/\/$/, ''); }
  46545. if (path[0] === '/') { return path }
  46546. if (parent == null) { return path }
  46547. return cleanPath(((parent.path) + "/" + path))
  46548. }
  46549. /* */
  46550. function createMatcher (
  46551. routes,
  46552. router
  46553. ) {
  46554. var ref = createRouteMap(routes);
  46555. var pathList = ref.pathList;
  46556. var pathMap = ref.pathMap;
  46557. var nameMap = ref.nameMap;
  46558. function addRoutes (routes) {
  46559. createRouteMap(routes, pathList, pathMap, nameMap);
  46560. }
  46561. function match (
  46562. raw,
  46563. currentRoute,
  46564. redirectedFrom
  46565. ) {
  46566. var location = normalizeLocation(raw, currentRoute, false, router);
  46567. var name = location.name;
  46568. if (name) {
  46569. var record = nameMap[name];
  46570. if (true) {
  46571. warn(record, ("Route with name '" + name + "' does not exist"));
  46572. }
  46573. if (!record) { return _createRoute(null, location) }
  46574. var paramNames = record.regex.keys
  46575. .filter(function (key) { return !key.optional; })
  46576. .map(function (key) { return key.name; });
  46577. if (typeof location.params !== 'object') {
  46578. location.params = {};
  46579. }
  46580. if (currentRoute && typeof currentRoute.params === 'object') {
  46581. for (var key in currentRoute.params) {
  46582. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  46583. location.params[key] = currentRoute.params[key];
  46584. }
  46585. }
  46586. }
  46587. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  46588. return _createRoute(record, location, redirectedFrom)
  46589. } else if (location.path) {
  46590. location.params = {};
  46591. for (var i = 0; i < pathList.length; i++) {
  46592. var path = pathList[i];
  46593. var record$1 = pathMap[path];
  46594. if (matchRoute(record$1.regex, location.path, location.params)) {
  46595. return _createRoute(record$1, location, redirectedFrom)
  46596. }
  46597. }
  46598. }
  46599. // no match
  46600. return _createRoute(null, location)
  46601. }
  46602. function redirect (
  46603. record,
  46604. location
  46605. ) {
  46606. var originalRedirect = record.redirect;
  46607. var redirect = typeof originalRedirect === 'function'
  46608. ? originalRedirect(createRoute(record, location, null, router))
  46609. : originalRedirect;
  46610. if (typeof redirect === 'string') {
  46611. redirect = { path: redirect };
  46612. }
  46613. if (!redirect || typeof redirect !== 'object') {
  46614. if (true) {
  46615. warn(
  46616. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  46617. );
  46618. }
  46619. return _createRoute(null, location)
  46620. }
  46621. var re = redirect;
  46622. var name = re.name;
  46623. var path = re.path;
  46624. var query = location.query;
  46625. var hash = location.hash;
  46626. var params = location.params;
  46627. query = re.hasOwnProperty('query') ? re.query : query;
  46628. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  46629. params = re.hasOwnProperty('params') ? re.params : params;
  46630. if (name) {
  46631. // resolved named direct
  46632. var targetRecord = nameMap[name];
  46633. if (true) {
  46634. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  46635. }
  46636. return match({
  46637. _normalized: true,
  46638. name: name,
  46639. query: query,
  46640. hash: hash,
  46641. params: params
  46642. }, undefined, location)
  46643. } else if (path) {
  46644. // 1. resolve relative redirect
  46645. var rawPath = resolveRecordPath(path, record);
  46646. // 2. resolve params
  46647. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  46648. // 3. rematch with existing query and hash
  46649. return match({
  46650. _normalized: true,
  46651. path: resolvedPath,
  46652. query: query,
  46653. hash: hash
  46654. }, undefined, location)
  46655. } else {
  46656. if (true) {
  46657. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  46658. }
  46659. return _createRoute(null, location)
  46660. }
  46661. }
  46662. function alias (
  46663. record,
  46664. location,
  46665. matchAs
  46666. ) {
  46667. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  46668. var aliasedMatch = match({
  46669. _normalized: true,
  46670. path: aliasedPath
  46671. });
  46672. if (aliasedMatch) {
  46673. var matched = aliasedMatch.matched;
  46674. var aliasedRecord = matched[matched.length - 1];
  46675. location.params = aliasedMatch.params;
  46676. return _createRoute(aliasedRecord, location)
  46677. }
  46678. return _createRoute(null, location)
  46679. }
  46680. function _createRoute (
  46681. record,
  46682. location,
  46683. redirectedFrom
  46684. ) {
  46685. if (record && record.redirect) {
  46686. return redirect(record, redirectedFrom || location)
  46687. }
  46688. if (record && record.matchAs) {
  46689. return alias(record, location, record.matchAs)
  46690. }
  46691. return createRoute(record, location, redirectedFrom, router)
  46692. }
  46693. return {
  46694. match: match,
  46695. addRoutes: addRoutes
  46696. }
  46697. }
  46698. function matchRoute (
  46699. regex,
  46700. path,
  46701. params
  46702. ) {
  46703. var m = path.match(regex);
  46704. if (!m) {
  46705. return false
  46706. } else if (!params) {
  46707. return true
  46708. }
  46709. for (var i = 1, len = m.length; i < len; ++i) {
  46710. var key = regex.keys[i - 1];
  46711. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  46712. if (key) {
  46713. // Fix #1994: using * with props: true generates a param named 0
  46714. params[key.name || 'pathMatch'] = val;
  46715. }
  46716. }
  46717. return true
  46718. }
  46719. function resolveRecordPath (path, record) {
  46720. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  46721. }
  46722. /* */
  46723. // use User Timing api (if present) for more accurate key precision
  46724. var Time =
  46725. inBrowser && window.performance && window.performance.now
  46726. ? window.performance
  46727. : Date;
  46728. function genStateKey () {
  46729. return Time.now().toFixed(3)
  46730. }
  46731. var _key = genStateKey();
  46732. function getStateKey () {
  46733. return _key
  46734. }
  46735. function setStateKey (key) {
  46736. return (_key = key)
  46737. }
  46738. /* */
  46739. var positionStore = Object.create(null);
  46740. function setupScroll () {
  46741. // Fix for #1585 for Firefox
  46742. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  46743. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  46744. // window.location.protocol + '//' + window.location.host
  46745. // location.host contains the port and location.hostname doesn't
  46746. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  46747. var absolutePath = window.location.href.replace(protocolAndPath, '');
  46748. // preserve existing history state as it could be overriden by the user
  46749. var stateCopy = extend({}, window.history.state);
  46750. stateCopy.key = getStateKey();
  46751. window.history.replaceState(stateCopy, '', absolutePath);
  46752. window.addEventListener('popstate', function (e) {
  46753. saveScrollPosition();
  46754. if (e.state && e.state.key) {
  46755. setStateKey(e.state.key);
  46756. }
  46757. });
  46758. }
  46759. function handleScroll (
  46760. router,
  46761. to,
  46762. from,
  46763. isPop
  46764. ) {
  46765. if (!router.app) {
  46766. return
  46767. }
  46768. var behavior = router.options.scrollBehavior;
  46769. if (!behavior) {
  46770. return
  46771. }
  46772. if (true) {
  46773. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  46774. }
  46775. // wait until re-render finishes before scrolling
  46776. router.app.$nextTick(function () {
  46777. var position = getScrollPosition();
  46778. var shouldScroll = behavior.call(
  46779. router,
  46780. to,
  46781. from,
  46782. isPop ? position : null
  46783. );
  46784. if (!shouldScroll) {
  46785. return
  46786. }
  46787. if (typeof shouldScroll.then === 'function') {
  46788. shouldScroll
  46789. .then(function (shouldScroll) {
  46790. scrollToPosition((shouldScroll), position);
  46791. })
  46792. .catch(function (err) {
  46793. if (true) {
  46794. assert(false, err.toString());
  46795. }
  46796. });
  46797. } else {
  46798. scrollToPosition(shouldScroll, position);
  46799. }
  46800. });
  46801. }
  46802. function saveScrollPosition () {
  46803. var key = getStateKey();
  46804. if (key) {
  46805. positionStore[key] = {
  46806. x: window.pageXOffset,
  46807. y: window.pageYOffset
  46808. };
  46809. }
  46810. }
  46811. function getScrollPosition () {
  46812. var key = getStateKey();
  46813. if (key) {
  46814. return positionStore[key]
  46815. }
  46816. }
  46817. function getElementPosition (el, offset) {
  46818. var docEl = document.documentElement;
  46819. var docRect = docEl.getBoundingClientRect();
  46820. var elRect = el.getBoundingClientRect();
  46821. return {
  46822. x: elRect.left - docRect.left - offset.x,
  46823. y: elRect.top - docRect.top - offset.y
  46824. }
  46825. }
  46826. function isValidPosition (obj) {
  46827. return isNumber(obj.x) || isNumber(obj.y)
  46828. }
  46829. function normalizePosition (obj) {
  46830. return {
  46831. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  46832. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  46833. }
  46834. }
  46835. function normalizeOffset (obj) {
  46836. return {
  46837. x: isNumber(obj.x) ? obj.x : 0,
  46838. y: isNumber(obj.y) ? obj.y : 0
  46839. }
  46840. }
  46841. function isNumber (v) {
  46842. return typeof v === 'number'
  46843. }
  46844. var hashStartsWithNumberRE = /^#\d/;
  46845. function scrollToPosition (shouldScroll, position) {
  46846. var isObject = typeof shouldScroll === 'object';
  46847. if (isObject && typeof shouldScroll.selector === 'string') {
  46848. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  46849. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  46850. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  46851. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  46852. : document.querySelector(shouldScroll.selector);
  46853. if (el) {
  46854. var offset =
  46855. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  46856. ? shouldScroll.offset
  46857. : {};
  46858. offset = normalizeOffset(offset);
  46859. position = getElementPosition(el, offset);
  46860. } else if (isValidPosition(shouldScroll)) {
  46861. position = normalizePosition(shouldScroll);
  46862. }
  46863. } else if (isObject && isValidPosition(shouldScroll)) {
  46864. position = normalizePosition(shouldScroll);
  46865. }
  46866. if (position) {
  46867. window.scrollTo(position.x, position.y);
  46868. }
  46869. }
  46870. /* */
  46871. var supportsPushState =
  46872. inBrowser &&
  46873. (function () {
  46874. var ua = window.navigator.userAgent;
  46875. if (
  46876. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  46877. ua.indexOf('Mobile Safari') !== -1 &&
  46878. ua.indexOf('Chrome') === -1 &&
  46879. ua.indexOf('Windows Phone') === -1
  46880. ) {
  46881. return false
  46882. }
  46883. return window.history && 'pushState' in window.history
  46884. })();
  46885. function pushState (url, replace) {
  46886. saveScrollPosition();
  46887. // try...catch the pushState call to get around Safari
  46888. // DOM Exception 18 where it limits to 100 pushState calls
  46889. var history = window.history;
  46890. try {
  46891. if (replace) {
  46892. // preserve existing history state as it could be overriden by the user
  46893. var stateCopy = extend({}, history.state);
  46894. stateCopy.key = getStateKey();
  46895. history.replaceState(stateCopy, '', url);
  46896. } else {
  46897. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  46898. }
  46899. } catch (e) {
  46900. window.location[replace ? 'replace' : 'assign'](url);
  46901. }
  46902. }
  46903. function replaceState (url) {
  46904. pushState(url, true);
  46905. }
  46906. /* */
  46907. function runQueue (queue, fn, cb) {
  46908. var step = function (index) {
  46909. if (index >= queue.length) {
  46910. cb();
  46911. } else {
  46912. if (queue[index]) {
  46913. fn(queue[index], function () {
  46914. step(index + 1);
  46915. });
  46916. } else {
  46917. step(index + 1);
  46918. }
  46919. }
  46920. };
  46921. step(0);
  46922. }
  46923. /* */
  46924. function resolveAsyncComponents (matched) {
  46925. return function (to, from, next) {
  46926. var hasAsync = false;
  46927. var pending = 0;
  46928. var error = null;
  46929. flatMapComponents(matched, function (def, _, match, key) {
  46930. // if it's a function and doesn't have cid attached,
  46931. // assume it's an async component resolve function.
  46932. // we are not using Vue's default async resolving mechanism because
  46933. // we want to halt the navigation until the incoming component has been
  46934. // resolved.
  46935. if (typeof def === 'function' && def.cid === undefined) {
  46936. hasAsync = true;
  46937. pending++;
  46938. var resolve = once(function (resolvedDef) {
  46939. if (isESModule(resolvedDef)) {
  46940. resolvedDef = resolvedDef.default;
  46941. }
  46942. // save resolved on async factory in case it's used elsewhere
  46943. def.resolved = typeof resolvedDef === 'function'
  46944. ? resolvedDef
  46945. : _Vue.extend(resolvedDef);
  46946. match.components[key] = resolvedDef;
  46947. pending--;
  46948. if (pending <= 0) {
  46949. next();
  46950. }
  46951. });
  46952. var reject = once(function (reason) {
  46953. var msg = "Failed to resolve async component " + key + ": " + reason;
  46954. true && warn(false, msg);
  46955. if (!error) {
  46956. error = isError(reason)
  46957. ? reason
  46958. : new Error(msg);
  46959. next(error);
  46960. }
  46961. });
  46962. var res;
  46963. try {
  46964. res = def(resolve, reject);
  46965. } catch (e) {
  46966. reject(e);
  46967. }
  46968. if (res) {
  46969. if (typeof res.then === 'function') {
  46970. res.then(resolve, reject);
  46971. } else {
  46972. // new syntax in Vue 2.3
  46973. var comp = res.component;
  46974. if (comp && typeof comp.then === 'function') {
  46975. comp.then(resolve, reject);
  46976. }
  46977. }
  46978. }
  46979. }
  46980. });
  46981. if (!hasAsync) { next(); }
  46982. }
  46983. }
  46984. function flatMapComponents (
  46985. matched,
  46986. fn
  46987. ) {
  46988. return flatten(matched.map(function (m) {
  46989. return Object.keys(m.components).map(function (key) { return fn(
  46990. m.components[key],
  46991. m.instances[key],
  46992. m, key
  46993. ); })
  46994. }))
  46995. }
  46996. function flatten (arr) {
  46997. return Array.prototype.concat.apply([], arr)
  46998. }
  46999. var hasSymbol =
  47000. typeof Symbol === 'function' &&
  47001. typeof Symbol.toStringTag === 'symbol';
  47002. function isESModule (obj) {
  47003. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  47004. }
  47005. // in Webpack 2, require.ensure now also returns a Promise
  47006. // so the resolve/reject functions may get called an extra time
  47007. // if the user uses an arrow function shorthand that happens to
  47008. // return that Promise.
  47009. function once (fn) {
  47010. var called = false;
  47011. return function () {
  47012. var args = [], len = arguments.length;
  47013. while ( len-- ) args[ len ] = arguments[ len ];
  47014. if (called) { return }
  47015. called = true;
  47016. return fn.apply(this, args)
  47017. }
  47018. }
  47019. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  47020. function NavigationDuplicated (normalizedLocation) {
  47021. Error.call(this);
  47022. this.name = this._name = 'NavigationDuplicated';
  47023. // passing the message to super() doesn't seem to work in the transpiled version
  47024. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  47025. // add a stack property so services like Sentry can correctly display it
  47026. Object.defineProperty(this, 'stack', {
  47027. value: new Error().stack,
  47028. writable: true,
  47029. configurable: true
  47030. });
  47031. // we could also have used
  47032. // Error.captureStackTrace(this, this.constructor)
  47033. // but it only exists on node and chrome
  47034. }
  47035. if ( Error ) NavigationDuplicated.__proto__ = Error;
  47036. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  47037. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  47038. return NavigationDuplicated;
  47039. }(Error));
  47040. // support IE9
  47041. NavigationDuplicated._name = 'NavigationDuplicated';
  47042. /* */
  47043. var History = function History (router, base) {
  47044. this.router = router;
  47045. this.base = normalizeBase(base);
  47046. // start with a route object that stands for "nowhere"
  47047. this.current = START;
  47048. this.pending = null;
  47049. this.ready = false;
  47050. this.readyCbs = [];
  47051. this.readyErrorCbs = [];
  47052. this.errorCbs = [];
  47053. };
  47054. History.prototype.listen = function listen (cb) {
  47055. this.cb = cb;
  47056. };
  47057. History.prototype.onReady = function onReady (cb, errorCb) {
  47058. if (this.ready) {
  47059. cb();
  47060. } else {
  47061. this.readyCbs.push(cb);
  47062. if (errorCb) {
  47063. this.readyErrorCbs.push(errorCb);
  47064. }
  47065. }
  47066. };
  47067. History.prototype.onError = function onError (errorCb) {
  47068. this.errorCbs.push(errorCb);
  47069. };
  47070. History.prototype.transitionTo = function transitionTo (
  47071. location,
  47072. onComplete,
  47073. onAbort
  47074. ) {
  47075. var this$1 = this;
  47076. var route = this.router.match(location, this.current);
  47077. this.confirmTransition(
  47078. route,
  47079. function () {
  47080. this$1.updateRoute(route);
  47081. onComplete && onComplete(route);
  47082. this$1.ensureURL();
  47083. // fire ready cbs once
  47084. if (!this$1.ready) {
  47085. this$1.ready = true;
  47086. this$1.readyCbs.forEach(function (cb) {
  47087. cb(route);
  47088. });
  47089. }
  47090. },
  47091. function (err) {
  47092. if (onAbort) {
  47093. onAbort(err);
  47094. }
  47095. if (err && !this$1.ready) {
  47096. this$1.ready = true;
  47097. this$1.readyErrorCbs.forEach(function (cb) {
  47098. cb(err);
  47099. });
  47100. }
  47101. }
  47102. );
  47103. };
  47104. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  47105. var this$1 = this;
  47106. var current = this.current;
  47107. var abort = function (err) {
  47108. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  47109. // When the user navigates through history through back/forward buttons
  47110. // we do not want to throw the error. We only throw it if directly calling
  47111. // push/replace. That's why it's not included in isError
  47112. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  47113. if (this$1.errorCbs.length) {
  47114. this$1.errorCbs.forEach(function (cb) {
  47115. cb(err);
  47116. });
  47117. } else {
  47118. warn(false, 'uncaught error during route navigation:');
  47119. console.error(err);
  47120. }
  47121. }
  47122. onAbort && onAbort(err);
  47123. };
  47124. if (
  47125. isSameRoute(route, current) &&
  47126. // in the case the route map has been dynamically appended to
  47127. route.matched.length === current.matched.length
  47128. ) {
  47129. this.ensureURL();
  47130. return abort(new NavigationDuplicated(route))
  47131. }
  47132. var ref = resolveQueue(
  47133. this.current.matched,
  47134. route.matched
  47135. );
  47136. var updated = ref.updated;
  47137. var deactivated = ref.deactivated;
  47138. var activated = ref.activated;
  47139. var queue = [].concat(
  47140. // in-component leave guards
  47141. extractLeaveGuards(deactivated),
  47142. // global before hooks
  47143. this.router.beforeHooks,
  47144. // in-component update hooks
  47145. extractUpdateHooks(updated),
  47146. // in-config enter guards
  47147. activated.map(function (m) { return m.beforeEnter; }),
  47148. // async components
  47149. resolveAsyncComponents(activated)
  47150. );
  47151. this.pending = route;
  47152. var iterator = function (hook, next) {
  47153. if (this$1.pending !== route) {
  47154. return abort()
  47155. }
  47156. try {
  47157. hook(route, current, function (to) {
  47158. if (to === false || isError(to)) {
  47159. // next(false) -> abort navigation, ensure current URL
  47160. this$1.ensureURL(true);
  47161. abort(to);
  47162. } else if (
  47163. typeof to === 'string' ||
  47164. (typeof to === 'object' &&
  47165. (typeof to.path === 'string' || typeof to.name === 'string'))
  47166. ) {
  47167. // next('/') or next({ path: '/' }) -> redirect
  47168. abort();
  47169. if (typeof to === 'object' && to.replace) {
  47170. this$1.replace(to);
  47171. } else {
  47172. this$1.push(to);
  47173. }
  47174. } else {
  47175. // confirm transition and pass on the value
  47176. next(to);
  47177. }
  47178. });
  47179. } catch (e) {
  47180. abort(e);
  47181. }
  47182. };
  47183. runQueue(queue, iterator, function () {
  47184. var postEnterCbs = [];
  47185. var isValid = function () { return this$1.current === route; };
  47186. // wait until async components are resolved before
  47187. // extracting in-component enter guards
  47188. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  47189. var queue = enterGuards.concat(this$1.router.resolveHooks);
  47190. runQueue(queue, iterator, function () {
  47191. if (this$1.pending !== route) {
  47192. return abort()
  47193. }
  47194. this$1.pending = null;
  47195. onComplete(route);
  47196. if (this$1.router.app) {
  47197. this$1.router.app.$nextTick(function () {
  47198. postEnterCbs.forEach(function (cb) {
  47199. cb();
  47200. });
  47201. });
  47202. }
  47203. });
  47204. });
  47205. };
  47206. History.prototype.updateRoute = function updateRoute (route) {
  47207. var prev = this.current;
  47208. this.current = route;
  47209. this.cb && this.cb(route);
  47210. this.router.afterHooks.forEach(function (hook) {
  47211. hook && hook(route, prev);
  47212. });
  47213. };
  47214. function normalizeBase (base) {
  47215. if (!base) {
  47216. if (inBrowser) {
  47217. // respect <base> tag
  47218. var baseEl = document.querySelector('base');
  47219. base = (baseEl && baseEl.getAttribute('href')) || '/';
  47220. // strip full URL origin
  47221. base = base.replace(/^https?:\/\/[^\/]+/, '');
  47222. } else {
  47223. base = '/';
  47224. }
  47225. }
  47226. // make sure there's the starting slash
  47227. if (base.charAt(0) !== '/') {
  47228. base = '/' + base;
  47229. }
  47230. // remove trailing slash
  47231. return base.replace(/\/$/, '')
  47232. }
  47233. function resolveQueue (
  47234. current,
  47235. next
  47236. ) {
  47237. var i;
  47238. var max = Math.max(current.length, next.length);
  47239. for (i = 0; i < max; i++) {
  47240. if (current[i] !== next[i]) {
  47241. break
  47242. }
  47243. }
  47244. return {
  47245. updated: next.slice(0, i),
  47246. activated: next.slice(i),
  47247. deactivated: current.slice(i)
  47248. }
  47249. }
  47250. function extractGuards (
  47251. records,
  47252. name,
  47253. bind,
  47254. reverse
  47255. ) {
  47256. var guards = flatMapComponents(records, function (def, instance, match, key) {
  47257. var guard = extractGuard(def, name);
  47258. if (guard) {
  47259. return Array.isArray(guard)
  47260. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  47261. : bind(guard, instance, match, key)
  47262. }
  47263. });
  47264. return flatten(reverse ? guards.reverse() : guards)
  47265. }
  47266. function extractGuard (
  47267. def,
  47268. key
  47269. ) {
  47270. if (typeof def !== 'function') {
  47271. // extend now so that global mixins are applied.
  47272. def = _Vue.extend(def);
  47273. }
  47274. return def.options[key]
  47275. }
  47276. function extractLeaveGuards (deactivated) {
  47277. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  47278. }
  47279. function extractUpdateHooks (updated) {
  47280. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  47281. }
  47282. function bindGuard (guard, instance) {
  47283. if (instance) {
  47284. return function boundRouteGuard () {
  47285. return guard.apply(instance, arguments)
  47286. }
  47287. }
  47288. }
  47289. function extractEnterGuards (
  47290. activated,
  47291. cbs,
  47292. isValid
  47293. ) {
  47294. return extractGuards(
  47295. activated,
  47296. 'beforeRouteEnter',
  47297. function (guard, _, match, key) {
  47298. return bindEnterGuard(guard, match, key, cbs, isValid)
  47299. }
  47300. )
  47301. }
  47302. function bindEnterGuard (
  47303. guard,
  47304. match,
  47305. key,
  47306. cbs,
  47307. isValid
  47308. ) {
  47309. return function routeEnterGuard (to, from, next) {
  47310. return guard(to, from, function (cb) {
  47311. if (typeof cb === 'function') {
  47312. cbs.push(function () {
  47313. // #750
  47314. // if a router-view is wrapped with an out-in transition,
  47315. // the instance may not have been registered at this time.
  47316. // we will need to poll for registration until current route
  47317. // is no longer valid.
  47318. poll(cb, match.instances, key, isValid);
  47319. });
  47320. }
  47321. next(cb);
  47322. })
  47323. }
  47324. }
  47325. function poll (
  47326. cb, // somehow flow cannot infer this is a function
  47327. instances,
  47328. key,
  47329. isValid
  47330. ) {
  47331. if (
  47332. instances[key] &&
  47333. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  47334. ) {
  47335. cb(instances[key]);
  47336. } else if (isValid()) {
  47337. setTimeout(function () {
  47338. poll(cb, instances, key, isValid);
  47339. }, 16);
  47340. }
  47341. }
  47342. /* */
  47343. var HTML5History = /*@__PURE__*/(function (History) {
  47344. function HTML5History (router, base) {
  47345. var this$1 = this;
  47346. History.call(this, router, base);
  47347. var expectScroll = router.options.scrollBehavior;
  47348. var supportsScroll = supportsPushState && expectScroll;
  47349. if (supportsScroll) {
  47350. setupScroll();
  47351. }
  47352. var initLocation = getLocation(this.base);
  47353. window.addEventListener('popstate', function (e) {
  47354. var current = this$1.current;
  47355. // Avoiding first `popstate` event dispatched in some browsers but first
  47356. // history route not updated since async guard at the same time.
  47357. var location = getLocation(this$1.base);
  47358. if (this$1.current === START && location === initLocation) {
  47359. return
  47360. }
  47361. this$1.transitionTo(location, function (route) {
  47362. if (supportsScroll) {
  47363. handleScroll(router, route, current, true);
  47364. }
  47365. });
  47366. });
  47367. }
  47368. if ( History ) HTML5History.__proto__ = History;
  47369. HTML5History.prototype = Object.create( History && History.prototype );
  47370. HTML5History.prototype.constructor = HTML5History;
  47371. HTML5History.prototype.go = function go (n) {
  47372. window.history.go(n);
  47373. };
  47374. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  47375. var this$1 = this;
  47376. var ref = this;
  47377. var fromRoute = ref.current;
  47378. this.transitionTo(location, function (route) {
  47379. pushState(cleanPath(this$1.base + route.fullPath));
  47380. handleScroll(this$1.router, route, fromRoute, false);
  47381. onComplete && onComplete(route);
  47382. }, onAbort);
  47383. };
  47384. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  47385. var this$1 = this;
  47386. var ref = this;
  47387. var fromRoute = ref.current;
  47388. this.transitionTo(location, function (route) {
  47389. replaceState(cleanPath(this$1.base + route.fullPath));
  47390. handleScroll(this$1.router, route, fromRoute, false);
  47391. onComplete && onComplete(route);
  47392. }, onAbort);
  47393. };
  47394. HTML5History.prototype.ensureURL = function ensureURL (push) {
  47395. if (getLocation(this.base) !== this.current.fullPath) {
  47396. var current = cleanPath(this.base + this.current.fullPath);
  47397. push ? pushState(current) : replaceState(current);
  47398. }
  47399. };
  47400. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  47401. return getLocation(this.base)
  47402. };
  47403. return HTML5History;
  47404. }(History));
  47405. function getLocation (base) {
  47406. var path = decodeURI(window.location.pathname);
  47407. if (base && path.indexOf(base) === 0) {
  47408. path = path.slice(base.length);
  47409. }
  47410. return (path || '/') + window.location.search + window.location.hash
  47411. }
  47412. /* */
  47413. var HashHistory = /*@__PURE__*/(function (History) {
  47414. function HashHistory (router, base, fallback) {
  47415. History.call(this, router, base);
  47416. // check history fallback deeplinking
  47417. if (fallback && checkFallback(this.base)) {
  47418. return
  47419. }
  47420. ensureSlash();
  47421. }
  47422. if ( History ) HashHistory.__proto__ = History;
  47423. HashHistory.prototype = Object.create( History && History.prototype );
  47424. HashHistory.prototype.constructor = HashHistory;
  47425. // this is delayed until the app mounts
  47426. // to avoid the hashchange listener being fired too early
  47427. HashHistory.prototype.setupListeners = function setupListeners () {
  47428. var this$1 = this;
  47429. var router = this.router;
  47430. var expectScroll = router.options.scrollBehavior;
  47431. var supportsScroll = supportsPushState && expectScroll;
  47432. if (supportsScroll) {
  47433. setupScroll();
  47434. }
  47435. window.addEventListener(
  47436. supportsPushState ? 'popstate' : 'hashchange',
  47437. function () {
  47438. var current = this$1.current;
  47439. if (!ensureSlash()) {
  47440. return
  47441. }
  47442. this$1.transitionTo(getHash(), function (route) {
  47443. if (supportsScroll) {
  47444. handleScroll(this$1.router, route, current, true);
  47445. }
  47446. if (!supportsPushState) {
  47447. replaceHash(route.fullPath);
  47448. }
  47449. });
  47450. }
  47451. );
  47452. };
  47453. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  47454. var this$1 = this;
  47455. var ref = this;
  47456. var fromRoute = ref.current;
  47457. this.transitionTo(
  47458. location,
  47459. function (route) {
  47460. pushHash(route.fullPath);
  47461. handleScroll(this$1.router, route, fromRoute, false);
  47462. onComplete && onComplete(route);
  47463. },
  47464. onAbort
  47465. );
  47466. };
  47467. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  47468. var this$1 = this;
  47469. var ref = this;
  47470. var fromRoute = ref.current;
  47471. this.transitionTo(
  47472. location,
  47473. function (route) {
  47474. replaceHash(route.fullPath);
  47475. handleScroll(this$1.router, route, fromRoute, false);
  47476. onComplete && onComplete(route);
  47477. },
  47478. onAbort
  47479. );
  47480. };
  47481. HashHistory.prototype.go = function go (n) {
  47482. window.history.go(n);
  47483. };
  47484. HashHistory.prototype.ensureURL = function ensureURL (push) {
  47485. var current = this.current.fullPath;
  47486. if (getHash() !== current) {
  47487. push ? pushHash(current) : replaceHash(current);
  47488. }
  47489. };
  47490. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  47491. return getHash()
  47492. };
  47493. return HashHistory;
  47494. }(History));
  47495. function checkFallback (base) {
  47496. var location = getLocation(base);
  47497. if (!/^\/#/.test(location)) {
  47498. window.location.replace(cleanPath(base + '/#' + location));
  47499. return true
  47500. }
  47501. }
  47502. function ensureSlash () {
  47503. var path = getHash();
  47504. if (path.charAt(0) === '/') {
  47505. return true
  47506. }
  47507. replaceHash('/' + path);
  47508. return false
  47509. }
  47510. function getHash () {
  47511. // We can't use window.location.hash here because it's not
  47512. // consistent across browsers - Firefox will pre-decode it!
  47513. var href = window.location.href;
  47514. var index = href.indexOf('#');
  47515. // empty path
  47516. if (index < 0) { return '' }
  47517. href = href.slice(index + 1);
  47518. // decode the hash but not the search or hash
  47519. // as search(query) is already decoded
  47520. // https://github.com/vuejs/vue-router/issues/2708
  47521. var searchIndex = href.indexOf('?');
  47522. if (searchIndex < 0) {
  47523. var hashIndex = href.indexOf('#');
  47524. if (hashIndex > -1) {
  47525. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  47526. } else { href = decodeURI(href); }
  47527. } else {
  47528. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  47529. }
  47530. return href
  47531. }
  47532. function getUrl (path) {
  47533. var href = window.location.href;
  47534. var i = href.indexOf('#');
  47535. var base = i >= 0 ? href.slice(0, i) : href;
  47536. return (base + "#" + path)
  47537. }
  47538. function pushHash (path) {
  47539. if (supportsPushState) {
  47540. pushState(getUrl(path));
  47541. } else {
  47542. window.location.hash = path;
  47543. }
  47544. }
  47545. function replaceHash (path) {
  47546. if (supportsPushState) {
  47547. replaceState(getUrl(path));
  47548. } else {
  47549. window.location.replace(getUrl(path));
  47550. }
  47551. }
  47552. /* */
  47553. var AbstractHistory = /*@__PURE__*/(function (History) {
  47554. function AbstractHistory (router, base) {
  47555. History.call(this, router, base);
  47556. this.stack = [];
  47557. this.index = -1;
  47558. }
  47559. if ( History ) AbstractHistory.__proto__ = History;
  47560. AbstractHistory.prototype = Object.create( History && History.prototype );
  47561. AbstractHistory.prototype.constructor = AbstractHistory;
  47562. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  47563. var this$1 = this;
  47564. this.transitionTo(
  47565. location,
  47566. function (route) {
  47567. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  47568. this$1.index++;
  47569. onComplete && onComplete(route);
  47570. },
  47571. onAbort
  47572. );
  47573. };
  47574. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  47575. var this$1 = this;
  47576. this.transitionTo(
  47577. location,
  47578. function (route) {
  47579. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  47580. onComplete && onComplete(route);
  47581. },
  47582. onAbort
  47583. );
  47584. };
  47585. AbstractHistory.prototype.go = function go (n) {
  47586. var this$1 = this;
  47587. var targetIndex = this.index + n;
  47588. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  47589. return
  47590. }
  47591. var route = this.stack[targetIndex];
  47592. this.confirmTransition(
  47593. route,
  47594. function () {
  47595. this$1.index = targetIndex;
  47596. this$1.updateRoute(route);
  47597. },
  47598. function (err) {
  47599. if (isExtendedError(NavigationDuplicated, err)) {
  47600. this$1.index = targetIndex;
  47601. }
  47602. }
  47603. );
  47604. };
  47605. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  47606. var current = this.stack[this.stack.length - 1];
  47607. return current ? current.fullPath : '/'
  47608. };
  47609. AbstractHistory.prototype.ensureURL = function ensureURL () {
  47610. // noop
  47611. };
  47612. return AbstractHistory;
  47613. }(History));
  47614. /* */
  47615. var VueRouter = function VueRouter (options) {
  47616. if ( options === void 0 ) options = {};
  47617. this.app = null;
  47618. this.apps = [];
  47619. this.options = options;
  47620. this.beforeHooks = [];
  47621. this.resolveHooks = [];
  47622. this.afterHooks = [];
  47623. this.matcher = createMatcher(options.routes || [], this);
  47624. var mode = options.mode || 'hash';
  47625. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  47626. if (this.fallback) {
  47627. mode = 'hash';
  47628. }
  47629. if (!inBrowser) {
  47630. mode = 'abstract';
  47631. }
  47632. this.mode = mode;
  47633. switch (mode) {
  47634. case 'history':
  47635. this.history = new HTML5History(this, options.base);
  47636. break
  47637. case 'hash':
  47638. this.history = new HashHistory(this, options.base, this.fallback);
  47639. break
  47640. case 'abstract':
  47641. this.history = new AbstractHistory(this, options.base);
  47642. break
  47643. default:
  47644. if (true) {
  47645. assert(false, ("invalid mode: " + mode));
  47646. }
  47647. }
  47648. };
  47649. var prototypeAccessors = { currentRoute: { configurable: true } };
  47650. VueRouter.prototype.match = function match (
  47651. raw,
  47652. current,
  47653. redirectedFrom
  47654. ) {
  47655. return this.matcher.match(raw, current, redirectedFrom)
  47656. };
  47657. prototypeAccessors.currentRoute.get = function () {
  47658. return this.history && this.history.current
  47659. };
  47660. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  47661. var this$1 = this;
  47662. true && assert(
  47663. install.installed,
  47664. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  47665. "before creating root instance."
  47666. );
  47667. this.apps.push(app);
  47668. // set up app destroyed handler
  47669. // https://github.com/vuejs/vue-router/issues/2639
  47670. app.$once('hook:destroyed', function () {
  47671. // clean out app from this.apps array once destroyed
  47672. var index = this$1.apps.indexOf(app);
  47673. if (index > -1) { this$1.apps.splice(index, 1); }
  47674. // ensure we still have a main app or null if no apps
  47675. // we do not release the router so it can be reused
  47676. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  47677. });
  47678. // main app previously initialized
  47679. // return as we don't need to set up new history listener
  47680. if (this.app) {
  47681. return
  47682. }
  47683. this.app = app;
  47684. var history = this.history;
  47685. if (history instanceof HTML5History) {
  47686. history.transitionTo(history.getCurrentLocation());
  47687. } else if (history instanceof HashHistory) {
  47688. var setupHashListener = function () {
  47689. history.setupListeners();
  47690. };
  47691. history.transitionTo(
  47692. history.getCurrentLocation(),
  47693. setupHashListener,
  47694. setupHashListener
  47695. );
  47696. }
  47697. history.listen(function (route) {
  47698. this$1.apps.forEach(function (app) {
  47699. app._route = route;
  47700. });
  47701. });
  47702. };
  47703. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  47704. return registerHook(this.beforeHooks, fn)
  47705. };
  47706. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  47707. return registerHook(this.resolveHooks, fn)
  47708. };
  47709. VueRouter.prototype.afterEach = function afterEach (fn) {
  47710. return registerHook(this.afterHooks, fn)
  47711. };
  47712. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  47713. this.history.onReady(cb, errorCb);
  47714. };
  47715. VueRouter.prototype.onError = function onError (errorCb) {
  47716. this.history.onError(errorCb);
  47717. };
  47718. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  47719. var this$1 = this;
  47720. // $flow-disable-line
  47721. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47722. return new Promise(function (resolve, reject) {
  47723. this$1.history.push(location, resolve, reject);
  47724. })
  47725. } else {
  47726. this.history.push(location, onComplete, onAbort);
  47727. }
  47728. };
  47729. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  47730. var this$1 = this;
  47731. // $flow-disable-line
  47732. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47733. return new Promise(function (resolve, reject) {
  47734. this$1.history.replace(location, resolve, reject);
  47735. })
  47736. } else {
  47737. this.history.replace(location, onComplete, onAbort);
  47738. }
  47739. };
  47740. VueRouter.prototype.go = function go (n) {
  47741. this.history.go(n);
  47742. };
  47743. VueRouter.prototype.back = function back () {
  47744. this.go(-1);
  47745. };
  47746. VueRouter.prototype.forward = function forward () {
  47747. this.go(1);
  47748. };
  47749. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  47750. var route = to
  47751. ? to.matched
  47752. ? to
  47753. : this.resolve(to).route
  47754. : this.currentRoute;
  47755. if (!route) {
  47756. return []
  47757. }
  47758. return [].concat.apply([], route.matched.map(function (m) {
  47759. return Object.keys(m.components).map(function (key) {
  47760. return m.components[key]
  47761. })
  47762. }))
  47763. };
  47764. VueRouter.prototype.resolve = function resolve (
  47765. to,
  47766. current,
  47767. append
  47768. ) {
  47769. current = current || this.history.current;
  47770. var location = normalizeLocation(
  47771. to,
  47772. current,
  47773. append,
  47774. this
  47775. );
  47776. var route = this.match(location, current);
  47777. var fullPath = route.redirectedFrom || route.fullPath;
  47778. var base = this.history.base;
  47779. var href = createHref(base, fullPath, this.mode);
  47780. return {
  47781. location: location,
  47782. route: route,
  47783. href: href,
  47784. // for backwards compat
  47785. normalizedTo: location,
  47786. resolved: route
  47787. }
  47788. };
  47789. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  47790. this.matcher.addRoutes(routes);
  47791. if (this.history.current !== START) {
  47792. this.history.transitionTo(this.history.getCurrentLocation());
  47793. }
  47794. };
  47795. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  47796. function registerHook (list, fn) {
  47797. list.push(fn);
  47798. return function () {
  47799. var i = list.indexOf(fn);
  47800. if (i > -1) { list.splice(i, 1); }
  47801. }
  47802. }
  47803. function createHref (base, fullPath, mode) {
  47804. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  47805. return base ? cleanPath(base + '/' + path) : path
  47806. }
  47807. VueRouter.install = install;
  47808. VueRouter.version = '3.1.6';
  47809. if (inBrowser && window.Vue) {
  47810. window.Vue.use(VueRouter);
  47811. }
  47812. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  47813. /***/ }),
  47814. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  47815. /*!*************************************************!*\
  47816. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  47817. \*************************************************/
  47818. /*! no static exports found */
  47819. /***/ (function(module, exports, __webpack_require__) {
  47820. "use strict";
  47821. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  47822. * Vue.js v2.6.11
  47823. * (c) 2014-2019 Evan You
  47824. * Released under the MIT License.
  47825. */
  47826. /* */
  47827. var emptyObject = Object.freeze({});
  47828. // These helpers produce better VM code in JS engines due to their
  47829. // explicitness and function inlining.
  47830. function isUndef (v) {
  47831. return v === undefined || v === null
  47832. }
  47833. function isDef (v) {
  47834. return v !== undefined && v !== null
  47835. }
  47836. function isTrue (v) {
  47837. return v === true
  47838. }
  47839. function isFalse (v) {
  47840. return v === false
  47841. }
  47842. /**
  47843. * Check if value is primitive.
  47844. */
  47845. function isPrimitive (value) {
  47846. return (
  47847. typeof value === 'string' ||
  47848. typeof value === 'number' ||
  47849. // $flow-disable-line
  47850. typeof value === 'symbol' ||
  47851. typeof value === 'boolean'
  47852. )
  47853. }
  47854. /**
  47855. * Quick object check - this is primarily used to tell
  47856. * Objects from primitive values when we know the value
  47857. * is a JSON-compliant type.
  47858. */
  47859. function isObject (obj) {
  47860. return obj !== null && typeof obj === 'object'
  47861. }
  47862. /**
  47863. * Get the raw type string of a value, e.g., [object Object].
  47864. */
  47865. var _toString = Object.prototype.toString;
  47866. function toRawType (value) {
  47867. return _toString.call(value).slice(8, -1)
  47868. }
  47869. /**
  47870. * Strict object type check. Only returns true
  47871. * for plain JavaScript objects.
  47872. */
  47873. function isPlainObject (obj) {
  47874. return _toString.call(obj) === '[object Object]'
  47875. }
  47876. function isRegExp (v) {
  47877. return _toString.call(v) === '[object RegExp]'
  47878. }
  47879. /**
  47880. * Check if val is a valid array index.
  47881. */
  47882. function isValidArrayIndex (val) {
  47883. var n = parseFloat(String(val));
  47884. return n >= 0 && Math.floor(n) === n && isFinite(val)
  47885. }
  47886. function isPromise (val) {
  47887. return (
  47888. isDef(val) &&
  47889. typeof val.then === 'function' &&
  47890. typeof val.catch === 'function'
  47891. )
  47892. }
  47893. /**
  47894. * Convert a value to a string that is actually rendered.
  47895. */
  47896. function toString (val) {
  47897. return val == null
  47898. ? ''
  47899. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  47900. ? JSON.stringify(val, null, 2)
  47901. : String(val)
  47902. }
  47903. /**
  47904. * Convert an input value to a number for persistence.
  47905. * If the conversion fails, return original string.
  47906. */
  47907. function toNumber (val) {
  47908. var n = parseFloat(val);
  47909. return isNaN(n) ? val : n
  47910. }
  47911. /**
  47912. * Make a map and return a function for checking if a key
  47913. * is in that map.
  47914. */
  47915. function makeMap (
  47916. str,
  47917. expectsLowerCase
  47918. ) {
  47919. var map = Object.create(null);
  47920. var list = str.split(',');
  47921. for (var i = 0; i < list.length; i++) {
  47922. map[list[i]] = true;
  47923. }
  47924. return expectsLowerCase
  47925. ? function (val) { return map[val.toLowerCase()]; }
  47926. : function (val) { return map[val]; }
  47927. }
  47928. /**
  47929. * Check if a tag is a built-in tag.
  47930. */
  47931. var isBuiltInTag = makeMap('slot,component', true);
  47932. /**
  47933. * Check if an attribute is a reserved attribute.
  47934. */
  47935. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  47936. /**
  47937. * Remove an item from an array.
  47938. */
  47939. function remove (arr, item) {
  47940. if (arr.length) {
  47941. var index = arr.indexOf(item);
  47942. if (index > -1) {
  47943. return arr.splice(index, 1)
  47944. }
  47945. }
  47946. }
  47947. /**
  47948. * Check whether an object has the property.
  47949. */
  47950. var hasOwnProperty = Object.prototype.hasOwnProperty;
  47951. function hasOwn (obj, key) {
  47952. return hasOwnProperty.call(obj, key)
  47953. }
  47954. /**
  47955. * Create a cached version of a pure function.
  47956. */
  47957. function cached (fn) {
  47958. var cache = Object.create(null);
  47959. return (function cachedFn (str) {
  47960. var hit = cache[str];
  47961. return hit || (cache[str] = fn(str))
  47962. })
  47963. }
  47964. /**
  47965. * Camelize a hyphen-delimited string.
  47966. */
  47967. var camelizeRE = /-(\w)/g;
  47968. var camelize = cached(function (str) {
  47969. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  47970. });
  47971. /**
  47972. * Capitalize a string.
  47973. */
  47974. var capitalize = cached(function (str) {
  47975. return str.charAt(0).toUpperCase() + str.slice(1)
  47976. });
  47977. /**
  47978. * Hyphenate a camelCase string.
  47979. */
  47980. var hyphenateRE = /\B([A-Z])/g;
  47981. var hyphenate = cached(function (str) {
  47982. return str.replace(hyphenateRE, '-$1').toLowerCase()
  47983. });
  47984. /**
  47985. * Simple bind polyfill for environments that do not support it,
  47986. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  47987. * since native bind is now performant enough in most browsers.
  47988. * But removing it would mean breaking code that was able to run in
  47989. * PhantomJS 1.x, so this must be kept for backward compatibility.
  47990. */
  47991. /* istanbul ignore next */
  47992. function polyfillBind (fn, ctx) {
  47993. function boundFn (a) {
  47994. var l = arguments.length;
  47995. return l
  47996. ? l > 1
  47997. ? fn.apply(ctx, arguments)
  47998. : fn.call(ctx, a)
  47999. : fn.call(ctx)
  48000. }
  48001. boundFn._length = fn.length;
  48002. return boundFn
  48003. }
  48004. function nativeBind (fn, ctx) {
  48005. return fn.bind(ctx)
  48006. }
  48007. var bind = Function.prototype.bind
  48008. ? nativeBind
  48009. : polyfillBind;
  48010. /**
  48011. * Convert an Array-like object to a real Array.
  48012. */
  48013. function toArray (list, start) {
  48014. start = start || 0;
  48015. var i = list.length - start;
  48016. var ret = new Array(i);
  48017. while (i--) {
  48018. ret[i] = list[i + start];
  48019. }
  48020. return ret
  48021. }
  48022. /**
  48023. * Mix properties into target object.
  48024. */
  48025. function extend (to, _from) {
  48026. for (var key in _from) {
  48027. to[key] = _from[key];
  48028. }
  48029. return to
  48030. }
  48031. /**
  48032. * Merge an Array of Objects into a single Object.
  48033. */
  48034. function toObject (arr) {
  48035. var res = {};
  48036. for (var i = 0; i < arr.length; i++) {
  48037. if (arr[i]) {
  48038. extend(res, arr[i]);
  48039. }
  48040. }
  48041. return res
  48042. }
  48043. /* eslint-disable no-unused-vars */
  48044. /**
  48045. * Perform no operation.
  48046. * Stubbing args to make Flow happy without leaving useless transpiled code
  48047. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  48048. */
  48049. function noop (a, b, c) {}
  48050. /**
  48051. * Always return false.
  48052. */
  48053. var no = function (a, b, c) { return false; };
  48054. /* eslint-enable no-unused-vars */
  48055. /**
  48056. * Return the same value.
  48057. */
  48058. var identity = function (_) { return _; };
  48059. /**
  48060. * Generate a string containing static keys from compiler modules.
  48061. */
  48062. function genStaticKeys (modules) {
  48063. return modules.reduce(function (keys, m) {
  48064. return keys.concat(m.staticKeys || [])
  48065. }, []).join(',')
  48066. }
  48067. /**
  48068. * Check if two values are loosely equal - that is,
  48069. * if they are plain objects, do they have the same shape?
  48070. */
  48071. function looseEqual (a, b) {
  48072. if (a === b) { return true }
  48073. var isObjectA = isObject(a);
  48074. var isObjectB = isObject(b);
  48075. if (isObjectA && isObjectB) {
  48076. try {
  48077. var isArrayA = Array.isArray(a);
  48078. var isArrayB = Array.isArray(b);
  48079. if (isArrayA && isArrayB) {
  48080. return a.length === b.length && a.every(function (e, i) {
  48081. return looseEqual(e, b[i])
  48082. })
  48083. } else if (a instanceof Date && b instanceof Date) {
  48084. return a.getTime() === b.getTime()
  48085. } else if (!isArrayA && !isArrayB) {
  48086. var keysA = Object.keys(a);
  48087. var keysB = Object.keys(b);
  48088. return keysA.length === keysB.length && keysA.every(function (key) {
  48089. return looseEqual(a[key], b[key])
  48090. })
  48091. } else {
  48092. /* istanbul ignore next */
  48093. return false
  48094. }
  48095. } catch (e) {
  48096. /* istanbul ignore next */
  48097. return false
  48098. }
  48099. } else if (!isObjectA && !isObjectB) {
  48100. return String(a) === String(b)
  48101. } else {
  48102. return false
  48103. }
  48104. }
  48105. /**
  48106. * Return the first index at which a loosely equal value can be
  48107. * found in the array (if value is a plain object, the array must
  48108. * contain an object of the same shape), or -1 if it is not present.
  48109. */
  48110. function looseIndexOf (arr, val) {
  48111. for (var i = 0; i < arr.length; i++) {
  48112. if (looseEqual(arr[i], val)) { return i }
  48113. }
  48114. return -1
  48115. }
  48116. /**
  48117. * Ensure a function is called only once.
  48118. */
  48119. function once (fn) {
  48120. var called = false;
  48121. return function () {
  48122. if (!called) {
  48123. called = true;
  48124. fn.apply(this, arguments);
  48125. }
  48126. }
  48127. }
  48128. var SSR_ATTR = 'data-server-rendered';
  48129. var ASSET_TYPES = [
  48130. 'component',
  48131. 'directive',
  48132. 'filter'
  48133. ];
  48134. var LIFECYCLE_HOOKS = [
  48135. 'beforeCreate',
  48136. 'created',
  48137. 'beforeMount',
  48138. 'mounted',
  48139. 'beforeUpdate',
  48140. 'updated',
  48141. 'beforeDestroy',
  48142. 'destroyed',
  48143. 'activated',
  48144. 'deactivated',
  48145. 'errorCaptured',
  48146. 'serverPrefetch'
  48147. ];
  48148. /* */
  48149. var config = ({
  48150. /**
  48151. * Option merge strategies (used in core/util/options)
  48152. */
  48153. // $flow-disable-line
  48154. optionMergeStrategies: Object.create(null),
  48155. /**
  48156. * Whether to suppress warnings.
  48157. */
  48158. silent: false,
  48159. /**
  48160. * Show production mode tip message on boot?
  48161. */
  48162. productionTip: "development" !== 'production',
  48163. /**
  48164. * Whether to enable devtools
  48165. */
  48166. devtools: "development" !== 'production',
  48167. /**
  48168. * Whether to record perf
  48169. */
  48170. performance: false,
  48171. /**
  48172. * Error handler for watcher errors
  48173. */
  48174. errorHandler: null,
  48175. /**
  48176. * Warn handler for watcher warns
  48177. */
  48178. warnHandler: null,
  48179. /**
  48180. * Ignore certain custom elements
  48181. */
  48182. ignoredElements: [],
  48183. /**
  48184. * Custom user key aliases for v-on
  48185. */
  48186. // $flow-disable-line
  48187. keyCodes: Object.create(null),
  48188. /**
  48189. * Check if a tag is reserved so that it cannot be registered as a
  48190. * component. This is platform-dependent and may be overwritten.
  48191. */
  48192. isReservedTag: no,
  48193. /**
  48194. * Check if an attribute is reserved so that it cannot be used as a component
  48195. * prop. This is platform-dependent and may be overwritten.
  48196. */
  48197. isReservedAttr: no,
  48198. /**
  48199. * Check if a tag is an unknown element.
  48200. * Platform-dependent.
  48201. */
  48202. isUnknownElement: no,
  48203. /**
  48204. * Get the namespace of an element
  48205. */
  48206. getTagNamespace: noop,
  48207. /**
  48208. * Parse the real tag name for the specific platform.
  48209. */
  48210. parsePlatformTagName: identity,
  48211. /**
  48212. * Check if an attribute must be bound using property, e.g. value
  48213. * Platform-dependent.
  48214. */
  48215. mustUseProp: no,
  48216. /**
  48217. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  48218. * This will significantly reduce performance if set to false.
  48219. */
  48220. async: true,
  48221. /**
  48222. * Exposed for legacy reasons
  48223. */
  48224. _lifecycleHooks: LIFECYCLE_HOOKS
  48225. });
  48226. /* */
  48227. /**
  48228. * unicode letters used for parsing html tags, component names and property paths.
  48229. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  48230. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  48231. */
  48232. 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/;
  48233. /**
  48234. * Check if a string starts with $ or _
  48235. */
  48236. function isReserved (str) {
  48237. var c = (str + '').charCodeAt(0);
  48238. return c === 0x24 || c === 0x5F
  48239. }
  48240. /**
  48241. * Define a property.
  48242. */
  48243. function def (obj, key, val, enumerable) {
  48244. Object.defineProperty(obj, key, {
  48245. value: val,
  48246. enumerable: !!enumerable,
  48247. writable: true,
  48248. configurable: true
  48249. });
  48250. }
  48251. /**
  48252. * Parse simple path.
  48253. */
  48254. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  48255. function parsePath (path) {
  48256. if (bailRE.test(path)) {
  48257. return
  48258. }
  48259. var segments = path.split('.');
  48260. return function (obj) {
  48261. for (var i = 0; i < segments.length; i++) {
  48262. if (!obj) { return }
  48263. obj = obj[segments[i]];
  48264. }
  48265. return obj
  48266. }
  48267. }
  48268. /* */
  48269. // can we use __proto__?
  48270. var hasProto = '__proto__' in {};
  48271. // Browser environment sniffing
  48272. var inBrowser = typeof window !== 'undefined';
  48273. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  48274. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  48275. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  48276. var isIE = UA && /msie|trident/.test(UA);
  48277. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  48278. var isEdge = UA && UA.indexOf('edge/') > 0;
  48279. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  48280. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  48281. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  48282. var isPhantomJS = UA && /phantomjs/.test(UA);
  48283. var isFF = UA && UA.match(/firefox\/(\d+)/);
  48284. // Firefox has a "watch" function on Object.prototype...
  48285. var nativeWatch = ({}).watch;
  48286. var supportsPassive = false;
  48287. if (inBrowser) {
  48288. try {
  48289. var opts = {};
  48290. Object.defineProperty(opts, 'passive', ({
  48291. get: function get () {
  48292. /* istanbul ignore next */
  48293. supportsPassive = true;
  48294. }
  48295. })); // https://github.com/facebook/flow/issues/285
  48296. window.addEventListener('test-passive', null, opts);
  48297. } catch (e) {}
  48298. }
  48299. // this needs to be lazy-evaled because vue may be required before
  48300. // vue-server-renderer can set VUE_ENV
  48301. var _isServer;
  48302. var isServerRendering = function () {
  48303. if (_isServer === undefined) {
  48304. /* istanbul ignore if */
  48305. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  48306. // detect presence of vue-server-renderer and avoid
  48307. // Webpack shimming the process
  48308. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  48309. } else {
  48310. _isServer = false;
  48311. }
  48312. }
  48313. return _isServer
  48314. };
  48315. // detect devtools
  48316. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  48317. /* istanbul ignore next */
  48318. function isNative (Ctor) {
  48319. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  48320. }
  48321. var hasSymbol =
  48322. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  48323. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  48324. var _Set;
  48325. /* istanbul ignore if */ // $flow-disable-line
  48326. if (typeof Set !== 'undefined' && isNative(Set)) {
  48327. // use native Set when available.
  48328. _Set = Set;
  48329. } else {
  48330. // a non-standard Set polyfill that only works with primitive keys.
  48331. _Set = /*@__PURE__*/(function () {
  48332. function Set () {
  48333. this.set = Object.create(null);
  48334. }
  48335. Set.prototype.has = function has (key) {
  48336. return this.set[key] === true
  48337. };
  48338. Set.prototype.add = function add (key) {
  48339. this.set[key] = true;
  48340. };
  48341. Set.prototype.clear = function clear () {
  48342. this.set = Object.create(null);
  48343. };
  48344. return Set;
  48345. }());
  48346. }
  48347. /* */
  48348. var warn = noop;
  48349. var tip = noop;
  48350. var generateComponentTrace = (noop); // work around flow check
  48351. var formatComponentName = (noop);
  48352. {
  48353. var hasConsole = typeof console !== 'undefined';
  48354. var classifyRE = /(?:^|[-_])(\w)/g;
  48355. var classify = function (str) { return str
  48356. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  48357. .replace(/[-_]/g, ''); };
  48358. warn = function (msg, vm) {
  48359. var trace = vm ? generateComponentTrace(vm) : '';
  48360. if (config.warnHandler) {
  48361. config.warnHandler.call(null, msg, vm, trace);
  48362. } else if (hasConsole && (!config.silent)) {
  48363. console.error(("[Vue warn]: " + msg + trace));
  48364. }
  48365. };
  48366. tip = function (msg, vm) {
  48367. if (hasConsole && (!config.silent)) {
  48368. console.warn("[Vue tip]: " + msg + (
  48369. vm ? generateComponentTrace(vm) : ''
  48370. ));
  48371. }
  48372. };
  48373. formatComponentName = function (vm, includeFile) {
  48374. if (vm.$root === vm) {
  48375. return '<Root>'
  48376. }
  48377. var options = typeof vm === 'function' && vm.cid != null
  48378. ? vm.options
  48379. : vm._isVue
  48380. ? vm.$options || vm.constructor.options
  48381. : vm;
  48382. var name = options.name || options._componentTag;
  48383. var file = options.__file;
  48384. if (!name && file) {
  48385. var match = file.match(/([^/\\]+)\.vue$/);
  48386. name = match && match[1];
  48387. }
  48388. return (
  48389. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  48390. (file && includeFile !== false ? (" at " + file) : '')
  48391. )
  48392. };
  48393. var repeat = function (str, n) {
  48394. var res = '';
  48395. while (n) {
  48396. if (n % 2 === 1) { res += str; }
  48397. if (n > 1) { str += str; }
  48398. n >>= 1;
  48399. }
  48400. return res
  48401. };
  48402. generateComponentTrace = function (vm) {
  48403. if (vm._isVue && vm.$parent) {
  48404. var tree = [];
  48405. var currentRecursiveSequence = 0;
  48406. while (vm) {
  48407. if (tree.length > 0) {
  48408. var last = tree[tree.length - 1];
  48409. if (last.constructor === vm.constructor) {
  48410. currentRecursiveSequence++;
  48411. vm = vm.$parent;
  48412. continue
  48413. } else if (currentRecursiveSequence > 0) {
  48414. tree[tree.length - 1] = [last, currentRecursiveSequence];
  48415. currentRecursiveSequence = 0;
  48416. }
  48417. }
  48418. tree.push(vm);
  48419. vm = vm.$parent;
  48420. }
  48421. return '\n\nfound in\n\n' + tree
  48422. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  48423. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  48424. : formatComponentName(vm))); })
  48425. .join('\n')
  48426. } else {
  48427. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  48428. }
  48429. };
  48430. }
  48431. /* */
  48432. var uid = 0;
  48433. /**
  48434. * A dep is an observable that can have multiple
  48435. * directives subscribing to it.
  48436. */
  48437. var Dep = function Dep () {
  48438. this.id = uid++;
  48439. this.subs = [];
  48440. };
  48441. Dep.prototype.addSub = function addSub (sub) {
  48442. this.subs.push(sub);
  48443. };
  48444. Dep.prototype.removeSub = function removeSub (sub) {
  48445. remove(this.subs, sub);
  48446. };
  48447. Dep.prototype.depend = function depend () {
  48448. if (Dep.target) {
  48449. Dep.target.addDep(this);
  48450. }
  48451. };
  48452. Dep.prototype.notify = function notify () {
  48453. // stabilize the subscriber list first
  48454. var subs = this.subs.slice();
  48455. if (!config.async) {
  48456. // subs aren't sorted in scheduler if not running async
  48457. // we need to sort them now to make sure they fire in correct
  48458. // order
  48459. subs.sort(function (a, b) { return a.id - b.id; });
  48460. }
  48461. for (var i = 0, l = subs.length; i < l; i++) {
  48462. subs[i].update();
  48463. }
  48464. };
  48465. // The current target watcher being evaluated.
  48466. // This is globally unique because only one watcher
  48467. // can be evaluated at a time.
  48468. Dep.target = null;
  48469. var targetStack = [];
  48470. function pushTarget (target) {
  48471. targetStack.push(target);
  48472. Dep.target = target;
  48473. }
  48474. function popTarget () {
  48475. targetStack.pop();
  48476. Dep.target = targetStack[targetStack.length - 1];
  48477. }
  48478. /* */
  48479. var VNode = function VNode (
  48480. tag,
  48481. data,
  48482. children,
  48483. text,
  48484. elm,
  48485. context,
  48486. componentOptions,
  48487. asyncFactory
  48488. ) {
  48489. this.tag = tag;
  48490. this.data = data;
  48491. this.children = children;
  48492. this.text = text;
  48493. this.elm = elm;
  48494. this.ns = undefined;
  48495. this.context = context;
  48496. this.fnContext = undefined;
  48497. this.fnOptions = undefined;
  48498. this.fnScopeId = undefined;
  48499. this.key = data && data.key;
  48500. this.componentOptions = componentOptions;
  48501. this.componentInstance = undefined;
  48502. this.parent = undefined;
  48503. this.raw = false;
  48504. this.isStatic = false;
  48505. this.isRootInsert = true;
  48506. this.isComment = false;
  48507. this.isCloned = false;
  48508. this.isOnce = false;
  48509. this.asyncFactory = asyncFactory;
  48510. this.asyncMeta = undefined;
  48511. this.isAsyncPlaceholder = false;
  48512. };
  48513. var prototypeAccessors = { child: { configurable: true } };
  48514. // DEPRECATED: alias for componentInstance for backwards compat.
  48515. /* istanbul ignore next */
  48516. prototypeAccessors.child.get = function () {
  48517. return this.componentInstance
  48518. };
  48519. Object.defineProperties( VNode.prototype, prototypeAccessors );
  48520. var createEmptyVNode = function (text) {
  48521. if ( text === void 0 ) text = '';
  48522. var node = new VNode();
  48523. node.text = text;
  48524. node.isComment = true;
  48525. return node
  48526. };
  48527. function createTextVNode (val) {
  48528. return new VNode(undefined, undefined, undefined, String(val))
  48529. }
  48530. // optimized shallow clone
  48531. // used for static nodes and slot nodes because they may be reused across
  48532. // multiple renders, cloning them avoids errors when DOM manipulations rely
  48533. // on their elm reference.
  48534. function cloneVNode (vnode) {
  48535. var cloned = new VNode(
  48536. vnode.tag,
  48537. vnode.data,
  48538. // #7975
  48539. // clone children array to avoid mutating original in case of cloning
  48540. // a child.
  48541. vnode.children && vnode.children.slice(),
  48542. vnode.text,
  48543. vnode.elm,
  48544. vnode.context,
  48545. vnode.componentOptions,
  48546. vnode.asyncFactory
  48547. );
  48548. cloned.ns = vnode.ns;
  48549. cloned.isStatic = vnode.isStatic;
  48550. cloned.key = vnode.key;
  48551. cloned.isComment = vnode.isComment;
  48552. cloned.fnContext = vnode.fnContext;
  48553. cloned.fnOptions = vnode.fnOptions;
  48554. cloned.fnScopeId = vnode.fnScopeId;
  48555. cloned.asyncMeta = vnode.asyncMeta;
  48556. cloned.isCloned = true;
  48557. return cloned
  48558. }
  48559. /*
  48560. * not type checking this file because flow doesn't play well with
  48561. * dynamically accessing methods on Array prototype
  48562. */
  48563. var arrayProto = Array.prototype;
  48564. var arrayMethods = Object.create(arrayProto);
  48565. var methodsToPatch = [
  48566. 'push',
  48567. 'pop',
  48568. 'shift',
  48569. 'unshift',
  48570. 'splice',
  48571. 'sort',
  48572. 'reverse'
  48573. ];
  48574. /**
  48575. * Intercept mutating methods and emit events
  48576. */
  48577. methodsToPatch.forEach(function (method) {
  48578. // cache original method
  48579. var original = arrayProto[method];
  48580. def(arrayMethods, method, function mutator () {
  48581. var args = [], len = arguments.length;
  48582. while ( len-- ) args[ len ] = arguments[ len ];
  48583. var result = original.apply(this, args);
  48584. var ob = this.__ob__;
  48585. var inserted;
  48586. switch (method) {
  48587. case 'push':
  48588. case 'unshift':
  48589. inserted = args;
  48590. break
  48591. case 'splice':
  48592. inserted = args.slice(2);
  48593. break
  48594. }
  48595. if (inserted) { ob.observeArray(inserted); }
  48596. // notify change
  48597. ob.dep.notify();
  48598. return result
  48599. });
  48600. });
  48601. /* */
  48602. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  48603. /**
  48604. * In some cases we may want to disable observation inside a component's
  48605. * update computation.
  48606. */
  48607. var shouldObserve = true;
  48608. function toggleObserving (value) {
  48609. shouldObserve = value;
  48610. }
  48611. /**
  48612. * Observer class that is attached to each observed
  48613. * object. Once attached, the observer converts the target
  48614. * object's property keys into getter/setters that
  48615. * collect dependencies and dispatch updates.
  48616. */
  48617. var Observer = function Observer (value) {
  48618. this.value = value;
  48619. this.dep = new Dep();
  48620. this.vmCount = 0;
  48621. def(value, '__ob__', this);
  48622. if (Array.isArray(value)) {
  48623. if (hasProto) {
  48624. protoAugment(value, arrayMethods);
  48625. } else {
  48626. copyAugment(value, arrayMethods, arrayKeys);
  48627. }
  48628. this.observeArray(value);
  48629. } else {
  48630. this.walk(value);
  48631. }
  48632. };
  48633. /**
  48634. * Walk through all properties and convert them into
  48635. * getter/setters. This method should only be called when
  48636. * value type is Object.
  48637. */
  48638. Observer.prototype.walk = function walk (obj) {
  48639. var keys = Object.keys(obj);
  48640. for (var i = 0; i < keys.length; i++) {
  48641. defineReactive$$1(obj, keys[i]);
  48642. }
  48643. };
  48644. /**
  48645. * Observe a list of Array items.
  48646. */
  48647. Observer.prototype.observeArray = function observeArray (items) {
  48648. for (var i = 0, l = items.length; i < l; i++) {
  48649. observe(items[i]);
  48650. }
  48651. };
  48652. // helpers
  48653. /**
  48654. * Augment a target Object or Array by intercepting
  48655. * the prototype chain using __proto__
  48656. */
  48657. function protoAugment (target, src) {
  48658. /* eslint-disable no-proto */
  48659. target.__proto__ = src;
  48660. /* eslint-enable no-proto */
  48661. }
  48662. /**
  48663. * Augment a target Object or Array by defining
  48664. * hidden properties.
  48665. */
  48666. /* istanbul ignore next */
  48667. function copyAugment (target, src, keys) {
  48668. for (var i = 0, l = keys.length; i < l; i++) {
  48669. var key = keys[i];
  48670. def(target, key, src[key]);
  48671. }
  48672. }
  48673. /**
  48674. * Attempt to create an observer instance for a value,
  48675. * returns the new observer if successfully observed,
  48676. * or the existing observer if the value already has one.
  48677. */
  48678. function observe (value, asRootData) {
  48679. if (!isObject(value) || value instanceof VNode) {
  48680. return
  48681. }
  48682. var ob;
  48683. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  48684. ob = value.__ob__;
  48685. } else if (
  48686. shouldObserve &&
  48687. !isServerRendering() &&
  48688. (Array.isArray(value) || isPlainObject(value)) &&
  48689. Object.isExtensible(value) &&
  48690. !value._isVue
  48691. ) {
  48692. ob = new Observer(value);
  48693. }
  48694. if (asRootData && ob) {
  48695. ob.vmCount++;
  48696. }
  48697. return ob
  48698. }
  48699. /**
  48700. * Define a reactive property on an Object.
  48701. */
  48702. function defineReactive$$1 (
  48703. obj,
  48704. key,
  48705. val,
  48706. customSetter,
  48707. shallow
  48708. ) {
  48709. var dep = new Dep();
  48710. var property = Object.getOwnPropertyDescriptor(obj, key);
  48711. if (property && property.configurable === false) {
  48712. return
  48713. }
  48714. // cater for pre-defined getter/setters
  48715. var getter = property && property.get;
  48716. var setter = property && property.set;
  48717. if ((!getter || setter) && arguments.length === 2) {
  48718. val = obj[key];
  48719. }
  48720. var childOb = !shallow && observe(val);
  48721. Object.defineProperty(obj, key, {
  48722. enumerable: true,
  48723. configurable: true,
  48724. get: function reactiveGetter () {
  48725. var value = getter ? getter.call(obj) : val;
  48726. if (Dep.target) {
  48727. dep.depend();
  48728. if (childOb) {
  48729. childOb.dep.depend();
  48730. if (Array.isArray(value)) {
  48731. dependArray(value);
  48732. }
  48733. }
  48734. }
  48735. return value
  48736. },
  48737. set: function reactiveSetter (newVal) {
  48738. var value = getter ? getter.call(obj) : val;
  48739. /* eslint-disable no-self-compare */
  48740. if (newVal === value || (newVal !== newVal && value !== value)) {
  48741. return
  48742. }
  48743. /* eslint-enable no-self-compare */
  48744. if (customSetter) {
  48745. customSetter();
  48746. }
  48747. // #7981: for accessor properties without setter
  48748. if (getter && !setter) { return }
  48749. if (setter) {
  48750. setter.call(obj, newVal);
  48751. } else {
  48752. val = newVal;
  48753. }
  48754. childOb = !shallow && observe(newVal);
  48755. dep.notify();
  48756. }
  48757. });
  48758. }
  48759. /**
  48760. * Set a property on an object. Adds the new property and
  48761. * triggers change notification if the property doesn't
  48762. * already exist.
  48763. */
  48764. function set (target, key, val) {
  48765. if (isUndef(target) || isPrimitive(target)
  48766. ) {
  48767. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  48768. }
  48769. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48770. target.length = Math.max(target.length, key);
  48771. target.splice(key, 1, val);
  48772. return val
  48773. }
  48774. if (key in target && !(key in Object.prototype)) {
  48775. target[key] = val;
  48776. return val
  48777. }
  48778. var ob = (target).__ob__;
  48779. if (target._isVue || (ob && ob.vmCount)) {
  48780. warn(
  48781. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  48782. 'at runtime - declare it upfront in the data option.'
  48783. );
  48784. return val
  48785. }
  48786. if (!ob) {
  48787. target[key] = val;
  48788. return val
  48789. }
  48790. defineReactive$$1(ob.value, key, val);
  48791. ob.dep.notify();
  48792. return val
  48793. }
  48794. /**
  48795. * Delete a property and trigger change if necessary.
  48796. */
  48797. function del (target, key) {
  48798. if (isUndef(target) || isPrimitive(target)
  48799. ) {
  48800. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  48801. }
  48802. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48803. target.splice(key, 1);
  48804. return
  48805. }
  48806. var ob = (target).__ob__;
  48807. if (target._isVue || (ob && ob.vmCount)) {
  48808. warn(
  48809. 'Avoid deleting properties on a Vue instance or its root $data ' +
  48810. '- just set it to null.'
  48811. );
  48812. return
  48813. }
  48814. if (!hasOwn(target, key)) {
  48815. return
  48816. }
  48817. delete target[key];
  48818. if (!ob) {
  48819. return
  48820. }
  48821. ob.dep.notify();
  48822. }
  48823. /**
  48824. * Collect dependencies on array elements when the array is touched, since
  48825. * we cannot intercept array element access like property getters.
  48826. */
  48827. function dependArray (value) {
  48828. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  48829. e = value[i];
  48830. e && e.__ob__ && e.__ob__.dep.depend();
  48831. if (Array.isArray(e)) {
  48832. dependArray(e);
  48833. }
  48834. }
  48835. }
  48836. /* */
  48837. /**
  48838. * Option overwriting strategies are functions that handle
  48839. * how to merge a parent option value and a child option
  48840. * value into the final value.
  48841. */
  48842. var strats = config.optionMergeStrategies;
  48843. /**
  48844. * Options with restrictions
  48845. */
  48846. {
  48847. strats.el = strats.propsData = function (parent, child, vm, key) {
  48848. if (!vm) {
  48849. warn(
  48850. "option \"" + key + "\" can only be used during instance " +
  48851. 'creation with the `new` keyword.'
  48852. );
  48853. }
  48854. return defaultStrat(parent, child)
  48855. };
  48856. }
  48857. /**
  48858. * Helper that recursively merges two data objects together.
  48859. */
  48860. function mergeData (to, from) {
  48861. if (!from) { return to }
  48862. var key, toVal, fromVal;
  48863. var keys = hasSymbol
  48864. ? Reflect.ownKeys(from)
  48865. : Object.keys(from);
  48866. for (var i = 0; i < keys.length; i++) {
  48867. key = keys[i];
  48868. // in case the object is already observed...
  48869. if (key === '__ob__') { continue }
  48870. toVal = to[key];
  48871. fromVal = from[key];
  48872. if (!hasOwn(to, key)) {
  48873. set(to, key, fromVal);
  48874. } else if (
  48875. toVal !== fromVal &&
  48876. isPlainObject(toVal) &&
  48877. isPlainObject(fromVal)
  48878. ) {
  48879. mergeData(toVal, fromVal);
  48880. }
  48881. }
  48882. return to
  48883. }
  48884. /**
  48885. * Data
  48886. */
  48887. function mergeDataOrFn (
  48888. parentVal,
  48889. childVal,
  48890. vm
  48891. ) {
  48892. if (!vm) {
  48893. // in a Vue.extend merge, both should be functions
  48894. if (!childVal) {
  48895. return parentVal
  48896. }
  48897. if (!parentVal) {
  48898. return childVal
  48899. }
  48900. // when parentVal & childVal are both present,
  48901. // we need to return a function that returns the
  48902. // merged result of both functions... no need to
  48903. // check if parentVal is a function here because
  48904. // it has to be a function to pass previous merges.
  48905. return function mergedDataFn () {
  48906. return mergeData(
  48907. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  48908. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  48909. )
  48910. }
  48911. } else {
  48912. return function mergedInstanceDataFn () {
  48913. // instance merge
  48914. var instanceData = typeof childVal === 'function'
  48915. ? childVal.call(vm, vm)
  48916. : childVal;
  48917. var defaultData = typeof parentVal === 'function'
  48918. ? parentVal.call(vm, vm)
  48919. : parentVal;
  48920. if (instanceData) {
  48921. return mergeData(instanceData, defaultData)
  48922. } else {
  48923. return defaultData
  48924. }
  48925. }
  48926. }
  48927. }
  48928. strats.data = function (
  48929. parentVal,
  48930. childVal,
  48931. vm
  48932. ) {
  48933. if (!vm) {
  48934. if (childVal && typeof childVal !== 'function') {
  48935. warn(
  48936. 'The "data" option should be a function ' +
  48937. 'that returns a per-instance value in component ' +
  48938. 'definitions.',
  48939. vm
  48940. );
  48941. return parentVal
  48942. }
  48943. return mergeDataOrFn(parentVal, childVal)
  48944. }
  48945. return mergeDataOrFn(parentVal, childVal, vm)
  48946. };
  48947. /**
  48948. * Hooks and props are merged as arrays.
  48949. */
  48950. function mergeHook (
  48951. parentVal,
  48952. childVal
  48953. ) {
  48954. var res = childVal
  48955. ? parentVal
  48956. ? parentVal.concat(childVal)
  48957. : Array.isArray(childVal)
  48958. ? childVal
  48959. : [childVal]
  48960. : parentVal;
  48961. return res
  48962. ? dedupeHooks(res)
  48963. : res
  48964. }
  48965. function dedupeHooks (hooks) {
  48966. var res = [];
  48967. for (var i = 0; i < hooks.length; i++) {
  48968. if (res.indexOf(hooks[i]) === -1) {
  48969. res.push(hooks[i]);
  48970. }
  48971. }
  48972. return res
  48973. }
  48974. LIFECYCLE_HOOKS.forEach(function (hook) {
  48975. strats[hook] = mergeHook;
  48976. });
  48977. /**
  48978. * Assets
  48979. *
  48980. * When a vm is present (instance creation), we need to do
  48981. * a three-way merge between constructor options, instance
  48982. * options and parent options.
  48983. */
  48984. function mergeAssets (
  48985. parentVal,
  48986. childVal,
  48987. vm,
  48988. key
  48989. ) {
  48990. var res = Object.create(parentVal || null);
  48991. if (childVal) {
  48992. assertObjectType(key, childVal, vm);
  48993. return extend(res, childVal)
  48994. } else {
  48995. return res
  48996. }
  48997. }
  48998. ASSET_TYPES.forEach(function (type) {
  48999. strats[type + 's'] = mergeAssets;
  49000. });
  49001. /**
  49002. * Watchers.
  49003. *
  49004. * Watchers hashes should not overwrite one
  49005. * another, so we merge them as arrays.
  49006. */
  49007. strats.watch = function (
  49008. parentVal,
  49009. childVal,
  49010. vm,
  49011. key
  49012. ) {
  49013. // work around Firefox's Object.prototype.watch...
  49014. if (parentVal === nativeWatch) { parentVal = undefined; }
  49015. if (childVal === nativeWatch) { childVal = undefined; }
  49016. /* istanbul ignore if */
  49017. if (!childVal) { return Object.create(parentVal || null) }
  49018. {
  49019. assertObjectType(key, childVal, vm);
  49020. }
  49021. if (!parentVal) { return childVal }
  49022. var ret = {};
  49023. extend(ret, parentVal);
  49024. for (var key$1 in childVal) {
  49025. var parent = ret[key$1];
  49026. var child = childVal[key$1];
  49027. if (parent && !Array.isArray(parent)) {
  49028. parent = [parent];
  49029. }
  49030. ret[key$1] = parent
  49031. ? parent.concat(child)
  49032. : Array.isArray(child) ? child : [child];
  49033. }
  49034. return ret
  49035. };
  49036. /**
  49037. * Other object hashes.
  49038. */
  49039. strats.props =
  49040. strats.methods =
  49041. strats.inject =
  49042. strats.computed = function (
  49043. parentVal,
  49044. childVal,
  49045. vm,
  49046. key
  49047. ) {
  49048. if (childVal && "development" !== 'production') {
  49049. assertObjectType(key, childVal, vm);
  49050. }
  49051. if (!parentVal) { return childVal }
  49052. var ret = Object.create(null);
  49053. extend(ret, parentVal);
  49054. if (childVal) { extend(ret, childVal); }
  49055. return ret
  49056. };
  49057. strats.provide = mergeDataOrFn;
  49058. /**
  49059. * Default strategy.
  49060. */
  49061. var defaultStrat = function (parentVal, childVal) {
  49062. return childVal === undefined
  49063. ? parentVal
  49064. : childVal
  49065. };
  49066. /**
  49067. * Validate component names
  49068. */
  49069. function checkComponents (options) {
  49070. for (var key in options.components) {
  49071. validateComponentName(key);
  49072. }
  49073. }
  49074. function validateComponentName (name) {
  49075. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  49076. warn(
  49077. 'Invalid component name: "' + name + '". Component names ' +
  49078. 'should conform to valid custom element name in html5 specification.'
  49079. );
  49080. }
  49081. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  49082. warn(
  49083. 'Do not use built-in or reserved HTML elements as component ' +
  49084. 'id: ' + name
  49085. );
  49086. }
  49087. }
  49088. /**
  49089. * Ensure all props option syntax are normalized into the
  49090. * Object-based format.
  49091. */
  49092. function normalizeProps (options, vm) {
  49093. var props = options.props;
  49094. if (!props) { return }
  49095. var res = {};
  49096. var i, val, name;
  49097. if (Array.isArray(props)) {
  49098. i = props.length;
  49099. while (i--) {
  49100. val = props[i];
  49101. if (typeof val === 'string') {
  49102. name = camelize(val);
  49103. res[name] = { type: null };
  49104. } else {
  49105. warn('props must be strings when using array syntax.');
  49106. }
  49107. }
  49108. } else if (isPlainObject(props)) {
  49109. for (var key in props) {
  49110. val = props[key];
  49111. name = camelize(key);
  49112. res[name] = isPlainObject(val)
  49113. ? val
  49114. : { type: val };
  49115. }
  49116. } else {
  49117. warn(
  49118. "Invalid value for option \"props\": expected an Array or an Object, " +
  49119. "but got " + (toRawType(props)) + ".",
  49120. vm
  49121. );
  49122. }
  49123. options.props = res;
  49124. }
  49125. /**
  49126. * Normalize all injections into Object-based format
  49127. */
  49128. function normalizeInject (options, vm) {
  49129. var inject = options.inject;
  49130. if (!inject) { return }
  49131. var normalized = options.inject = {};
  49132. if (Array.isArray(inject)) {
  49133. for (var i = 0; i < inject.length; i++) {
  49134. normalized[inject[i]] = { from: inject[i] };
  49135. }
  49136. } else if (isPlainObject(inject)) {
  49137. for (var key in inject) {
  49138. var val = inject[key];
  49139. normalized[key] = isPlainObject(val)
  49140. ? extend({ from: key }, val)
  49141. : { from: val };
  49142. }
  49143. } else {
  49144. warn(
  49145. "Invalid value for option \"inject\": expected an Array or an Object, " +
  49146. "but got " + (toRawType(inject)) + ".",
  49147. vm
  49148. );
  49149. }
  49150. }
  49151. /**
  49152. * Normalize raw function directives into object format.
  49153. */
  49154. function normalizeDirectives (options) {
  49155. var dirs = options.directives;
  49156. if (dirs) {
  49157. for (var key in dirs) {
  49158. var def$$1 = dirs[key];
  49159. if (typeof def$$1 === 'function') {
  49160. dirs[key] = { bind: def$$1, update: def$$1 };
  49161. }
  49162. }
  49163. }
  49164. }
  49165. function assertObjectType (name, value, vm) {
  49166. if (!isPlainObject(value)) {
  49167. warn(
  49168. "Invalid value for option \"" + name + "\": expected an Object, " +
  49169. "but got " + (toRawType(value)) + ".",
  49170. vm
  49171. );
  49172. }
  49173. }
  49174. /**
  49175. * Merge two option objects into a new one.
  49176. * Core utility used in both instantiation and inheritance.
  49177. */
  49178. function mergeOptions (
  49179. parent,
  49180. child,
  49181. vm
  49182. ) {
  49183. {
  49184. checkComponents(child);
  49185. }
  49186. if (typeof child === 'function') {
  49187. child = child.options;
  49188. }
  49189. normalizeProps(child, vm);
  49190. normalizeInject(child, vm);
  49191. normalizeDirectives(child);
  49192. // Apply extends and mixins on the child options,
  49193. // but only if it is a raw options object that isn't
  49194. // the result of another mergeOptions call.
  49195. // Only merged options has the _base property.
  49196. if (!child._base) {
  49197. if (child.extends) {
  49198. parent = mergeOptions(parent, child.extends, vm);
  49199. }
  49200. if (child.mixins) {
  49201. for (var i = 0, l = child.mixins.length; i < l; i++) {
  49202. parent = mergeOptions(parent, child.mixins[i], vm);
  49203. }
  49204. }
  49205. }
  49206. var options = {};
  49207. var key;
  49208. for (key in parent) {
  49209. mergeField(key);
  49210. }
  49211. for (key in child) {
  49212. if (!hasOwn(parent, key)) {
  49213. mergeField(key);
  49214. }
  49215. }
  49216. function mergeField (key) {
  49217. var strat = strats[key] || defaultStrat;
  49218. options[key] = strat(parent[key], child[key], vm, key);
  49219. }
  49220. return options
  49221. }
  49222. /**
  49223. * Resolve an asset.
  49224. * This function is used because child instances need access
  49225. * to assets defined in its ancestor chain.
  49226. */
  49227. function resolveAsset (
  49228. options,
  49229. type,
  49230. id,
  49231. warnMissing
  49232. ) {
  49233. /* istanbul ignore if */
  49234. if (typeof id !== 'string') {
  49235. return
  49236. }
  49237. var assets = options[type];
  49238. // check local registration variations first
  49239. if (hasOwn(assets, id)) { return assets[id] }
  49240. var camelizedId = camelize(id);
  49241. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  49242. var PascalCaseId = capitalize(camelizedId);
  49243. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  49244. // fallback to prototype chain
  49245. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  49246. if (warnMissing && !res) {
  49247. warn(
  49248. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  49249. options
  49250. );
  49251. }
  49252. return res
  49253. }
  49254. /* */
  49255. function validateProp (
  49256. key,
  49257. propOptions,
  49258. propsData,
  49259. vm
  49260. ) {
  49261. var prop = propOptions[key];
  49262. var absent = !hasOwn(propsData, key);
  49263. var value = propsData[key];
  49264. // boolean casting
  49265. var booleanIndex = getTypeIndex(Boolean, prop.type);
  49266. if (booleanIndex > -1) {
  49267. if (absent && !hasOwn(prop, 'default')) {
  49268. value = false;
  49269. } else if (value === '' || value === hyphenate(key)) {
  49270. // only cast empty string / same name to boolean if
  49271. // boolean has higher priority
  49272. var stringIndex = getTypeIndex(String, prop.type);
  49273. if (stringIndex < 0 || booleanIndex < stringIndex) {
  49274. value = true;
  49275. }
  49276. }
  49277. }
  49278. // check default value
  49279. if (value === undefined) {
  49280. value = getPropDefaultValue(vm, prop, key);
  49281. // since the default value is a fresh copy,
  49282. // make sure to observe it.
  49283. var prevShouldObserve = shouldObserve;
  49284. toggleObserving(true);
  49285. observe(value);
  49286. toggleObserving(prevShouldObserve);
  49287. }
  49288. {
  49289. assertProp(prop, key, value, vm, absent);
  49290. }
  49291. return value
  49292. }
  49293. /**
  49294. * Get the default value of a prop.
  49295. */
  49296. function getPropDefaultValue (vm, prop, key) {
  49297. // no default, return undefined
  49298. if (!hasOwn(prop, 'default')) {
  49299. return undefined
  49300. }
  49301. var def = prop.default;
  49302. // warn against non-factory defaults for Object & Array
  49303. if (isObject(def)) {
  49304. warn(
  49305. 'Invalid default value for prop "' + key + '": ' +
  49306. 'Props with type Object/Array must use a factory function ' +
  49307. 'to return the default value.',
  49308. vm
  49309. );
  49310. }
  49311. // the raw prop value was also undefined from previous render,
  49312. // return previous default value to avoid unnecessary watcher trigger
  49313. if (vm && vm.$options.propsData &&
  49314. vm.$options.propsData[key] === undefined &&
  49315. vm._props[key] !== undefined
  49316. ) {
  49317. return vm._props[key]
  49318. }
  49319. // call factory function for non-Function types
  49320. // a value is Function if its prototype is function even across different execution context
  49321. return typeof def === 'function' && getType(prop.type) !== 'Function'
  49322. ? def.call(vm)
  49323. : def
  49324. }
  49325. /**
  49326. * Assert whether a prop is valid.
  49327. */
  49328. function assertProp (
  49329. prop,
  49330. name,
  49331. value,
  49332. vm,
  49333. absent
  49334. ) {
  49335. if (prop.required && absent) {
  49336. warn(
  49337. 'Missing required prop: "' + name + '"',
  49338. vm
  49339. );
  49340. return
  49341. }
  49342. if (value == null && !prop.required) {
  49343. return
  49344. }
  49345. var type = prop.type;
  49346. var valid = !type || type === true;
  49347. var expectedTypes = [];
  49348. if (type) {
  49349. if (!Array.isArray(type)) {
  49350. type = [type];
  49351. }
  49352. for (var i = 0; i < type.length && !valid; i++) {
  49353. var assertedType = assertType(value, type[i]);
  49354. expectedTypes.push(assertedType.expectedType || '');
  49355. valid = assertedType.valid;
  49356. }
  49357. }
  49358. if (!valid) {
  49359. warn(
  49360. getInvalidTypeMessage(name, value, expectedTypes),
  49361. vm
  49362. );
  49363. return
  49364. }
  49365. var validator = prop.validator;
  49366. if (validator) {
  49367. if (!validator(value)) {
  49368. warn(
  49369. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  49370. vm
  49371. );
  49372. }
  49373. }
  49374. }
  49375. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  49376. function assertType (value, type) {
  49377. var valid;
  49378. var expectedType = getType(type);
  49379. if (simpleCheckRE.test(expectedType)) {
  49380. var t = typeof value;
  49381. valid = t === expectedType.toLowerCase();
  49382. // for primitive wrapper objects
  49383. if (!valid && t === 'object') {
  49384. valid = value instanceof type;
  49385. }
  49386. } else if (expectedType === 'Object') {
  49387. valid = isPlainObject(value);
  49388. } else if (expectedType === 'Array') {
  49389. valid = Array.isArray(value);
  49390. } else {
  49391. valid = value instanceof type;
  49392. }
  49393. return {
  49394. valid: valid,
  49395. expectedType: expectedType
  49396. }
  49397. }
  49398. /**
  49399. * Use function string name to check built-in types,
  49400. * because a simple equality check will fail when running
  49401. * across different vms / iframes.
  49402. */
  49403. function getType (fn) {
  49404. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  49405. return match ? match[1] : ''
  49406. }
  49407. function isSameType (a, b) {
  49408. return getType(a) === getType(b)
  49409. }
  49410. function getTypeIndex (type, expectedTypes) {
  49411. if (!Array.isArray(expectedTypes)) {
  49412. return isSameType(expectedTypes, type) ? 0 : -1
  49413. }
  49414. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  49415. if (isSameType(expectedTypes[i], type)) {
  49416. return i
  49417. }
  49418. }
  49419. return -1
  49420. }
  49421. function getInvalidTypeMessage (name, value, expectedTypes) {
  49422. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  49423. " Expected " + (expectedTypes.map(capitalize).join(', '));
  49424. var expectedType = expectedTypes[0];
  49425. var receivedType = toRawType(value);
  49426. var expectedValue = styleValue(value, expectedType);
  49427. var receivedValue = styleValue(value, receivedType);
  49428. // check if we need to specify expected value
  49429. if (expectedTypes.length === 1 &&
  49430. isExplicable(expectedType) &&
  49431. !isBoolean(expectedType, receivedType)) {
  49432. message += " with value " + expectedValue;
  49433. }
  49434. message += ", got " + receivedType + " ";
  49435. // check if we need to specify received value
  49436. if (isExplicable(receivedType)) {
  49437. message += "with value " + receivedValue + ".";
  49438. }
  49439. return message
  49440. }
  49441. function styleValue (value, type) {
  49442. if (type === 'String') {
  49443. return ("\"" + value + "\"")
  49444. } else if (type === 'Number') {
  49445. return ("" + (Number(value)))
  49446. } else {
  49447. return ("" + value)
  49448. }
  49449. }
  49450. function isExplicable (value) {
  49451. var explicitTypes = ['string', 'number', 'boolean'];
  49452. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  49453. }
  49454. function isBoolean () {
  49455. var args = [], len = arguments.length;
  49456. while ( len-- ) args[ len ] = arguments[ len ];
  49457. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  49458. }
  49459. /* */
  49460. function handleError (err, vm, info) {
  49461. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  49462. // See: https://github.com/vuejs/vuex/issues/1505
  49463. pushTarget();
  49464. try {
  49465. if (vm) {
  49466. var cur = vm;
  49467. while ((cur = cur.$parent)) {
  49468. var hooks = cur.$options.errorCaptured;
  49469. if (hooks) {
  49470. for (var i = 0; i < hooks.length; i++) {
  49471. try {
  49472. var capture = hooks[i].call(cur, err, vm, info) === false;
  49473. if (capture) { return }
  49474. } catch (e) {
  49475. globalHandleError(e, cur, 'errorCaptured hook');
  49476. }
  49477. }
  49478. }
  49479. }
  49480. }
  49481. globalHandleError(err, vm, info);
  49482. } finally {
  49483. popTarget();
  49484. }
  49485. }
  49486. function invokeWithErrorHandling (
  49487. handler,
  49488. context,
  49489. args,
  49490. vm,
  49491. info
  49492. ) {
  49493. var res;
  49494. try {
  49495. res = args ? handler.apply(context, args) : handler.call(context);
  49496. if (res && !res._isVue && isPromise(res) && !res._handled) {
  49497. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  49498. // issue #9511
  49499. // avoid catch triggering multiple times when nested calls
  49500. res._handled = true;
  49501. }
  49502. } catch (e) {
  49503. handleError(e, vm, info);
  49504. }
  49505. return res
  49506. }
  49507. function globalHandleError (err, vm, info) {
  49508. if (config.errorHandler) {
  49509. try {
  49510. return config.errorHandler.call(null, err, vm, info)
  49511. } catch (e) {
  49512. // if the user intentionally throws the original error in the handler,
  49513. // do not log it twice
  49514. if (e !== err) {
  49515. logError(e, null, 'config.errorHandler');
  49516. }
  49517. }
  49518. }
  49519. logError(err, vm, info);
  49520. }
  49521. function logError (err, vm, info) {
  49522. {
  49523. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  49524. }
  49525. /* istanbul ignore else */
  49526. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  49527. console.error(err);
  49528. } else {
  49529. throw err
  49530. }
  49531. }
  49532. /* */
  49533. var isUsingMicroTask = false;
  49534. var callbacks = [];
  49535. var pending = false;
  49536. function flushCallbacks () {
  49537. pending = false;
  49538. var copies = callbacks.slice(0);
  49539. callbacks.length = 0;
  49540. for (var i = 0; i < copies.length; i++) {
  49541. copies[i]();
  49542. }
  49543. }
  49544. // Here we have async deferring wrappers using microtasks.
  49545. // In 2.5 we used (macro) tasks (in combination with microtasks).
  49546. // However, it has subtle problems when state is changed right before repaint
  49547. // (e.g. #6813, out-in transitions).
  49548. // Also, using (macro) tasks in event handler would cause some weird behaviors
  49549. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  49550. // So we now use microtasks everywhere, again.
  49551. // A major drawback of this tradeoff is that there are some scenarios
  49552. // where microtasks have too high a priority and fire in between supposedly
  49553. // sequential events (e.g. #4521, #6690, which have workarounds)
  49554. // or even between bubbling of the same event (#6566).
  49555. var timerFunc;
  49556. // The nextTick behavior leverages the microtask queue, which can be accessed
  49557. // via either native Promise.then or MutationObserver.
  49558. // MutationObserver has wider support, however it is seriously bugged in
  49559. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  49560. // completely stops working after triggering a few times... so, if native
  49561. // Promise is available, we will use it:
  49562. /* istanbul ignore next, $flow-disable-line */
  49563. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  49564. var p = Promise.resolve();
  49565. timerFunc = function () {
  49566. p.then(flushCallbacks);
  49567. // In problematic UIWebViews, Promise.then doesn't completely break, but
  49568. // it can get stuck in a weird state where callbacks are pushed into the
  49569. // microtask queue but the queue isn't being flushed, until the browser
  49570. // needs to do some other work, e.g. handle a timer. Therefore we can
  49571. // "force" the microtask queue to be flushed by adding an empty timer.
  49572. if (isIOS) { setTimeout(noop); }
  49573. };
  49574. isUsingMicroTask = true;
  49575. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  49576. isNative(MutationObserver) ||
  49577. // PhantomJS and iOS 7.x
  49578. MutationObserver.toString() === '[object MutationObserverConstructor]'
  49579. )) {
  49580. // Use MutationObserver where native Promise is not available,
  49581. // e.g. PhantomJS, iOS7, Android 4.4
  49582. // (#6466 MutationObserver is unreliable in IE11)
  49583. var counter = 1;
  49584. var observer = new MutationObserver(flushCallbacks);
  49585. var textNode = document.createTextNode(String(counter));
  49586. observer.observe(textNode, {
  49587. characterData: true
  49588. });
  49589. timerFunc = function () {
  49590. counter = (counter + 1) % 2;
  49591. textNode.data = String(counter);
  49592. };
  49593. isUsingMicroTask = true;
  49594. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  49595. // Fallback to setImmediate.
  49596. // Technically it leverages the (macro) task queue,
  49597. // but it is still a better choice than setTimeout.
  49598. timerFunc = function () {
  49599. setImmediate(flushCallbacks);
  49600. };
  49601. } else {
  49602. // Fallback to setTimeout.
  49603. timerFunc = function () {
  49604. setTimeout(flushCallbacks, 0);
  49605. };
  49606. }
  49607. function nextTick (cb, ctx) {
  49608. var _resolve;
  49609. callbacks.push(function () {
  49610. if (cb) {
  49611. try {
  49612. cb.call(ctx);
  49613. } catch (e) {
  49614. handleError(e, ctx, 'nextTick');
  49615. }
  49616. } else if (_resolve) {
  49617. _resolve(ctx);
  49618. }
  49619. });
  49620. if (!pending) {
  49621. pending = true;
  49622. timerFunc();
  49623. }
  49624. // $flow-disable-line
  49625. if (!cb && typeof Promise !== 'undefined') {
  49626. return new Promise(function (resolve) {
  49627. _resolve = resolve;
  49628. })
  49629. }
  49630. }
  49631. /* */
  49632. var mark;
  49633. var measure;
  49634. {
  49635. var perf = inBrowser && window.performance;
  49636. /* istanbul ignore if */
  49637. if (
  49638. perf &&
  49639. perf.mark &&
  49640. perf.measure &&
  49641. perf.clearMarks &&
  49642. perf.clearMeasures
  49643. ) {
  49644. mark = function (tag) { return perf.mark(tag); };
  49645. measure = function (name, startTag, endTag) {
  49646. perf.measure(name, startTag, endTag);
  49647. perf.clearMarks(startTag);
  49648. perf.clearMarks(endTag);
  49649. // perf.clearMeasures(name)
  49650. };
  49651. }
  49652. }
  49653. /* not type checking this file because flow doesn't play well with Proxy */
  49654. var initProxy;
  49655. {
  49656. var allowedGlobals = makeMap(
  49657. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  49658. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  49659. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  49660. 'require' // for Webpack/Browserify
  49661. );
  49662. var warnNonPresent = function (target, key) {
  49663. warn(
  49664. "Property or method \"" + key + "\" is not defined on the instance but " +
  49665. 'referenced during render. Make sure that this property is reactive, ' +
  49666. 'either in the data option, or for class-based components, by ' +
  49667. 'initializing the property. ' +
  49668. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  49669. target
  49670. );
  49671. };
  49672. var warnReservedPrefix = function (target, key) {
  49673. warn(
  49674. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  49675. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  49676. 'prevent conflicts with Vue internals. ' +
  49677. 'See: https://vuejs.org/v2/api/#data',
  49678. target
  49679. );
  49680. };
  49681. var hasProxy =
  49682. typeof Proxy !== 'undefined' && isNative(Proxy);
  49683. if (hasProxy) {
  49684. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  49685. config.keyCodes = new Proxy(config.keyCodes, {
  49686. set: function set (target, key, value) {
  49687. if (isBuiltInModifier(key)) {
  49688. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  49689. return false
  49690. } else {
  49691. target[key] = value;
  49692. return true
  49693. }
  49694. }
  49695. });
  49696. }
  49697. var hasHandler = {
  49698. has: function has (target, key) {
  49699. var has = key in target;
  49700. var isAllowed = allowedGlobals(key) ||
  49701. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  49702. if (!has && !isAllowed) {
  49703. if (key in target.$data) { warnReservedPrefix(target, key); }
  49704. else { warnNonPresent(target, key); }
  49705. }
  49706. return has || !isAllowed
  49707. }
  49708. };
  49709. var getHandler = {
  49710. get: function get (target, key) {
  49711. if (typeof key === 'string' && !(key in target)) {
  49712. if (key in target.$data) { warnReservedPrefix(target, key); }
  49713. else { warnNonPresent(target, key); }
  49714. }
  49715. return target[key]
  49716. }
  49717. };
  49718. initProxy = function initProxy (vm) {
  49719. if (hasProxy) {
  49720. // determine which proxy handler to use
  49721. var options = vm.$options;
  49722. var handlers = options.render && options.render._withStripped
  49723. ? getHandler
  49724. : hasHandler;
  49725. vm._renderProxy = new Proxy(vm, handlers);
  49726. } else {
  49727. vm._renderProxy = vm;
  49728. }
  49729. };
  49730. }
  49731. /* */
  49732. var seenObjects = new _Set();
  49733. /**
  49734. * Recursively traverse an object to evoke all converted
  49735. * getters, so that every nested property inside the object
  49736. * is collected as a "deep" dependency.
  49737. */
  49738. function traverse (val) {
  49739. _traverse(val, seenObjects);
  49740. seenObjects.clear();
  49741. }
  49742. function _traverse (val, seen) {
  49743. var i, keys;
  49744. var isA = Array.isArray(val);
  49745. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  49746. return
  49747. }
  49748. if (val.__ob__) {
  49749. var depId = val.__ob__.dep.id;
  49750. if (seen.has(depId)) {
  49751. return
  49752. }
  49753. seen.add(depId);
  49754. }
  49755. if (isA) {
  49756. i = val.length;
  49757. while (i--) { _traverse(val[i], seen); }
  49758. } else {
  49759. keys = Object.keys(val);
  49760. i = keys.length;
  49761. while (i--) { _traverse(val[keys[i]], seen); }
  49762. }
  49763. }
  49764. /* */
  49765. var normalizeEvent = cached(function (name) {
  49766. var passive = name.charAt(0) === '&';
  49767. name = passive ? name.slice(1) : name;
  49768. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  49769. name = once$$1 ? name.slice(1) : name;
  49770. var capture = name.charAt(0) === '!';
  49771. name = capture ? name.slice(1) : name;
  49772. return {
  49773. name: name,
  49774. once: once$$1,
  49775. capture: capture,
  49776. passive: passive
  49777. }
  49778. });
  49779. function createFnInvoker (fns, vm) {
  49780. function invoker () {
  49781. var arguments$1 = arguments;
  49782. var fns = invoker.fns;
  49783. if (Array.isArray(fns)) {
  49784. var cloned = fns.slice();
  49785. for (var i = 0; i < cloned.length; i++) {
  49786. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  49787. }
  49788. } else {
  49789. // return handler return value for single handlers
  49790. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  49791. }
  49792. }
  49793. invoker.fns = fns;
  49794. return invoker
  49795. }
  49796. function updateListeners (
  49797. on,
  49798. oldOn,
  49799. add,
  49800. remove$$1,
  49801. createOnceHandler,
  49802. vm
  49803. ) {
  49804. var name, def$$1, cur, old, event;
  49805. for (name in on) {
  49806. def$$1 = cur = on[name];
  49807. old = oldOn[name];
  49808. event = normalizeEvent(name);
  49809. if (isUndef(cur)) {
  49810. warn(
  49811. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  49812. vm
  49813. );
  49814. } else if (isUndef(old)) {
  49815. if (isUndef(cur.fns)) {
  49816. cur = on[name] = createFnInvoker(cur, vm);
  49817. }
  49818. if (isTrue(event.once)) {
  49819. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  49820. }
  49821. add(event.name, cur, event.capture, event.passive, event.params);
  49822. } else if (cur !== old) {
  49823. old.fns = cur;
  49824. on[name] = old;
  49825. }
  49826. }
  49827. for (name in oldOn) {
  49828. if (isUndef(on[name])) {
  49829. event = normalizeEvent(name);
  49830. remove$$1(event.name, oldOn[name], event.capture);
  49831. }
  49832. }
  49833. }
  49834. /* */
  49835. function mergeVNodeHook (def, hookKey, hook) {
  49836. if (def instanceof VNode) {
  49837. def = def.data.hook || (def.data.hook = {});
  49838. }
  49839. var invoker;
  49840. var oldHook = def[hookKey];
  49841. function wrappedHook () {
  49842. hook.apply(this, arguments);
  49843. // important: remove merged hook to ensure it's called only once
  49844. // and prevent memory leak
  49845. remove(invoker.fns, wrappedHook);
  49846. }
  49847. if (isUndef(oldHook)) {
  49848. // no existing hook
  49849. invoker = createFnInvoker([wrappedHook]);
  49850. } else {
  49851. /* istanbul ignore if */
  49852. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  49853. // already a merged invoker
  49854. invoker = oldHook;
  49855. invoker.fns.push(wrappedHook);
  49856. } else {
  49857. // existing plain hook
  49858. invoker = createFnInvoker([oldHook, wrappedHook]);
  49859. }
  49860. }
  49861. invoker.merged = true;
  49862. def[hookKey] = invoker;
  49863. }
  49864. /* */
  49865. function extractPropsFromVNodeData (
  49866. data,
  49867. Ctor,
  49868. tag
  49869. ) {
  49870. // we are only extracting raw values here.
  49871. // validation and default values are handled in the child
  49872. // component itself.
  49873. var propOptions = Ctor.options.props;
  49874. if (isUndef(propOptions)) {
  49875. return
  49876. }
  49877. var res = {};
  49878. var attrs = data.attrs;
  49879. var props = data.props;
  49880. if (isDef(attrs) || isDef(props)) {
  49881. for (var key in propOptions) {
  49882. var altKey = hyphenate(key);
  49883. {
  49884. var keyInLowerCase = key.toLowerCase();
  49885. if (
  49886. key !== keyInLowerCase &&
  49887. attrs && hasOwn(attrs, keyInLowerCase)
  49888. ) {
  49889. tip(
  49890. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  49891. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  49892. " \"" + key + "\". " +
  49893. "Note that HTML attributes are case-insensitive and camelCased " +
  49894. "props need to use their kebab-case equivalents when using in-DOM " +
  49895. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  49896. );
  49897. }
  49898. }
  49899. checkProp(res, props, key, altKey, true) ||
  49900. checkProp(res, attrs, key, altKey, false);
  49901. }
  49902. }
  49903. return res
  49904. }
  49905. function checkProp (
  49906. res,
  49907. hash,
  49908. key,
  49909. altKey,
  49910. preserve
  49911. ) {
  49912. if (isDef(hash)) {
  49913. if (hasOwn(hash, key)) {
  49914. res[key] = hash[key];
  49915. if (!preserve) {
  49916. delete hash[key];
  49917. }
  49918. return true
  49919. } else if (hasOwn(hash, altKey)) {
  49920. res[key] = hash[altKey];
  49921. if (!preserve) {
  49922. delete hash[altKey];
  49923. }
  49924. return true
  49925. }
  49926. }
  49927. return false
  49928. }
  49929. /* */
  49930. // The template compiler attempts to minimize the need for normalization by
  49931. // statically analyzing the template at compile time.
  49932. //
  49933. // For plain HTML markup, normalization can be completely skipped because the
  49934. // generated render function is guaranteed to return Array<VNode>. There are
  49935. // two cases where extra normalization is needed:
  49936. // 1. When the children contains components - because a functional component
  49937. // may return an Array instead of a single root. In this case, just a simple
  49938. // normalization is needed - if any child is an Array, we flatten the whole
  49939. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  49940. // because functional components already normalize their own children.
  49941. function simpleNormalizeChildren (children) {
  49942. for (var i = 0; i < children.length; i++) {
  49943. if (Array.isArray(children[i])) {
  49944. return Array.prototype.concat.apply([], children)
  49945. }
  49946. }
  49947. return children
  49948. }
  49949. // 2. When the children contains constructs that always generated nested Arrays,
  49950. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  49951. // with hand-written render functions / JSX. In such cases a full normalization
  49952. // is needed to cater to all possible types of children values.
  49953. function normalizeChildren (children) {
  49954. return isPrimitive(children)
  49955. ? [createTextVNode(children)]
  49956. : Array.isArray(children)
  49957. ? normalizeArrayChildren(children)
  49958. : undefined
  49959. }
  49960. function isTextNode (node) {
  49961. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  49962. }
  49963. function normalizeArrayChildren (children, nestedIndex) {
  49964. var res = [];
  49965. var i, c, lastIndex, last;
  49966. for (i = 0; i < children.length; i++) {
  49967. c = children[i];
  49968. if (isUndef(c) || typeof c === 'boolean') { continue }
  49969. lastIndex = res.length - 1;
  49970. last = res[lastIndex];
  49971. // nested
  49972. if (Array.isArray(c)) {
  49973. if (c.length > 0) {
  49974. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  49975. // merge adjacent text nodes
  49976. if (isTextNode(c[0]) && isTextNode(last)) {
  49977. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  49978. c.shift();
  49979. }
  49980. res.push.apply(res, c);
  49981. }
  49982. } else if (isPrimitive(c)) {
  49983. if (isTextNode(last)) {
  49984. // merge adjacent text nodes
  49985. // this is necessary for SSR hydration because text nodes are
  49986. // essentially merged when rendered to HTML strings
  49987. res[lastIndex] = createTextVNode(last.text + c);
  49988. } else if (c !== '') {
  49989. // convert primitive to vnode
  49990. res.push(createTextVNode(c));
  49991. }
  49992. } else {
  49993. if (isTextNode(c) && isTextNode(last)) {
  49994. // merge adjacent text nodes
  49995. res[lastIndex] = createTextVNode(last.text + c.text);
  49996. } else {
  49997. // default key for nested array children (likely generated by v-for)
  49998. if (isTrue(children._isVList) &&
  49999. isDef(c.tag) &&
  50000. isUndef(c.key) &&
  50001. isDef(nestedIndex)) {
  50002. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  50003. }
  50004. res.push(c);
  50005. }
  50006. }
  50007. }
  50008. return res
  50009. }
  50010. /* */
  50011. function initProvide (vm) {
  50012. var provide = vm.$options.provide;
  50013. if (provide) {
  50014. vm._provided = typeof provide === 'function'
  50015. ? provide.call(vm)
  50016. : provide;
  50017. }
  50018. }
  50019. function initInjections (vm) {
  50020. var result = resolveInject(vm.$options.inject, vm);
  50021. if (result) {
  50022. toggleObserving(false);
  50023. Object.keys(result).forEach(function (key) {
  50024. /* istanbul ignore else */
  50025. {
  50026. defineReactive$$1(vm, key, result[key], function () {
  50027. warn(
  50028. "Avoid mutating an injected value directly since the changes will be " +
  50029. "overwritten whenever the provided component re-renders. " +
  50030. "injection being mutated: \"" + key + "\"",
  50031. vm
  50032. );
  50033. });
  50034. }
  50035. });
  50036. toggleObserving(true);
  50037. }
  50038. }
  50039. function resolveInject (inject, vm) {
  50040. if (inject) {
  50041. // inject is :any because flow is not smart enough to figure out cached
  50042. var result = Object.create(null);
  50043. var keys = hasSymbol
  50044. ? Reflect.ownKeys(inject)
  50045. : Object.keys(inject);
  50046. for (var i = 0; i < keys.length; i++) {
  50047. var key = keys[i];
  50048. // #6574 in case the inject object is observed...
  50049. if (key === '__ob__') { continue }
  50050. var provideKey = inject[key].from;
  50051. var source = vm;
  50052. while (source) {
  50053. if (source._provided && hasOwn(source._provided, provideKey)) {
  50054. result[key] = source._provided[provideKey];
  50055. break
  50056. }
  50057. source = source.$parent;
  50058. }
  50059. if (!source) {
  50060. if ('default' in inject[key]) {
  50061. var provideDefault = inject[key].default;
  50062. result[key] = typeof provideDefault === 'function'
  50063. ? provideDefault.call(vm)
  50064. : provideDefault;
  50065. } else {
  50066. warn(("Injection \"" + key + "\" not found"), vm);
  50067. }
  50068. }
  50069. }
  50070. return result
  50071. }
  50072. }
  50073. /* */
  50074. /**
  50075. * Runtime helper for resolving raw children VNodes into a slot object.
  50076. */
  50077. function resolveSlots (
  50078. children,
  50079. context
  50080. ) {
  50081. if (!children || !children.length) {
  50082. return {}
  50083. }
  50084. var slots = {};
  50085. for (var i = 0, l = children.length; i < l; i++) {
  50086. var child = children[i];
  50087. var data = child.data;
  50088. // remove slot attribute if the node is resolved as a Vue slot node
  50089. if (data && data.attrs && data.attrs.slot) {
  50090. delete data.attrs.slot;
  50091. }
  50092. // named slots should only be respected if the vnode was rendered in the
  50093. // same context.
  50094. if ((child.context === context || child.fnContext === context) &&
  50095. data && data.slot != null
  50096. ) {
  50097. var name = data.slot;
  50098. var slot = (slots[name] || (slots[name] = []));
  50099. if (child.tag === 'template') {
  50100. slot.push.apply(slot, child.children || []);
  50101. } else {
  50102. slot.push(child);
  50103. }
  50104. } else {
  50105. (slots.default || (slots.default = [])).push(child);
  50106. }
  50107. }
  50108. // ignore slots that contains only whitespace
  50109. for (var name$1 in slots) {
  50110. if (slots[name$1].every(isWhitespace)) {
  50111. delete slots[name$1];
  50112. }
  50113. }
  50114. return slots
  50115. }
  50116. function isWhitespace (node) {
  50117. return (node.isComment && !node.asyncFactory) || node.text === ' '
  50118. }
  50119. /* */
  50120. function normalizeScopedSlots (
  50121. slots,
  50122. normalSlots,
  50123. prevSlots
  50124. ) {
  50125. var res;
  50126. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  50127. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  50128. var key = slots && slots.$key;
  50129. if (!slots) {
  50130. res = {};
  50131. } else if (slots._normalized) {
  50132. // fast path 1: child component re-render only, parent did not change
  50133. return slots._normalized
  50134. } else if (
  50135. isStable &&
  50136. prevSlots &&
  50137. prevSlots !== emptyObject &&
  50138. key === prevSlots.$key &&
  50139. !hasNormalSlots &&
  50140. !prevSlots.$hasNormal
  50141. ) {
  50142. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  50143. // only need to normalize once
  50144. return prevSlots
  50145. } else {
  50146. res = {};
  50147. for (var key$1 in slots) {
  50148. if (slots[key$1] && key$1[0] !== '$') {
  50149. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  50150. }
  50151. }
  50152. }
  50153. // expose normal slots on scopedSlots
  50154. for (var key$2 in normalSlots) {
  50155. if (!(key$2 in res)) {
  50156. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  50157. }
  50158. }
  50159. // avoriaz seems to mock a non-extensible $scopedSlots object
  50160. // and when that is passed down this would cause an error
  50161. if (slots && Object.isExtensible(slots)) {
  50162. (slots)._normalized = res;
  50163. }
  50164. def(res, '$stable', isStable);
  50165. def(res, '$key', key);
  50166. def(res, '$hasNormal', hasNormalSlots);
  50167. return res
  50168. }
  50169. function normalizeScopedSlot(normalSlots, key, fn) {
  50170. var normalized = function () {
  50171. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  50172. res = res && typeof res === 'object' && !Array.isArray(res)
  50173. ? [res] // single vnode
  50174. : normalizeChildren(res);
  50175. return res && (
  50176. res.length === 0 ||
  50177. (res.length === 1 && res[0].isComment) // #9658
  50178. ) ? undefined
  50179. : res
  50180. };
  50181. // this is a slot using the new v-slot syntax without scope. although it is
  50182. // compiled as a scoped slot, render fn users would expect it to be present
  50183. // on this.$slots because the usage is semantically a normal slot.
  50184. if (fn.proxy) {
  50185. Object.defineProperty(normalSlots, key, {
  50186. get: normalized,
  50187. enumerable: true,
  50188. configurable: true
  50189. });
  50190. }
  50191. return normalized
  50192. }
  50193. function proxyNormalSlot(slots, key) {
  50194. return function () { return slots[key]; }
  50195. }
  50196. /* */
  50197. /**
  50198. * Runtime helper for rendering v-for lists.
  50199. */
  50200. function renderList (
  50201. val,
  50202. render
  50203. ) {
  50204. var ret, i, l, keys, key;
  50205. if (Array.isArray(val) || typeof val === 'string') {
  50206. ret = new Array(val.length);
  50207. for (i = 0, l = val.length; i < l; i++) {
  50208. ret[i] = render(val[i], i);
  50209. }
  50210. } else if (typeof val === 'number') {
  50211. ret = new Array(val);
  50212. for (i = 0; i < val; i++) {
  50213. ret[i] = render(i + 1, i);
  50214. }
  50215. } else if (isObject(val)) {
  50216. if (hasSymbol && val[Symbol.iterator]) {
  50217. ret = [];
  50218. var iterator = val[Symbol.iterator]();
  50219. var result = iterator.next();
  50220. while (!result.done) {
  50221. ret.push(render(result.value, ret.length));
  50222. result = iterator.next();
  50223. }
  50224. } else {
  50225. keys = Object.keys(val);
  50226. ret = new Array(keys.length);
  50227. for (i = 0, l = keys.length; i < l; i++) {
  50228. key = keys[i];
  50229. ret[i] = render(val[key], key, i);
  50230. }
  50231. }
  50232. }
  50233. if (!isDef(ret)) {
  50234. ret = [];
  50235. }
  50236. (ret)._isVList = true;
  50237. return ret
  50238. }
  50239. /* */
  50240. /**
  50241. * Runtime helper for rendering <slot>
  50242. */
  50243. function renderSlot (
  50244. name,
  50245. fallback,
  50246. props,
  50247. bindObject
  50248. ) {
  50249. var scopedSlotFn = this.$scopedSlots[name];
  50250. var nodes;
  50251. if (scopedSlotFn) { // scoped slot
  50252. props = props || {};
  50253. if (bindObject) {
  50254. if (!isObject(bindObject)) {
  50255. warn(
  50256. 'slot v-bind without argument expects an Object',
  50257. this
  50258. );
  50259. }
  50260. props = extend(extend({}, bindObject), props);
  50261. }
  50262. nodes = scopedSlotFn(props) || fallback;
  50263. } else {
  50264. nodes = this.$slots[name] || fallback;
  50265. }
  50266. var target = props && props.slot;
  50267. if (target) {
  50268. return this.$createElement('template', { slot: target }, nodes)
  50269. } else {
  50270. return nodes
  50271. }
  50272. }
  50273. /* */
  50274. /**
  50275. * Runtime helper for resolving filters
  50276. */
  50277. function resolveFilter (id) {
  50278. return resolveAsset(this.$options, 'filters', id, true) || identity
  50279. }
  50280. /* */
  50281. function isKeyNotMatch (expect, actual) {
  50282. if (Array.isArray(expect)) {
  50283. return expect.indexOf(actual) === -1
  50284. } else {
  50285. return expect !== actual
  50286. }
  50287. }
  50288. /**
  50289. * Runtime helper for checking keyCodes from config.
  50290. * exposed as Vue.prototype._k
  50291. * passing in eventKeyName as last argument separately for backwards compat
  50292. */
  50293. function checkKeyCodes (
  50294. eventKeyCode,
  50295. key,
  50296. builtInKeyCode,
  50297. eventKeyName,
  50298. builtInKeyName
  50299. ) {
  50300. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  50301. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  50302. return isKeyNotMatch(builtInKeyName, eventKeyName)
  50303. } else if (mappedKeyCode) {
  50304. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  50305. } else if (eventKeyName) {
  50306. return hyphenate(eventKeyName) !== key
  50307. }
  50308. }
  50309. /* */
  50310. /**
  50311. * Runtime helper for merging v-bind="object" into a VNode's data.
  50312. */
  50313. function bindObjectProps (
  50314. data,
  50315. tag,
  50316. value,
  50317. asProp,
  50318. isSync
  50319. ) {
  50320. if (value) {
  50321. if (!isObject(value)) {
  50322. warn(
  50323. 'v-bind without argument expects an Object or Array value',
  50324. this
  50325. );
  50326. } else {
  50327. if (Array.isArray(value)) {
  50328. value = toObject(value);
  50329. }
  50330. var hash;
  50331. var loop = function ( key ) {
  50332. if (
  50333. key === 'class' ||
  50334. key === 'style' ||
  50335. isReservedAttribute(key)
  50336. ) {
  50337. hash = data;
  50338. } else {
  50339. var type = data.attrs && data.attrs.type;
  50340. hash = asProp || config.mustUseProp(tag, type, key)
  50341. ? data.domProps || (data.domProps = {})
  50342. : data.attrs || (data.attrs = {});
  50343. }
  50344. var camelizedKey = camelize(key);
  50345. var hyphenatedKey = hyphenate(key);
  50346. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  50347. hash[key] = value[key];
  50348. if (isSync) {
  50349. var on = data.on || (data.on = {});
  50350. on[("update:" + key)] = function ($event) {
  50351. value[key] = $event;
  50352. };
  50353. }
  50354. }
  50355. };
  50356. for (var key in value) loop( key );
  50357. }
  50358. }
  50359. return data
  50360. }
  50361. /* */
  50362. /**
  50363. * Runtime helper for rendering static trees.
  50364. */
  50365. function renderStatic (
  50366. index,
  50367. isInFor
  50368. ) {
  50369. var cached = this._staticTrees || (this._staticTrees = []);
  50370. var tree = cached[index];
  50371. // if has already-rendered static tree and not inside v-for,
  50372. // we can reuse the same tree.
  50373. if (tree && !isInFor) {
  50374. return tree
  50375. }
  50376. // otherwise, render a fresh tree.
  50377. tree = cached[index] = this.$options.staticRenderFns[index].call(
  50378. this._renderProxy,
  50379. null,
  50380. this // for render fns generated for functional component templates
  50381. );
  50382. markStatic(tree, ("__static__" + index), false);
  50383. return tree
  50384. }
  50385. /**
  50386. * Runtime helper for v-once.
  50387. * Effectively it means marking the node as static with a unique key.
  50388. */
  50389. function markOnce (
  50390. tree,
  50391. index,
  50392. key
  50393. ) {
  50394. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  50395. return tree
  50396. }
  50397. function markStatic (
  50398. tree,
  50399. key,
  50400. isOnce
  50401. ) {
  50402. if (Array.isArray(tree)) {
  50403. for (var i = 0; i < tree.length; i++) {
  50404. if (tree[i] && typeof tree[i] !== 'string') {
  50405. markStaticNode(tree[i], (key + "_" + i), isOnce);
  50406. }
  50407. }
  50408. } else {
  50409. markStaticNode(tree, key, isOnce);
  50410. }
  50411. }
  50412. function markStaticNode (node, key, isOnce) {
  50413. node.isStatic = true;
  50414. node.key = key;
  50415. node.isOnce = isOnce;
  50416. }
  50417. /* */
  50418. function bindObjectListeners (data, value) {
  50419. if (value) {
  50420. if (!isPlainObject(value)) {
  50421. warn(
  50422. 'v-on without argument expects an Object value',
  50423. this
  50424. );
  50425. } else {
  50426. var on = data.on = data.on ? extend({}, data.on) : {};
  50427. for (var key in value) {
  50428. var existing = on[key];
  50429. var ours = value[key];
  50430. on[key] = existing ? [].concat(existing, ours) : ours;
  50431. }
  50432. }
  50433. }
  50434. return data
  50435. }
  50436. /* */
  50437. function resolveScopedSlots (
  50438. fns, // see flow/vnode
  50439. res,
  50440. // the following are added in 2.6
  50441. hasDynamicKeys,
  50442. contentHashKey
  50443. ) {
  50444. res = res || { $stable: !hasDynamicKeys };
  50445. for (var i = 0; i < fns.length; i++) {
  50446. var slot = fns[i];
  50447. if (Array.isArray(slot)) {
  50448. resolveScopedSlots(slot, res, hasDynamicKeys);
  50449. } else if (slot) {
  50450. // marker for reverse proxying v-slot without scope on this.$slots
  50451. if (slot.proxy) {
  50452. slot.fn.proxy = true;
  50453. }
  50454. res[slot.key] = slot.fn;
  50455. }
  50456. }
  50457. if (contentHashKey) {
  50458. (res).$key = contentHashKey;
  50459. }
  50460. return res
  50461. }
  50462. /* */
  50463. function bindDynamicKeys (baseObj, values) {
  50464. for (var i = 0; i < values.length; i += 2) {
  50465. var key = values[i];
  50466. if (typeof key === 'string' && key) {
  50467. baseObj[values[i]] = values[i + 1];
  50468. } else if (key !== '' && key !== null) {
  50469. // null is a special value for explicitly removing a binding
  50470. warn(
  50471. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  50472. this
  50473. );
  50474. }
  50475. }
  50476. return baseObj
  50477. }
  50478. // helper to dynamically append modifier runtime markers to event names.
  50479. // ensure only append when value is already string, otherwise it will be cast
  50480. // to string and cause the type check to miss.
  50481. function prependModifier (value, symbol) {
  50482. return typeof value === 'string' ? symbol + value : value
  50483. }
  50484. /* */
  50485. function installRenderHelpers (target) {
  50486. target._o = markOnce;
  50487. target._n = toNumber;
  50488. target._s = toString;
  50489. target._l = renderList;
  50490. target._t = renderSlot;
  50491. target._q = looseEqual;
  50492. target._i = looseIndexOf;
  50493. target._m = renderStatic;
  50494. target._f = resolveFilter;
  50495. target._k = checkKeyCodes;
  50496. target._b = bindObjectProps;
  50497. target._v = createTextVNode;
  50498. target._e = createEmptyVNode;
  50499. target._u = resolveScopedSlots;
  50500. target._g = bindObjectListeners;
  50501. target._d = bindDynamicKeys;
  50502. target._p = prependModifier;
  50503. }
  50504. /* */
  50505. function FunctionalRenderContext (
  50506. data,
  50507. props,
  50508. children,
  50509. parent,
  50510. Ctor
  50511. ) {
  50512. var this$1 = this;
  50513. var options = Ctor.options;
  50514. // ensure the createElement function in functional components
  50515. // gets a unique context - this is necessary for correct named slot check
  50516. var contextVm;
  50517. if (hasOwn(parent, '_uid')) {
  50518. contextVm = Object.create(parent);
  50519. // $flow-disable-line
  50520. contextVm._original = parent;
  50521. } else {
  50522. // the context vm passed in is a functional context as well.
  50523. // in this case we want to make sure we are able to get a hold to the
  50524. // real context instance.
  50525. contextVm = parent;
  50526. // $flow-disable-line
  50527. parent = parent._original;
  50528. }
  50529. var isCompiled = isTrue(options._compiled);
  50530. var needNormalization = !isCompiled;
  50531. this.data = data;
  50532. this.props = props;
  50533. this.children = children;
  50534. this.parent = parent;
  50535. this.listeners = data.on || emptyObject;
  50536. this.injections = resolveInject(options.inject, parent);
  50537. this.slots = function () {
  50538. if (!this$1.$slots) {
  50539. normalizeScopedSlots(
  50540. data.scopedSlots,
  50541. this$1.$slots = resolveSlots(children, parent)
  50542. );
  50543. }
  50544. return this$1.$slots
  50545. };
  50546. Object.defineProperty(this, 'scopedSlots', ({
  50547. enumerable: true,
  50548. get: function get () {
  50549. return normalizeScopedSlots(data.scopedSlots, this.slots())
  50550. }
  50551. }));
  50552. // support for compiled functional template
  50553. if (isCompiled) {
  50554. // exposing $options for renderStatic()
  50555. this.$options = options;
  50556. // pre-resolve slots for renderSlot()
  50557. this.$slots = this.slots();
  50558. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  50559. }
  50560. if (options._scopeId) {
  50561. this._c = function (a, b, c, d) {
  50562. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  50563. if (vnode && !Array.isArray(vnode)) {
  50564. vnode.fnScopeId = options._scopeId;
  50565. vnode.fnContext = parent;
  50566. }
  50567. return vnode
  50568. };
  50569. } else {
  50570. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  50571. }
  50572. }
  50573. installRenderHelpers(FunctionalRenderContext.prototype);
  50574. function createFunctionalComponent (
  50575. Ctor,
  50576. propsData,
  50577. data,
  50578. contextVm,
  50579. children
  50580. ) {
  50581. var options = Ctor.options;
  50582. var props = {};
  50583. var propOptions = options.props;
  50584. if (isDef(propOptions)) {
  50585. for (var key in propOptions) {
  50586. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  50587. }
  50588. } else {
  50589. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  50590. if (isDef(data.props)) { mergeProps(props, data.props); }
  50591. }
  50592. var renderContext = new FunctionalRenderContext(
  50593. data,
  50594. props,
  50595. children,
  50596. contextVm,
  50597. Ctor
  50598. );
  50599. var vnode = options.render.call(null, renderContext._c, renderContext);
  50600. if (vnode instanceof VNode) {
  50601. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  50602. } else if (Array.isArray(vnode)) {
  50603. var vnodes = normalizeChildren(vnode) || [];
  50604. var res = new Array(vnodes.length);
  50605. for (var i = 0; i < vnodes.length; i++) {
  50606. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  50607. }
  50608. return res
  50609. }
  50610. }
  50611. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  50612. // #7817 clone node before setting fnContext, otherwise if the node is reused
  50613. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  50614. // that should not be matched to match.
  50615. var clone = cloneVNode(vnode);
  50616. clone.fnContext = contextVm;
  50617. clone.fnOptions = options;
  50618. {
  50619. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  50620. }
  50621. if (data.slot) {
  50622. (clone.data || (clone.data = {})).slot = data.slot;
  50623. }
  50624. return clone
  50625. }
  50626. function mergeProps (to, from) {
  50627. for (var key in from) {
  50628. to[camelize(key)] = from[key];
  50629. }
  50630. }
  50631. /* */
  50632. /* */
  50633. /* */
  50634. /* */
  50635. // inline hooks to be invoked on component VNodes during patch
  50636. var componentVNodeHooks = {
  50637. init: function init (vnode, hydrating) {
  50638. if (
  50639. vnode.componentInstance &&
  50640. !vnode.componentInstance._isDestroyed &&
  50641. vnode.data.keepAlive
  50642. ) {
  50643. // kept-alive components, treat as a patch
  50644. var mountedNode = vnode; // work around flow
  50645. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  50646. } else {
  50647. var child = vnode.componentInstance = createComponentInstanceForVnode(
  50648. vnode,
  50649. activeInstance
  50650. );
  50651. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  50652. }
  50653. },
  50654. prepatch: function prepatch (oldVnode, vnode) {
  50655. var options = vnode.componentOptions;
  50656. var child = vnode.componentInstance = oldVnode.componentInstance;
  50657. updateChildComponent(
  50658. child,
  50659. options.propsData, // updated props
  50660. options.listeners, // updated listeners
  50661. vnode, // new parent vnode
  50662. options.children // new children
  50663. );
  50664. },
  50665. insert: function insert (vnode) {
  50666. var context = vnode.context;
  50667. var componentInstance = vnode.componentInstance;
  50668. if (!componentInstance._isMounted) {
  50669. componentInstance._isMounted = true;
  50670. callHook(componentInstance, 'mounted');
  50671. }
  50672. if (vnode.data.keepAlive) {
  50673. if (context._isMounted) {
  50674. // vue-router#1212
  50675. // During updates, a kept-alive component's child components may
  50676. // change, so directly walking the tree here may call activated hooks
  50677. // on incorrect children. Instead we push them into a queue which will
  50678. // be processed after the whole patch process ended.
  50679. queueActivatedComponent(componentInstance);
  50680. } else {
  50681. activateChildComponent(componentInstance, true /* direct */);
  50682. }
  50683. }
  50684. },
  50685. destroy: function destroy (vnode) {
  50686. var componentInstance = vnode.componentInstance;
  50687. if (!componentInstance._isDestroyed) {
  50688. if (!vnode.data.keepAlive) {
  50689. componentInstance.$destroy();
  50690. } else {
  50691. deactivateChildComponent(componentInstance, true /* direct */);
  50692. }
  50693. }
  50694. }
  50695. };
  50696. var hooksToMerge = Object.keys(componentVNodeHooks);
  50697. function createComponent (
  50698. Ctor,
  50699. data,
  50700. context,
  50701. children,
  50702. tag
  50703. ) {
  50704. if (isUndef(Ctor)) {
  50705. return
  50706. }
  50707. var baseCtor = context.$options._base;
  50708. // plain options object: turn it into a constructor
  50709. if (isObject(Ctor)) {
  50710. Ctor = baseCtor.extend(Ctor);
  50711. }
  50712. // if at this stage it's not a constructor or an async component factory,
  50713. // reject.
  50714. if (typeof Ctor !== 'function') {
  50715. {
  50716. warn(("Invalid Component definition: " + (String(Ctor))), context);
  50717. }
  50718. return
  50719. }
  50720. // async component
  50721. var asyncFactory;
  50722. if (isUndef(Ctor.cid)) {
  50723. asyncFactory = Ctor;
  50724. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  50725. if (Ctor === undefined) {
  50726. // return a placeholder node for async component, which is rendered
  50727. // as a comment node but preserves all the raw information for the node.
  50728. // the information will be used for async server-rendering and hydration.
  50729. return createAsyncPlaceholder(
  50730. asyncFactory,
  50731. data,
  50732. context,
  50733. children,
  50734. tag
  50735. )
  50736. }
  50737. }
  50738. data = data || {};
  50739. // resolve constructor options in case global mixins are applied after
  50740. // component constructor creation
  50741. resolveConstructorOptions(Ctor);
  50742. // transform component v-model data into props & events
  50743. if (isDef(data.model)) {
  50744. transformModel(Ctor.options, data);
  50745. }
  50746. // extract props
  50747. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  50748. // functional component
  50749. if (isTrue(Ctor.options.functional)) {
  50750. return createFunctionalComponent(Ctor, propsData, data, context, children)
  50751. }
  50752. // extract listeners, since these needs to be treated as
  50753. // child component listeners instead of DOM listeners
  50754. var listeners = data.on;
  50755. // replace with listeners with .native modifier
  50756. // so it gets processed during parent component patch.
  50757. data.on = data.nativeOn;
  50758. if (isTrue(Ctor.options.abstract)) {
  50759. // abstract components do not keep anything
  50760. // other than props & listeners & slot
  50761. // work around flow
  50762. var slot = data.slot;
  50763. data = {};
  50764. if (slot) {
  50765. data.slot = slot;
  50766. }
  50767. }
  50768. // install component management hooks onto the placeholder node
  50769. installComponentHooks(data);
  50770. // return a placeholder vnode
  50771. var name = Ctor.options.name || tag;
  50772. var vnode = new VNode(
  50773. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  50774. data, undefined, undefined, undefined, context,
  50775. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  50776. asyncFactory
  50777. );
  50778. return vnode
  50779. }
  50780. function createComponentInstanceForVnode (
  50781. vnode, // we know it's MountedComponentVNode but flow doesn't
  50782. parent // activeInstance in lifecycle state
  50783. ) {
  50784. var options = {
  50785. _isComponent: true,
  50786. _parentVnode: vnode,
  50787. parent: parent
  50788. };
  50789. // check inline-template render functions
  50790. var inlineTemplate = vnode.data.inlineTemplate;
  50791. if (isDef(inlineTemplate)) {
  50792. options.render = inlineTemplate.render;
  50793. options.staticRenderFns = inlineTemplate.staticRenderFns;
  50794. }
  50795. return new vnode.componentOptions.Ctor(options)
  50796. }
  50797. function installComponentHooks (data) {
  50798. var hooks = data.hook || (data.hook = {});
  50799. for (var i = 0; i < hooksToMerge.length; i++) {
  50800. var key = hooksToMerge[i];
  50801. var existing = hooks[key];
  50802. var toMerge = componentVNodeHooks[key];
  50803. if (existing !== toMerge && !(existing && existing._merged)) {
  50804. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  50805. }
  50806. }
  50807. }
  50808. function mergeHook$1 (f1, f2) {
  50809. var merged = function (a, b) {
  50810. // flow complains about extra args which is why we use any
  50811. f1(a, b);
  50812. f2(a, b);
  50813. };
  50814. merged._merged = true;
  50815. return merged
  50816. }
  50817. // transform component v-model info (value and callback) into
  50818. // prop and event handler respectively.
  50819. function transformModel (options, data) {
  50820. var prop = (options.model && options.model.prop) || 'value';
  50821. var event = (options.model && options.model.event) || 'input'
  50822. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  50823. var on = data.on || (data.on = {});
  50824. var existing = on[event];
  50825. var callback = data.model.callback;
  50826. if (isDef(existing)) {
  50827. if (
  50828. Array.isArray(existing)
  50829. ? existing.indexOf(callback) === -1
  50830. : existing !== callback
  50831. ) {
  50832. on[event] = [callback].concat(existing);
  50833. }
  50834. } else {
  50835. on[event] = callback;
  50836. }
  50837. }
  50838. /* */
  50839. var SIMPLE_NORMALIZE = 1;
  50840. var ALWAYS_NORMALIZE = 2;
  50841. // wrapper function for providing a more flexible interface
  50842. // without getting yelled at by flow
  50843. function createElement (
  50844. context,
  50845. tag,
  50846. data,
  50847. children,
  50848. normalizationType,
  50849. alwaysNormalize
  50850. ) {
  50851. if (Array.isArray(data) || isPrimitive(data)) {
  50852. normalizationType = children;
  50853. children = data;
  50854. data = undefined;
  50855. }
  50856. if (isTrue(alwaysNormalize)) {
  50857. normalizationType = ALWAYS_NORMALIZE;
  50858. }
  50859. return _createElement(context, tag, data, children, normalizationType)
  50860. }
  50861. function _createElement (
  50862. context,
  50863. tag,
  50864. data,
  50865. children,
  50866. normalizationType
  50867. ) {
  50868. if (isDef(data) && isDef((data).__ob__)) {
  50869. warn(
  50870. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  50871. 'Always create fresh vnode data objects in each render!',
  50872. context
  50873. );
  50874. return createEmptyVNode()
  50875. }
  50876. // object syntax in v-bind
  50877. if (isDef(data) && isDef(data.is)) {
  50878. tag = data.is;
  50879. }
  50880. if (!tag) {
  50881. // in case of component :is set to falsy value
  50882. return createEmptyVNode()
  50883. }
  50884. // warn against non-primitive key
  50885. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  50886. ) {
  50887. {
  50888. warn(
  50889. 'Avoid using non-primitive value as key, ' +
  50890. 'use string/number value instead.',
  50891. context
  50892. );
  50893. }
  50894. }
  50895. // support single function children as default scoped slot
  50896. if (Array.isArray(children) &&
  50897. typeof children[0] === 'function'
  50898. ) {
  50899. data = data || {};
  50900. data.scopedSlots = { default: children[0] };
  50901. children.length = 0;
  50902. }
  50903. if (normalizationType === ALWAYS_NORMALIZE) {
  50904. children = normalizeChildren(children);
  50905. } else if (normalizationType === SIMPLE_NORMALIZE) {
  50906. children = simpleNormalizeChildren(children);
  50907. }
  50908. var vnode, ns;
  50909. if (typeof tag === 'string') {
  50910. var Ctor;
  50911. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  50912. if (config.isReservedTag(tag)) {
  50913. // platform built-in elements
  50914. if (isDef(data) && isDef(data.nativeOn)) {
  50915. warn(
  50916. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  50917. context
  50918. );
  50919. }
  50920. vnode = new VNode(
  50921. config.parsePlatformTagName(tag), data, children,
  50922. undefined, undefined, context
  50923. );
  50924. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  50925. // component
  50926. vnode = createComponent(Ctor, data, context, children, tag);
  50927. } else {
  50928. // unknown or unlisted namespaced elements
  50929. // check at runtime because it may get assigned a namespace when its
  50930. // parent normalizes children
  50931. vnode = new VNode(
  50932. tag, data, children,
  50933. undefined, undefined, context
  50934. );
  50935. }
  50936. } else {
  50937. // direct component options / constructor
  50938. vnode = createComponent(tag, data, context, children);
  50939. }
  50940. if (Array.isArray(vnode)) {
  50941. return vnode
  50942. } else if (isDef(vnode)) {
  50943. if (isDef(ns)) { applyNS(vnode, ns); }
  50944. if (isDef(data)) { registerDeepBindings(data); }
  50945. return vnode
  50946. } else {
  50947. return createEmptyVNode()
  50948. }
  50949. }
  50950. function applyNS (vnode, ns, force) {
  50951. vnode.ns = ns;
  50952. if (vnode.tag === 'foreignObject') {
  50953. // use default namespace inside foreignObject
  50954. ns = undefined;
  50955. force = true;
  50956. }
  50957. if (isDef(vnode.children)) {
  50958. for (var i = 0, l = vnode.children.length; i < l; i++) {
  50959. var child = vnode.children[i];
  50960. if (isDef(child.tag) && (
  50961. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  50962. applyNS(child, ns, force);
  50963. }
  50964. }
  50965. }
  50966. }
  50967. // ref #5318
  50968. // necessary to ensure parent re-render when deep bindings like :style and
  50969. // :class are used on slot nodes
  50970. function registerDeepBindings (data) {
  50971. if (isObject(data.style)) {
  50972. traverse(data.style);
  50973. }
  50974. if (isObject(data.class)) {
  50975. traverse(data.class);
  50976. }
  50977. }
  50978. /* */
  50979. function initRender (vm) {
  50980. vm._vnode = null; // the root of the child tree
  50981. vm._staticTrees = null; // v-once cached trees
  50982. var options = vm.$options;
  50983. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  50984. var renderContext = parentVnode && parentVnode.context;
  50985. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  50986. vm.$scopedSlots = emptyObject;
  50987. // bind the createElement fn to this instance
  50988. // so that we get proper render context inside it.
  50989. // args order: tag, data, children, normalizationType, alwaysNormalize
  50990. // internal version is used by render functions compiled from templates
  50991. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  50992. // normalization is always applied for the public version, used in
  50993. // user-written render functions.
  50994. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  50995. // $attrs & $listeners are exposed for easier HOC creation.
  50996. // they need to be reactive so that HOCs using them are always updated
  50997. var parentData = parentVnode && parentVnode.data;
  50998. /* istanbul ignore else */
  50999. {
  51000. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  51001. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  51002. }, true);
  51003. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  51004. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  51005. }, true);
  51006. }
  51007. }
  51008. var currentRenderingInstance = null;
  51009. function renderMixin (Vue) {
  51010. // install runtime convenience helpers
  51011. installRenderHelpers(Vue.prototype);
  51012. Vue.prototype.$nextTick = function (fn) {
  51013. return nextTick(fn, this)
  51014. };
  51015. Vue.prototype._render = function () {
  51016. var vm = this;
  51017. var ref = vm.$options;
  51018. var render = ref.render;
  51019. var _parentVnode = ref._parentVnode;
  51020. if (_parentVnode) {
  51021. vm.$scopedSlots = normalizeScopedSlots(
  51022. _parentVnode.data.scopedSlots,
  51023. vm.$slots,
  51024. vm.$scopedSlots
  51025. );
  51026. }
  51027. // set parent vnode. this allows render functions to have access
  51028. // to the data on the placeholder node.
  51029. vm.$vnode = _parentVnode;
  51030. // render self
  51031. var vnode;
  51032. try {
  51033. // There's no need to maintain a stack because all render fns are called
  51034. // separately from one another. Nested component's render fns are called
  51035. // when parent component is patched.
  51036. currentRenderingInstance = vm;
  51037. vnode = render.call(vm._renderProxy, vm.$createElement);
  51038. } catch (e) {
  51039. handleError(e, vm, "render");
  51040. // return error render result,
  51041. // or previous vnode to prevent render error causing blank component
  51042. /* istanbul ignore else */
  51043. if (vm.$options.renderError) {
  51044. try {
  51045. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  51046. } catch (e) {
  51047. handleError(e, vm, "renderError");
  51048. vnode = vm._vnode;
  51049. }
  51050. } else {
  51051. vnode = vm._vnode;
  51052. }
  51053. } finally {
  51054. currentRenderingInstance = null;
  51055. }
  51056. // if the returned array contains only a single node, allow it
  51057. if (Array.isArray(vnode) && vnode.length === 1) {
  51058. vnode = vnode[0];
  51059. }
  51060. // return empty vnode in case the render function errored out
  51061. if (!(vnode instanceof VNode)) {
  51062. if (Array.isArray(vnode)) {
  51063. warn(
  51064. 'Multiple root nodes returned from render function. Render function ' +
  51065. 'should return a single root node.',
  51066. vm
  51067. );
  51068. }
  51069. vnode = createEmptyVNode();
  51070. }
  51071. // set parent
  51072. vnode.parent = _parentVnode;
  51073. return vnode
  51074. };
  51075. }
  51076. /* */
  51077. function ensureCtor (comp, base) {
  51078. if (
  51079. comp.__esModule ||
  51080. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  51081. ) {
  51082. comp = comp.default;
  51083. }
  51084. return isObject(comp)
  51085. ? base.extend(comp)
  51086. : comp
  51087. }
  51088. function createAsyncPlaceholder (
  51089. factory,
  51090. data,
  51091. context,
  51092. children,
  51093. tag
  51094. ) {
  51095. var node = createEmptyVNode();
  51096. node.asyncFactory = factory;
  51097. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  51098. return node
  51099. }
  51100. function resolveAsyncComponent (
  51101. factory,
  51102. baseCtor
  51103. ) {
  51104. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  51105. return factory.errorComp
  51106. }
  51107. if (isDef(factory.resolved)) {
  51108. return factory.resolved
  51109. }
  51110. var owner = currentRenderingInstance;
  51111. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  51112. // already pending
  51113. factory.owners.push(owner);
  51114. }
  51115. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  51116. return factory.loadingComp
  51117. }
  51118. if (owner && !isDef(factory.owners)) {
  51119. var owners = factory.owners = [owner];
  51120. var sync = true;
  51121. var timerLoading = null;
  51122. var timerTimeout = null
  51123. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  51124. var forceRender = function (renderCompleted) {
  51125. for (var i = 0, l = owners.length; i < l; i++) {
  51126. (owners[i]).$forceUpdate();
  51127. }
  51128. if (renderCompleted) {
  51129. owners.length = 0;
  51130. if (timerLoading !== null) {
  51131. clearTimeout(timerLoading);
  51132. timerLoading = null;
  51133. }
  51134. if (timerTimeout !== null) {
  51135. clearTimeout(timerTimeout);
  51136. timerTimeout = null;
  51137. }
  51138. }
  51139. };
  51140. var resolve = once(function (res) {
  51141. // cache resolved
  51142. factory.resolved = ensureCtor(res, baseCtor);
  51143. // invoke callbacks only if this is not a synchronous resolve
  51144. // (async resolves are shimmed as synchronous during SSR)
  51145. if (!sync) {
  51146. forceRender(true);
  51147. } else {
  51148. owners.length = 0;
  51149. }
  51150. });
  51151. var reject = once(function (reason) {
  51152. warn(
  51153. "Failed to resolve async component: " + (String(factory)) +
  51154. (reason ? ("\nReason: " + reason) : '')
  51155. );
  51156. if (isDef(factory.errorComp)) {
  51157. factory.error = true;
  51158. forceRender(true);
  51159. }
  51160. });
  51161. var res = factory(resolve, reject);
  51162. if (isObject(res)) {
  51163. if (isPromise(res)) {
  51164. // () => Promise
  51165. if (isUndef(factory.resolved)) {
  51166. res.then(resolve, reject);
  51167. }
  51168. } else if (isPromise(res.component)) {
  51169. res.component.then(resolve, reject);
  51170. if (isDef(res.error)) {
  51171. factory.errorComp = ensureCtor(res.error, baseCtor);
  51172. }
  51173. if (isDef(res.loading)) {
  51174. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  51175. if (res.delay === 0) {
  51176. factory.loading = true;
  51177. } else {
  51178. timerLoading = setTimeout(function () {
  51179. timerLoading = null;
  51180. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  51181. factory.loading = true;
  51182. forceRender(false);
  51183. }
  51184. }, res.delay || 200);
  51185. }
  51186. }
  51187. if (isDef(res.timeout)) {
  51188. timerTimeout = setTimeout(function () {
  51189. timerTimeout = null;
  51190. if (isUndef(factory.resolved)) {
  51191. reject(
  51192. "timeout (" + (res.timeout) + "ms)"
  51193. );
  51194. }
  51195. }, res.timeout);
  51196. }
  51197. }
  51198. }
  51199. sync = false;
  51200. // return in case resolved synchronously
  51201. return factory.loading
  51202. ? factory.loadingComp
  51203. : factory.resolved
  51204. }
  51205. }
  51206. /* */
  51207. function isAsyncPlaceholder (node) {
  51208. return node.isComment && node.asyncFactory
  51209. }
  51210. /* */
  51211. function getFirstComponentChild (children) {
  51212. if (Array.isArray(children)) {
  51213. for (var i = 0; i < children.length; i++) {
  51214. var c = children[i];
  51215. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  51216. return c
  51217. }
  51218. }
  51219. }
  51220. }
  51221. /* */
  51222. /* */
  51223. function initEvents (vm) {
  51224. vm._events = Object.create(null);
  51225. vm._hasHookEvent = false;
  51226. // init parent attached events
  51227. var listeners = vm.$options._parentListeners;
  51228. if (listeners) {
  51229. updateComponentListeners(vm, listeners);
  51230. }
  51231. }
  51232. var target;
  51233. function add (event, fn) {
  51234. target.$on(event, fn);
  51235. }
  51236. function remove$1 (event, fn) {
  51237. target.$off(event, fn);
  51238. }
  51239. function createOnceHandler (event, fn) {
  51240. var _target = target;
  51241. return function onceHandler () {
  51242. var res = fn.apply(null, arguments);
  51243. if (res !== null) {
  51244. _target.$off(event, onceHandler);
  51245. }
  51246. }
  51247. }
  51248. function updateComponentListeners (
  51249. vm,
  51250. listeners,
  51251. oldListeners
  51252. ) {
  51253. target = vm;
  51254. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  51255. target = undefined;
  51256. }
  51257. function eventsMixin (Vue) {
  51258. var hookRE = /^hook:/;
  51259. Vue.prototype.$on = function (event, fn) {
  51260. var vm = this;
  51261. if (Array.isArray(event)) {
  51262. for (var i = 0, l = event.length; i < l; i++) {
  51263. vm.$on(event[i], fn);
  51264. }
  51265. } else {
  51266. (vm._events[event] || (vm._events[event] = [])).push(fn);
  51267. // optimize hook:event cost by using a boolean flag marked at registration
  51268. // instead of a hash lookup
  51269. if (hookRE.test(event)) {
  51270. vm._hasHookEvent = true;
  51271. }
  51272. }
  51273. return vm
  51274. };
  51275. Vue.prototype.$once = function (event, fn) {
  51276. var vm = this;
  51277. function on () {
  51278. vm.$off(event, on);
  51279. fn.apply(vm, arguments);
  51280. }
  51281. on.fn = fn;
  51282. vm.$on(event, on);
  51283. return vm
  51284. };
  51285. Vue.prototype.$off = function (event, fn) {
  51286. var vm = this;
  51287. // all
  51288. if (!arguments.length) {
  51289. vm._events = Object.create(null);
  51290. return vm
  51291. }
  51292. // array of events
  51293. if (Array.isArray(event)) {
  51294. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  51295. vm.$off(event[i$1], fn);
  51296. }
  51297. return vm
  51298. }
  51299. // specific event
  51300. var cbs = vm._events[event];
  51301. if (!cbs) {
  51302. return vm
  51303. }
  51304. if (!fn) {
  51305. vm._events[event] = null;
  51306. return vm
  51307. }
  51308. // specific handler
  51309. var cb;
  51310. var i = cbs.length;
  51311. while (i--) {
  51312. cb = cbs[i];
  51313. if (cb === fn || cb.fn === fn) {
  51314. cbs.splice(i, 1);
  51315. break
  51316. }
  51317. }
  51318. return vm
  51319. };
  51320. Vue.prototype.$emit = function (event) {
  51321. var vm = this;
  51322. {
  51323. var lowerCaseEvent = event.toLowerCase();
  51324. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  51325. tip(
  51326. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  51327. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  51328. "Note that HTML attributes are case-insensitive and you cannot use " +
  51329. "v-on to listen to camelCase events when using in-DOM templates. " +
  51330. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  51331. );
  51332. }
  51333. }
  51334. var cbs = vm._events[event];
  51335. if (cbs) {
  51336. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  51337. var args = toArray(arguments, 1);
  51338. var info = "event handler for \"" + event + "\"";
  51339. for (var i = 0, l = cbs.length; i < l; i++) {
  51340. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  51341. }
  51342. }
  51343. return vm
  51344. };
  51345. }
  51346. /* */
  51347. var activeInstance = null;
  51348. var isUpdatingChildComponent = false;
  51349. function setActiveInstance(vm) {
  51350. var prevActiveInstance = activeInstance;
  51351. activeInstance = vm;
  51352. return function () {
  51353. activeInstance = prevActiveInstance;
  51354. }
  51355. }
  51356. function initLifecycle (vm) {
  51357. var options = vm.$options;
  51358. // locate first non-abstract parent
  51359. var parent = options.parent;
  51360. if (parent && !options.abstract) {
  51361. while (parent.$options.abstract && parent.$parent) {
  51362. parent = parent.$parent;
  51363. }
  51364. parent.$children.push(vm);
  51365. }
  51366. vm.$parent = parent;
  51367. vm.$root = parent ? parent.$root : vm;
  51368. vm.$children = [];
  51369. vm.$refs = {};
  51370. vm._watcher = null;
  51371. vm._inactive = null;
  51372. vm._directInactive = false;
  51373. vm._isMounted = false;
  51374. vm._isDestroyed = false;
  51375. vm._isBeingDestroyed = false;
  51376. }
  51377. function lifecycleMixin (Vue) {
  51378. Vue.prototype._update = function (vnode, hydrating) {
  51379. var vm = this;
  51380. var prevEl = vm.$el;
  51381. var prevVnode = vm._vnode;
  51382. var restoreActiveInstance = setActiveInstance(vm);
  51383. vm._vnode = vnode;
  51384. // Vue.prototype.__patch__ is injected in entry points
  51385. // based on the rendering backend used.
  51386. if (!prevVnode) {
  51387. // initial render
  51388. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  51389. } else {
  51390. // updates
  51391. vm.$el = vm.__patch__(prevVnode, vnode);
  51392. }
  51393. restoreActiveInstance();
  51394. // update __vue__ reference
  51395. if (prevEl) {
  51396. prevEl.__vue__ = null;
  51397. }
  51398. if (vm.$el) {
  51399. vm.$el.__vue__ = vm;
  51400. }
  51401. // if parent is an HOC, update its $el as well
  51402. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  51403. vm.$parent.$el = vm.$el;
  51404. }
  51405. // updated hook is called by the scheduler to ensure that children are
  51406. // updated in a parent's updated hook.
  51407. };
  51408. Vue.prototype.$forceUpdate = function () {
  51409. var vm = this;
  51410. if (vm._watcher) {
  51411. vm._watcher.update();
  51412. }
  51413. };
  51414. Vue.prototype.$destroy = function () {
  51415. var vm = this;
  51416. if (vm._isBeingDestroyed) {
  51417. return
  51418. }
  51419. callHook(vm, 'beforeDestroy');
  51420. vm._isBeingDestroyed = true;
  51421. // remove self from parent
  51422. var parent = vm.$parent;
  51423. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  51424. remove(parent.$children, vm);
  51425. }
  51426. // teardown watchers
  51427. if (vm._watcher) {
  51428. vm._watcher.teardown();
  51429. }
  51430. var i = vm._watchers.length;
  51431. while (i--) {
  51432. vm._watchers[i].teardown();
  51433. }
  51434. // remove reference from data ob
  51435. // frozen object may not have observer.
  51436. if (vm._data.__ob__) {
  51437. vm._data.__ob__.vmCount--;
  51438. }
  51439. // call the last hook...
  51440. vm._isDestroyed = true;
  51441. // invoke destroy hooks on current rendered tree
  51442. vm.__patch__(vm._vnode, null);
  51443. // fire destroyed hook
  51444. callHook(vm, 'destroyed');
  51445. // turn off all instance listeners.
  51446. vm.$off();
  51447. // remove __vue__ reference
  51448. if (vm.$el) {
  51449. vm.$el.__vue__ = null;
  51450. }
  51451. // release circular reference (#6759)
  51452. if (vm.$vnode) {
  51453. vm.$vnode.parent = null;
  51454. }
  51455. };
  51456. }
  51457. function mountComponent (
  51458. vm,
  51459. el,
  51460. hydrating
  51461. ) {
  51462. vm.$el = el;
  51463. if (!vm.$options.render) {
  51464. vm.$options.render = createEmptyVNode;
  51465. {
  51466. /* istanbul ignore if */
  51467. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  51468. vm.$options.el || el) {
  51469. warn(
  51470. 'You are using the runtime-only build of Vue where the template ' +
  51471. 'compiler is not available. Either pre-compile the templates into ' +
  51472. 'render functions, or use the compiler-included build.',
  51473. vm
  51474. );
  51475. } else {
  51476. warn(
  51477. 'Failed to mount component: template or render function not defined.',
  51478. vm
  51479. );
  51480. }
  51481. }
  51482. }
  51483. callHook(vm, 'beforeMount');
  51484. var updateComponent;
  51485. /* istanbul ignore if */
  51486. if (config.performance && mark) {
  51487. updateComponent = function () {
  51488. var name = vm._name;
  51489. var id = vm._uid;
  51490. var startTag = "vue-perf-start:" + id;
  51491. var endTag = "vue-perf-end:" + id;
  51492. mark(startTag);
  51493. var vnode = vm._render();
  51494. mark(endTag);
  51495. measure(("vue " + name + " render"), startTag, endTag);
  51496. mark(startTag);
  51497. vm._update(vnode, hydrating);
  51498. mark(endTag);
  51499. measure(("vue " + name + " patch"), startTag, endTag);
  51500. };
  51501. } else {
  51502. updateComponent = function () {
  51503. vm._update(vm._render(), hydrating);
  51504. };
  51505. }
  51506. // we set this to vm._watcher inside the watcher's constructor
  51507. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  51508. // component's mounted hook), which relies on vm._watcher being already defined
  51509. new Watcher(vm, updateComponent, noop, {
  51510. before: function before () {
  51511. if (vm._isMounted && !vm._isDestroyed) {
  51512. callHook(vm, 'beforeUpdate');
  51513. }
  51514. }
  51515. }, true /* isRenderWatcher */);
  51516. hydrating = false;
  51517. // manually mounted instance, call mounted on self
  51518. // mounted is called for render-created child components in its inserted hook
  51519. if (vm.$vnode == null) {
  51520. vm._isMounted = true;
  51521. callHook(vm, 'mounted');
  51522. }
  51523. return vm
  51524. }
  51525. function updateChildComponent (
  51526. vm,
  51527. propsData,
  51528. listeners,
  51529. parentVnode,
  51530. renderChildren
  51531. ) {
  51532. {
  51533. isUpdatingChildComponent = true;
  51534. }
  51535. // determine whether component has slot children
  51536. // we need to do this before overwriting $options._renderChildren.
  51537. // check if there are dynamic scopedSlots (hand-written or compiled but with
  51538. // dynamic slot names). Static scoped slots compiled from template has the
  51539. // "$stable" marker.
  51540. var newScopedSlots = parentVnode.data.scopedSlots;
  51541. var oldScopedSlots = vm.$scopedSlots;
  51542. var hasDynamicScopedSlot = !!(
  51543. (newScopedSlots && !newScopedSlots.$stable) ||
  51544. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  51545. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  51546. );
  51547. // Any static slot children from the parent may have changed during parent's
  51548. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  51549. // update is necessary to ensure correctness.
  51550. var needsForceUpdate = !!(
  51551. renderChildren || // has new static slots
  51552. vm.$options._renderChildren || // has old static slots
  51553. hasDynamicScopedSlot
  51554. );
  51555. vm.$options._parentVnode = parentVnode;
  51556. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  51557. if (vm._vnode) { // update child tree's parent
  51558. vm._vnode.parent = parentVnode;
  51559. }
  51560. vm.$options._renderChildren = renderChildren;
  51561. // update $attrs and $listeners hash
  51562. // these are also reactive so they may trigger child update if the child
  51563. // used them during render
  51564. vm.$attrs = parentVnode.data.attrs || emptyObject;
  51565. vm.$listeners = listeners || emptyObject;
  51566. // update props
  51567. if (propsData && vm.$options.props) {
  51568. toggleObserving(false);
  51569. var props = vm._props;
  51570. var propKeys = vm.$options._propKeys || [];
  51571. for (var i = 0; i < propKeys.length; i++) {
  51572. var key = propKeys[i];
  51573. var propOptions = vm.$options.props; // wtf flow?
  51574. props[key] = validateProp(key, propOptions, propsData, vm);
  51575. }
  51576. toggleObserving(true);
  51577. // keep a copy of raw propsData
  51578. vm.$options.propsData = propsData;
  51579. }
  51580. // update listeners
  51581. listeners = listeners || emptyObject;
  51582. var oldListeners = vm.$options._parentListeners;
  51583. vm.$options._parentListeners = listeners;
  51584. updateComponentListeners(vm, listeners, oldListeners);
  51585. // resolve slots + force update if has children
  51586. if (needsForceUpdate) {
  51587. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  51588. vm.$forceUpdate();
  51589. }
  51590. {
  51591. isUpdatingChildComponent = false;
  51592. }
  51593. }
  51594. function isInInactiveTree (vm) {
  51595. while (vm && (vm = vm.$parent)) {
  51596. if (vm._inactive) { return true }
  51597. }
  51598. return false
  51599. }
  51600. function activateChildComponent (vm, direct) {
  51601. if (direct) {
  51602. vm._directInactive = false;
  51603. if (isInInactiveTree(vm)) {
  51604. return
  51605. }
  51606. } else if (vm._directInactive) {
  51607. return
  51608. }
  51609. if (vm._inactive || vm._inactive === null) {
  51610. vm._inactive = false;
  51611. for (var i = 0; i < vm.$children.length; i++) {
  51612. activateChildComponent(vm.$children[i]);
  51613. }
  51614. callHook(vm, 'activated');
  51615. }
  51616. }
  51617. function deactivateChildComponent (vm, direct) {
  51618. if (direct) {
  51619. vm._directInactive = true;
  51620. if (isInInactiveTree(vm)) {
  51621. return
  51622. }
  51623. }
  51624. if (!vm._inactive) {
  51625. vm._inactive = true;
  51626. for (var i = 0; i < vm.$children.length; i++) {
  51627. deactivateChildComponent(vm.$children[i]);
  51628. }
  51629. callHook(vm, 'deactivated');
  51630. }
  51631. }
  51632. function callHook (vm, hook) {
  51633. // #7573 disable dep collection when invoking lifecycle hooks
  51634. pushTarget();
  51635. var handlers = vm.$options[hook];
  51636. var info = hook + " hook";
  51637. if (handlers) {
  51638. for (var i = 0, j = handlers.length; i < j; i++) {
  51639. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  51640. }
  51641. }
  51642. if (vm._hasHookEvent) {
  51643. vm.$emit('hook:' + hook);
  51644. }
  51645. popTarget();
  51646. }
  51647. /* */
  51648. var MAX_UPDATE_COUNT = 100;
  51649. var queue = [];
  51650. var activatedChildren = [];
  51651. var has = {};
  51652. var circular = {};
  51653. var waiting = false;
  51654. var flushing = false;
  51655. var index = 0;
  51656. /**
  51657. * Reset the scheduler's state.
  51658. */
  51659. function resetSchedulerState () {
  51660. index = queue.length = activatedChildren.length = 0;
  51661. has = {};
  51662. {
  51663. circular = {};
  51664. }
  51665. waiting = flushing = false;
  51666. }
  51667. // Async edge case #6566 requires saving the timestamp when event listeners are
  51668. // attached. However, calling performance.now() has a perf overhead especially
  51669. // if the page has thousands of event listeners. Instead, we take a timestamp
  51670. // every time the scheduler flushes and use that for all event listeners
  51671. // attached during that flush.
  51672. var currentFlushTimestamp = 0;
  51673. // Async edge case fix requires storing an event listener's attach timestamp.
  51674. var getNow = Date.now;
  51675. // Determine what event timestamp the browser is using. Annoyingly, the
  51676. // timestamp can either be hi-res (relative to page load) or low-res
  51677. // (relative to UNIX epoch), so in order to compare time we have to use the
  51678. // same timestamp type when saving the flush timestamp.
  51679. // All IE versions use low-res event timestamps, and have problematic clock
  51680. // implementations (#9632)
  51681. if (inBrowser && !isIE) {
  51682. var performance = window.performance;
  51683. if (
  51684. performance &&
  51685. typeof performance.now === 'function' &&
  51686. getNow() > document.createEvent('Event').timeStamp
  51687. ) {
  51688. // if the event timestamp, although evaluated AFTER the Date.now(), is
  51689. // smaller than it, it means the event is using a hi-res timestamp,
  51690. // and we need to use the hi-res version for event listener timestamps as
  51691. // well.
  51692. getNow = function () { return performance.now(); };
  51693. }
  51694. }
  51695. /**
  51696. * Flush both queues and run the watchers.
  51697. */
  51698. function flushSchedulerQueue () {
  51699. currentFlushTimestamp = getNow();
  51700. flushing = true;
  51701. var watcher, id;
  51702. // Sort queue before flush.
  51703. // This ensures that:
  51704. // 1. Components are updated from parent to child. (because parent is always
  51705. // created before the child)
  51706. // 2. A component's user watchers are run before its render watcher (because
  51707. // user watchers are created before the render watcher)
  51708. // 3. If a component is destroyed during a parent component's watcher run,
  51709. // its watchers can be skipped.
  51710. queue.sort(function (a, b) { return a.id - b.id; });
  51711. // do not cache length because more watchers might be pushed
  51712. // as we run existing watchers
  51713. for (index = 0; index < queue.length; index++) {
  51714. watcher = queue[index];
  51715. if (watcher.before) {
  51716. watcher.before();
  51717. }
  51718. id = watcher.id;
  51719. has[id] = null;
  51720. watcher.run();
  51721. // in dev build, check and stop circular updates.
  51722. if (has[id] != null) {
  51723. circular[id] = (circular[id] || 0) + 1;
  51724. if (circular[id] > MAX_UPDATE_COUNT) {
  51725. warn(
  51726. 'You may have an infinite update loop ' + (
  51727. watcher.user
  51728. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  51729. : "in a component render function."
  51730. ),
  51731. watcher.vm
  51732. );
  51733. break
  51734. }
  51735. }
  51736. }
  51737. // keep copies of post queues before resetting state
  51738. var activatedQueue = activatedChildren.slice();
  51739. var updatedQueue = queue.slice();
  51740. resetSchedulerState();
  51741. // call component updated and activated hooks
  51742. callActivatedHooks(activatedQueue);
  51743. callUpdatedHooks(updatedQueue);
  51744. // devtool hook
  51745. /* istanbul ignore if */
  51746. if (devtools && config.devtools) {
  51747. devtools.emit('flush');
  51748. }
  51749. }
  51750. function callUpdatedHooks (queue) {
  51751. var i = queue.length;
  51752. while (i--) {
  51753. var watcher = queue[i];
  51754. var vm = watcher.vm;
  51755. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  51756. callHook(vm, 'updated');
  51757. }
  51758. }
  51759. }
  51760. /**
  51761. * Queue a kept-alive component that was activated during patch.
  51762. * The queue will be processed after the entire tree has been patched.
  51763. */
  51764. function queueActivatedComponent (vm) {
  51765. // setting _inactive to false here so that a render function can
  51766. // rely on checking whether it's in an inactive tree (e.g. router-view)
  51767. vm._inactive = false;
  51768. activatedChildren.push(vm);
  51769. }
  51770. function callActivatedHooks (queue) {
  51771. for (var i = 0; i < queue.length; i++) {
  51772. queue[i]._inactive = true;
  51773. activateChildComponent(queue[i], true /* true */);
  51774. }
  51775. }
  51776. /**
  51777. * Push a watcher into the watcher queue.
  51778. * Jobs with duplicate IDs will be skipped unless it's
  51779. * pushed when the queue is being flushed.
  51780. */
  51781. function queueWatcher (watcher) {
  51782. var id = watcher.id;
  51783. if (has[id] == null) {
  51784. has[id] = true;
  51785. if (!flushing) {
  51786. queue.push(watcher);
  51787. } else {
  51788. // if already flushing, splice the watcher based on its id
  51789. // if already past its id, it will be run next immediately.
  51790. var i = queue.length - 1;
  51791. while (i > index && queue[i].id > watcher.id) {
  51792. i--;
  51793. }
  51794. queue.splice(i + 1, 0, watcher);
  51795. }
  51796. // queue the flush
  51797. if (!waiting) {
  51798. waiting = true;
  51799. if (!config.async) {
  51800. flushSchedulerQueue();
  51801. return
  51802. }
  51803. nextTick(flushSchedulerQueue);
  51804. }
  51805. }
  51806. }
  51807. /* */
  51808. var uid$2 = 0;
  51809. /**
  51810. * A watcher parses an expression, collects dependencies,
  51811. * and fires callback when the expression value changes.
  51812. * This is used for both the $watch() api and directives.
  51813. */
  51814. var Watcher = function Watcher (
  51815. vm,
  51816. expOrFn,
  51817. cb,
  51818. options,
  51819. isRenderWatcher
  51820. ) {
  51821. this.vm = vm;
  51822. if (isRenderWatcher) {
  51823. vm._watcher = this;
  51824. }
  51825. vm._watchers.push(this);
  51826. // options
  51827. if (options) {
  51828. this.deep = !!options.deep;
  51829. this.user = !!options.user;
  51830. this.lazy = !!options.lazy;
  51831. this.sync = !!options.sync;
  51832. this.before = options.before;
  51833. } else {
  51834. this.deep = this.user = this.lazy = this.sync = false;
  51835. }
  51836. this.cb = cb;
  51837. this.id = ++uid$2; // uid for batching
  51838. this.active = true;
  51839. this.dirty = this.lazy; // for lazy watchers
  51840. this.deps = [];
  51841. this.newDeps = [];
  51842. this.depIds = new _Set();
  51843. this.newDepIds = new _Set();
  51844. this.expression = expOrFn.toString();
  51845. // parse expression for getter
  51846. if (typeof expOrFn === 'function') {
  51847. this.getter = expOrFn;
  51848. } else {
  51849. this.getter = parsePath(expOrFn);
  51850. if (!this.getter) {
  51851. this.getter = noop;
  51852. warn(
  51853. "Failed watching path: \"" + expOrFn + "\" " +
  51854. 'Watcher only accepts simple dot-delimited paths. ' +
  51855. 'For full control, use a function instead.',
  51856. vm
  51857. );
  51858. }
  51859. }
  51860. this.value = this.lazy
  51861. ? undefined
  51862. : this.get();
  51863. };
  51864. /**
  51865. * Evaluate the getter, and re-collect dependencies.
  51866. */
  51867. Watcher.prototype.get = function get () {
  51868. pushTarget(this);
  51869. var value;
  51870. var vm = this.vm;
  51871. try {
  51872. value = this.getter.call(vm, vm);
  51873. } catch (e) {
  51874. if (this.user) {
  51875. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  51876. } else {
  51877. throw e
  51878. }
  51879. } finally {
  51880. // "touch" every property so they are all tracked as
  51881. // dependencies for deep watching
  51882. if (this.deep) {
  51883. traverse(value);
  51884. }
  51885. popTarget();
  51886. this.cleanupDeps();
  51887. }
  51888. return value
  51889. };
  51890. /**
  51891. * Add a dependency to this directive.
  51892. */
  51893. Watcher.prototype.addDep = function addDep (dep) {
  51894. var id = dep.id;
  51895. if (!this.newDepIds.has(id)) {
  51896. this.newDepIds.add(id);
  51897. this.newDeps.push(dep);
  51898. if (!this.depIds.has(id)) {
  51899. dep.addSub(this);
  51900. }
  51901. }
  51902. };
  51903. /**
  51904. * Clean up for dependency collection.
  51905. */
  51906. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  51907. var i = this.deps.length;
  51908. while (i--) {
  51909. var dep = this.deps[i];
  51910. if (!this.newDepIds.has(dep.id)) {
  51911. dep.removeSub(this);
  51912. }
  51913. }
  51914. var tmp = this.depIds;
  51915. this.depIds = this.newDepIds;
  51916. this.newDepIds = tmp;
  51917. this.newDepIds.clear();
  51918. tmp = this.deps;
  51919. this.deps = this.newDeps;
  51920. this.newDeps = tmp;
  51921. this.newDeps.length = 0;
  51922. };
  51923. /**
  51924. * Subscriber interface.
  51925. * Will be called when a dependency changes.
  51926. */
  51927. Watcher.prototype.update = function update () {
  51928. /* istanbul ignore else */
  51929. if (this.lazy) {
  51930. this.dirty = true;
  51931. } else if (this.sync) {
  51932. this.run();
  51933. } else {
  51934. queueWatcher(this);
  51935. }
  51936. };
  51937. /**
  51938. * Scheduler job interface.
  51939. * Will be called by the scheduler.
  51940. */
  51941. Watcher.prototype.run = function run () {
  51942. if (this.active) {
  51943. var value = this.get();
  51944. if (
  51945. value !== this.value ||
  51946. // Deep watchers and watchers on Object/Arrays should fire even
  51947. // when the value is the same, because the value may
  51948. // have mutated.
  51949. isObject(value) ||
  51950. this.deep
  51951. ) {
  51952. // set new value
  51953. var oldValue = this.value;
  51954. this.value = value;
  51955. if (this.user) {
  51956. try {
  51957. this.cb.call(this.vm, value, oldValue);
  51958. } catch (e) {
  51959. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  51960. }
  51961. } else {
  51962. this.cb.call(this.vm, value, oldValue);
  51963. }
  51964. }
  51965. }
  51966. };
  51967. /**
  51968. * Evaluate the value of the watcher.
  51969. * This only gets called for lazy watchers.
  51970. */
  51971. Watcher.prototype.evaluate = function evaluate () {
  51972. this.value = this.get();
  51973. this.dirty = false;
  51974. };
  51975. /**
  51976. * Depend on all deps collected by this watcher.
  51977. */
  51978. Watcher.prototype.depend = function depend () {
  51979. var i = this.deps.length;
  51980. while (i--) {
  51981. this.deps[i].depend();
  51982. }
  51983. };
  51984. /**
  51985. * Remove self from all dependencies' subscriber list.
  51986. */
  51987. Watcher.prototype.teardown = function teardown () {
  51988. if (this.active) {
  51989. // remove self from vm's watcher list
  51990. // this is a somewhat expensive operation so we skip it
  51991. // if the vm is being destroyed.
  51992. if (!this.vm._isBeingDestroyed) {
  51993. remove(this.vm._watchers, this);
  51994. }
  51995. var i = this.deps.length;
  51996. while (i--) {
  51997. this.deps[i].removeSub(this);
  51998. }
  51999. this.active = false;
  52000. }
  52001. };
  52002. /* */
  52003. var sharedPropertyDefinition = {
  52004. enumerable: true,
  52005. configurable: true,
  52006. get: noop,
  52007. set: noop
  52008. };
  52009. function proxy (target, sourceKey, key) {
  52010. sharedPropertyDefinition.get = function proxyGetter () {
  52011. return this[sourceKey][key]
  52012. };
  52013. sharedPropertyDefinition.set = function proxySetter (val) {
  52014. this[sourceKey][key] = val;
  52015. };
  52016. Object.defineProperty(target, key, sharedPropertyDefinition);
  52017. }
  52018. function initState (vm) {
  52019. vm._watchers = [];
  52020. var opts = vm.$options;
  52021. if (opts.props) { initProps(vm, opts.props); }
  52022. if (opts.methods) { initMethods(vm, opts.methods); }
  52023. if (opts.data) {
  52024. initData(vm);
  52025. } else {
  52026. observe(vm._data = {}, true /* asRootData */);
  52027. }
  52028. if (opts.computed) { initComputed(vm, opts.computed); }
  52029. if (opts.watch && opts.watch !== nativeWatch) {
  52030. initWatch(vm, opts.watch);
  52031. }
  52032. }
  52033. function initProps (vm, propsOptions) {
  52034. var propsData = vm.$options.propsData || {};
  52035. var props = vm._props = {};
  52036. // cache prop keys so that future props updates can iterate using Array
  52037. // instead of dynamic object key enumeration.
  52038. var keys = vm.$options._propKeys = [];
  52039. var isRoot = !vm.$parent;
  52040. // root instance props should be converted
  52041. if (!isRoot) {
  52042. toggleObserving(false);
  52043. }
  52044. var loop = function ( key ) {
  52045. keys.push(key);
  52046. var value = validateProp(key, propsOptions, propsData, vm);
  52047. /* istanbul ignore else */
  52048. {
  52049. var hyphenatedKey = hyphenate(key);
  52050. if (isReservedAttribute(hyphenatedKey) ||
  52051. config.isReservedAttr(hyphenatedKey)) {
  52052. warn(
  52053. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  52054. vm
  52055. );
  52056. }
  52057. defineReactive$$1(props, key, value, function () {
  52058. if (!isRoot && !isUpdatingChildComponent) {
  52059. warn(
  52060. "Avoid mutating a prop directly since the value will be " +
  52061. "overwritten whenever the parent component re-renders. " +
  52062. "Instead, use a data or computed property based on the prop's " +
  52063. "value. Prop being mutated: \"" + key + "\"",
  52064. vm
  52065. );
  52066. }
  52067. });
  52068. }
  52069. // static props are already proxied on the component's prototype
  52070. // during Vue.extend(). We only need to proxy props defined at
  52071. // instantiation here.
  52072. if (!(key in vm)) {
  52073. proxy(vm, "_props", key);
  52074. }
  52075. };
  52076. for (var key in propsOptions) loop( key );
  52077. toggleObserving(true);
  52078. }
  52079. function initData (vm) {
  52080. var data = vm.$options.data;
  52081. data = vm._data = typeof data === 'function'
  52082. ? getData(data, vm)
  52083. : data || {};
  52084. if (!isPlainObject(data)) {
  52085. data = {};
  52086. warn(
  52087. 'data functions should return an object:\n' +
  52088. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  52089. vm
  52090. );
  52091. }
  52092. // proxy data on instance
  52093. var keys = Object.keys(data);
  52094. var props = vm.$options.props;
  52095. var methods = vm.$options.methods;
  52096. var i = keys.length;
  52097. while (i--) {
  52098. var key = keys[i];
  52099. {
  52100. if (methods && hasOwn(methods, key)) {
  52101. warn(
  52102. ("Method \"" + key + "\" has already been defined as a data property."),
  52103. vm
  52104. );
  52105. }
  52106. }
  52107. if (props && hasOwn(props, key)) {
  52108. warn(
  52109. "The data property \"" + key + "\" is already declared as a prop. " +
  52110. "Use prop default value instead.",
  52111. vm
  52112. );
  52113. } else if (!isReserved(key)) {
  52114. proxy(vm, "_data", key);
  52115. }
  52116. }
  52117. // observe data
  52118. observe(data, true /* asRootData */);
  52119. }
  52120. function getData (data, vm) {
  52121. // #7573 disable dep collection when invoking data getters
  52122. pushTarget();
  52123. try {
  52124. return data.call(vm, vm)
  52125. } catch (e) {
  52126. handleError(e, vm, "data()");
  52127. return {}
  52128. } finally {
  52129. popTarget();
  52130. }
  52131. }
  52132. var computedWatcherOptions = { lazy: true };
  52133. function initComputed (vm, computed) {
  52134. // $flow-disable-line
  52135. var watchers = vm._computedWatchers = Object.create(null);
  52136. // computed properties are just getters during SSR
  52137. var isSSR = isServerRendering();
  52138. for (var key in computed) {
  52139. var userDef = computed[key];
  52140. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  52141. if (getter == null) {
  52142. warn(
  52143. ("Getter is missing for computed property \"" + key + "\"."),
  52144. vm
  52145. );
  52146. }
  52147. if (!isSSR) {
  52148. // create internal watcher for the computed property.
  52149. watchers[key] = new Watcher(
  52150. vm,
  52151. getter || noop,
  52152. noop,
  52153. computedWatcherOptions
  52154. );
  52155. }
  52156. // component-defined computed properties are already defined on the
  52157. // component prototype. We only need to define computed properties defined
  52158. // at instantiation here.
  52159. if (!(key in vm)) {
  52160. defineComputed(vm, key, userDef);
  52161. } else {
  52162. if (key in vm.$data) {
  52163. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  52164. } else if (vm.$options.props && key in vm.$options.props) {
  52165. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  52166. }
  52167. }
  52168. }
  52169. }
  52170. function defineComputed (
  52171. target,
  52172. key,
  52173. userDef
  52174. ) {
  52175. var shouldCache = !isServerRendering();
  52176. if (typeof userDef === 'function') {
  52177. sharedPropertyDefinition.get = shouldCache
  52178. ? createComputedGetter(key)
  52179. : createGetterInvoker(userDef);
  52180. sharedPropertyDefinition.set = noop;
  52181. } else {
  52182. sharedPropertyDefinition.get = userDef.get
  52183. ? shouldCache && userDef.cache !== false
  52184. ? createComputedGetter(key)
  52185. : createGetterInvoker(userDef.get)
  52186. : noop;
  52187. sharedPropertyDefinition.set = userDef.set || noop;
  52188. }
  52189. if (sharedPropertyDefinition.set === noop) {
  52190. sharedPropertyDefinition.set = function () {
  52191. warn(
  52192. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  52193. this
  52194. );
  52195. };
  52196. }
  52197. Object.defineProperty(target, key, sharedPropertyDefinition);
  52198. }
  52199. function createComputedGetter (key) {
  52200. return function computedGetter () {
  52201. var watcher = this._computedWatchers && this._computedWatchers[key];
  52202. if (watcher) {
  52203. if (watcher.dirty) {
  52204. watcher.evaluate();
  52205. }
  52206. if (Dep.target) {
  52207. watcher.depend();
  52208. }
  52209. return watcher.value
  52210. }
  52211. }
  52212. }
  52213. function createGetterInvoker(fn) {
  52214. return function computedGetter () {
  52215. return fn.call(this, this)
  52216. }
  52217. }
  52218. function initMethods (vm, methods) {
  52219. var props = vm.$options.props;
  52220. for (var key in methods) {
  52221. {
  52222. if (typeof methods[key] !== 'function') {
  52223. warn(
  52224. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  52225. "Did you reference the function correctly?",
  52226. vm
  52227. );
  52228. }
  52229. if (props && hasOwn(props, key)) {
  52230. warn(
  52231. ("Method \"" + key + "\" has already been defined as a prop."),
  52232. vm
  52233. );
  52234. }
  52235. if ((key in vm) && isReserved(key)) {
  52236. warn(
  52237. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  52238. "Avoid defining component methods that start with _ or $."
  52239. );
  52240. }
  52241. }
  52242. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  52243. }
  52244. }
  52245. function initWatch (vm, watch) {
  52246. for (var key in watch) {
  52247. var handler = watch[key];
  52248. if (Array.isArray(handler)) {
  52249. for (var i = 0; i < handler.length; i++) {
  52250. createWatcher(vm, key, handler[i]);
  52251. }
  52252. } else {
  52253. createWatcher(vm, key, handler);
  52254. }
  52255. }
  52256. }
  52257. function createWatcher (
  52258. vm,
  52259. expOrFn,
  52260. handler,
  52261. options
  52262. ) {
  52263. if (isPlainObject(handler)) {
  52264. options = handler;
  52265. handler = handler.handler;
  52266. }
  52267. if (typeof handler === 'string') {
  52268. handler = vm[handler];
  52269. }
  52270. return vm.$watch(expOrFn, handler, options)
  52271. }
  52272. function stateMixin (Vue) {
  52273. // flow somehow has problems with directly declared definition object
  52274. // when using Object.defineProperty, so we have to procedurally build up
  52275. // the object here.
  52276. var dataDef = {};
  52277. dataDef.get = function () { return this._data };
  52278. var propsDef = {};
  52279. propsDef.get = function () { return this._props };
  52280. {
  52281. dataDef.set = function () {
  52282. warn(
  52283. 'Avoid replacing instance root $data. ' +
  52284. 'Use nested data properties instead.',
  52285. this
  52286. );
  52287. };
  52288. propsDef.set = function () {
  52289. warn("$props is readonly.", this);
  52290. };
  52291. }
  52292. Object.defineProperty(Vue.prototype, '$data', dataDef);
  52293. Object.defineProperty(Vue.prototype, '$props', propsDef);
  52294. Vue.prototype.$set = set;
  52295. Vue.prototype.$delete = del;
  52296. Vue.prototype.$watch = function (
  52297. expOrFn,
  52298. cb,
  52299. options
  52300. ) {
  52301. var vm = this;
  52302. if (isPlainObject(cb)) {
  52303. return createWatcher(vm, expOrFn, cb, options)
  52304. }
  52305. options = options || {};
  52306. options.user = true;
  52307. var watcher = new Watcher(vm, expOrFn, cb, options);
  52308. if (options.immediate) {
  52309. try {
  52310. cb.call(vm, watcher.value);
  52311. } catch (error) {
  52312. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  52313. }
  52314. }
  52315. return function unwatchFn () {
  52316. watcher.teardown();
  52317. }
  52318. };
  52319. }
  52320. /* */
  52321. var uid$3 = 0;
  52322. function initMixin (Vue) {
  52323. Vue.prototype._init = function (options) {
  52324. var vm = this;
  52325. // a uid
  52326. vm._uid = uid$3++;
  52327. var startTag, endTag;
  52328. /* istanbul ignore if */
  52329. if (config.performance && mark) {
  52330. startTag = "vue-perf-start:" + (vm._uid);
  52331. endTag = "vue-perf-end:" + (vm._uid);
  52332. mark(startTag);
  52333. }
  52334. // a flag to avoid this being observed
  52335. vm._isVue = true;
  52336. // merge options
  52337. if (options && options._isComponent) {
  52338. // optimize internal component instantiation
  52339. // since dynamic options merging is pretty slow, and none of the
  52340. // internal component options needs special treatment.
  52341. initInternalComponent(vm, options);
  52342. } else {
  52343. vm.$options = mergeOptions(
  52344. resolveConstructorOptions(vm.constructor),
  52345. options || {},
  52346. vm
  52347. );
  52348. }
  52349. /* istanbul ignore else */
  52350. {
  52351. initProxy(vm);
  52352. }
  52353. // expose real self
  52354. vm._self = vm;
  52355. initLifecycle(vm);
  52356. initEvents(vm);
  52357. initRender(vm);
  52358. callHook(vm, 'beforeCreate');
  52359. initInjections(vm); // resolve injections before data/props
  52360. initState(vm);
  52361. initProvide(vm); // resolve provide after data/props
  52362. callHook(vm, 'created');
  52363. /* istanbul ignore if */
  52364. if (config.performance && mark) {
  52365. vm._name = formatComponentName(vm, false);
  52366. mark(endTag);
  52367. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  52368. }
  52369. if (vm.$options.el) {
  52370. vm.$mount(vm.$options.el);
  52371. }
  52372. };
  52373. }
  52374. function initInternalComponent (vm, options) {
  52375. var opts = vm.$options = Object.create(vm.constructor.options);
  52376. // doing this because it's faster than dynamic enumeration.
  52377. var parentVnode = options._parentVnode;
  52378. opts.parent = options.parent;
  52379. opts._parentVnode = parentVnode;
  52380. var vnodeComponentOptions = parentVnode.componentOptions;
  52381. opts.propsData = vnodeComponentOptions.propsData;
  52382. opts._parentListeners = vnodeComponentOptions.listeners;
  52383. opts._renderChildren = vnodeComponentOptions.children;
  52384. opts._componentTag = vnodeComponentOptions.tag;
  52385. if (options.render) {
  52386. opts.render = options.render;
  52387. opts.staticRenderFns = options.staticRenderFns;
  52388. }
  52389. }
  52390. function resolveConstructorOptions (Ctor) {
  52391. var options = Ctor.options;
  52392. if (Ctor.super) {
  52393. var superOptions = resolveConstructorOptions(Ctor.super);
  52394. var cachedSuperOptions = Ctor.superOptions;
  52395. if (superOptions !== cachedSuperOptions) {
  52396. // super option changed,
  52397. // need to resolve new options.
  52398. Ctor.superOptions = superOptions;
  52399. // check if there are any late-modified/attached options (#4976)
  52400. var modifiedOptions = resolveModifiedOptions(Ctor);
  52401. // update base extend options
  52402. if (modifiedOptions) {
  52403. extend(Ctor.extendOptions, modifiedOptions);
  52404. }
  52405. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  52406. if (options.name) {
  52407. options.components[options.name] = Ctor;
  52408. }
  52409. }
  52410. }
  52411. return options
  52412. }
  52413. function resolveModifiedOptions (Ctor) {
  52414. var modified;
  52415. var latest = Ctor.options;
  52416. var sealed = Ctor.sealedOptions;
  52417. for (var key in latest) {
  52418. if (latest[key] !== sealed[key]) {
  52419. if (!modified) { modified = {}; }
  52420. modified[key] = latest[key];
  52421. }
  52422. }
  52423. return modified
  52424. }
  52425. function Vue (options) {
  52426. if (!(this instanceof Vue)
  52427. ) {
  52428. warn('Vue is a constructor and should be called with the `new` keyword');
  52429. }
  52430. this._init(options);
  52431. }
  52432. initMixin(Vue);
  52433. stateMixin(Vue);
  52434. eventsMixin(Vue);
  52435. lifecycleMixin(Vue);
  52436. renderMixin(Vue);
  52437. /* */
  52438. function initUse (Vue) {
  52439. Vue.use = function (plugin) {
  52440. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  52441. if (installedPlugins.indexOf(plugin) > -1) {
  52442. return this
  52443. }
  52444. // additional parameters
  52445. var args = toArray(arguments, 1);
  52446. args.unshift(this);
  52447. if (typeof plugin.install === 'function') {
  52448. plugin.install.apply(plugin, args);
  52449. } else if (typeof plugin === 'function') {
  52450. plugin.apply(null, args);
  52451. }
  52452. installedPlugins.push(plugin);
  52453. return this
  52454. };
  52455. }
  52456. /* */
  52457. function initMixin$1 (Vue) {
  52458. Vue.mixin = function (mixin) {
  52459. this.options = mergeOptions(this.options, mixin);
  52460. return this
  52461. };
  52462. }
  52463. /* */
  52464. function initExtend (Vue) {
  52465. /**
  52466. * Each instance constructor, including Vue, has a unique
  52467. * cid. This enables us to create wrapped "child
  52468. * constructors" for prototypal inheritance and cache them.
  52469. */
  52470. Vue.cid = 0;
  52471. var cid = 1;
  52472. /**
  52473. * Class inheritance
  52474. */
  52475. Vue.extend = function (extendOptions) {
  52476. extendOptions = extendOptions || {};
  52477. var Super = this;
  52478. var SuperId = Super.cid;
  52479. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  52480. if (cachedCtors[SuperId]) {
  52481. return cachedCtors[SuperId]
  52482. }
  52483. var name = extendOptions.name || Super.options.name;
  52484. if (name) {
  52485. validateComponentName(name);
  52486. }
  52487. var Sub = function VueComponent (options) {
  52488. this._init(options);
  52489. };
  52490. Sub.prototype = Object.create(Super.prototype);
  52491. Sub.prototype.constructor = Sub;
  52492. Sub.cid = cid++;
  52493. Sub.options = mergeOptions(
  52494. Super.options,
  52495. extendOptions
  52496. );
  52497. Sub['super'] = Super;
  52498. // For props and computed properties, we define the proxy getters on
  52499. // the Vue instances at extension time, on the extended prototype. This
  52500. // avoids Object.defineProperty calls for each instance created.
  52501. if (Sub.options.props) {
  52502. initProps$1(Sub);
  52503. }
  52504. if (Sub.options.computed) {
  52505. initComputed$1(Sub);
  52506. }
  52507. // allow further extension/mixin/plugin usage
  52508. Sub.extend = Super.extend;
  52509. Sub.mixin = Super.mixin;
  52510. Sub.use = Super.use;
  52511. // create asset registers, so extended classes
  52512. // can have their private assets too.
  52513. ASSET_TYPES.forEach(function (type) {
  52514. Sub[type] = Super[type];
  52515. });
  52516. // enable recursive self-lookup
  52517. if (name) {
  52518. Sub.options.components[name] = Sub;
  52519. }
  52520. // keep a reference to the super options at extension time.
  52521. // later at instantiation we can check if Super's options have
  52522. // been updated.
  52523. Sub.superOptions = Super.options;
  52524. Sub.extendOptions = extendOptions;
  52525. Sub.sealedOptions = extend({}, Sub.options);
  52526. // cache constructor
  52527. cachedCtors[SuperId] = Sub;
  52528. return Sub
  52529. };
  52530. }
  52531. function initProps$1 (Comp) {
  52532. var props = Comp.options.props;
  52533. for (var key in props) {
  52534. proxy(Comp.prototype, "_props", key);
  52535. }
  52536. }
  52537. function initComputed$1 (Comp) {
  52538. var computed = Comp.options.computed;
  52539. for (var key in computed) {
  52540. defineComputed(Comp.prototype, key, computed[key]);
  52541. }
  52542. }
  52543. /* */
  52544. function initAssetRegisters (Vue) {
  52545. /**
  52546. * Create asset registration methods.
  52547. */
  52548. ASSET_TYPES.forEach(function (type) {
  52549. Vue[type] = function (
  52550. id,
  52551. definition
  52552. ) {
  52553. if (!definition) {
  52554. return this.options[type + 's'][id]
  52555. } else {
  52556. /* istanbul ignore if */
  52557. if (type === 'component') {
  52558. validateComponentName(id);
  52559. }
  52560. if (type === 'component' && isPlainObject(definition)) {
  52561. definition.name = definition.name || id;
  52562. definition = this.options._base.extend(definition);
  52563. }
  52564. if (type === 'directive' && typeof definition === 'function') {
  52565. definition = { bind: definition, update: definition };
  52566. }
  52567. this.options[type + 's'][id] = definition;
  52568. return definition
  52569. }
  52570. };
  52571. });
  52572. }
  52573. /* */
  52574. function getComponentName (opts) {
  52575. return opts && (opts.Ctor.options.name || opts.tag)
  52576. }
  52577. function matches (pattern, name) {
  52578. if (Array.isArray(pattern)) {
  52579. return pattern.indexOf(name) > -1
  52580. } else if (typeof pattern === 'string') {
  52581. return pattern.split(',').indexOf(name) > -1
  52582. } else if (isRegExp(pattern)) {
  52583. return pattern.test(name)
  52584. }
  52585. /* istanbul ignore next */
  52586. return false
  52587. }
  52588. function pruneCache (keepAliveInstance, filter) {
  52589. var cache = keepAliveInstance.cache;
  52590. var keys = keepAliveInstance.keys;
  52591. var _vnode = keepAliveInstance._vnode;
  52592. for (var key in cache) {
  52593. var cachedNode = cache[key];
  52594. if (cachedNode) {
  52595. var name = getComponentName(cachedNode.componentOptions);
  52596. if (name && !filter(name)) {
  52597. pruneCacheEntry(cache, key, keys, _vnode);
  52598. }
  52599. }
  52600. }
  52601. }
  52602. function pruneCacheEntry (
  52603. cache,
  52604. key,
  52605. keys,
  52606. current
  52607. ) {
  52608. var cached$$1 = cache[key];
  52609. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  52610. cached$$1.componentInstance.$destroy();
  52611. }
  52612. cache[key] = null;
  52613. remove(keys, key);
  52614. }
  52615. var patternTypes = [String, RegExp, Array];
  52616. var KeepAlive = {
  52617. name: 'keep-alive',
  52618. abstract: true,
  52619. props: {
  52620. include: patternTypes,
  52621. exclude: patternTypes,
  52622. max: [String, Number]
  52623. },
  52624. created: function created () {
  52625. this.cache = Object.create(null);
  52626. this.keys = [];
  52627. },
  52628. destroyed: function destroyed () {
  52629. for (var key in this.cache) {
  52630. pruneCacheEntry(this.cache, key, this.keys);
  52631. }
  52632. },
  52633. mounted: function mounted () {
  52634. var this$1 = this;
  52635. this.$watch('include', function (val) {
  52636. pruneCache(this$1, function (name) { return matches(val, name); });
  52637. });
  52638. this.$watch('exclude', function (val) {
  52639. pruneCache(this$1, function (name) { return !matches(val, name); });
  52640. });
  52641. },
  52642. render: function render () {
  52643. var slot = this.$slots.default;
  52644. var vnode = getFirstComponentChild(slot);
  52645. var componentOptions = vnode && vnode.componentOptions;
  52646. if (componentOptions) {
  52647. // check pattern
  52648. var name = getComponentName(componentOptions);
  52649. var ref = this;
  52650. var include = ref.include;
  52651. var exclude = ref.exclude;
  52652. if (
  52653. // not included
  52654. (include && (!name || !matches(include, name))) ||
  52655. // excluded
  52656. (exclude && name && matches(exclude, name))
  52657. ) {
  52658. return vnode
  52659. }
  52660. var ref$1 = this;
  52661. var cache = ref$1.cache;
  52662. var keys = ref$1.keys;
  52663. var key = vnode.key == null
  52664. // same constructor may get registered as different local components
  52665. // so cid alone is not enough (#3269)
  52666. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  52667. : vnode.key;
  52668. if (cache[key]) {
  52669. vnode.componentInstance = cache[key].componentInstance;
  52670. // make current key freshest
  52671. remove(keys, key);
  52672. keys.push(key);
  52673. } else {
  52674. cache[key] = vnode;
  52675. keys.push(key);
  52676. // prune oldest entry
  52677. if (this.max && keys.length > parseInt(this.max)) {
  52678. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  52679. }
  52680. }
  52681. vnode.data.keepAlive = true;
  52682. }
  52683. return vnode || (slot && slot[0])
  52684. }
  52685. };
  52686. var builtInComponents = {
  52687. KeepAlive: KeepAlive
  52688. };
  52689. /* */
  52690. function initGlobalAPI (Vue) {
  52691. // config
  52692. var configDef = {};
  52693. configDef.get = function () { return config; };
  52694. {
  52695. configDef.set = function () {
  52696. warn(
  52697. 'Do not replace the Vue.config object, set individual fields instead.'
  52698. );
  52699. };
  52700. }
  52701. Object.defineProperty(Vue, 'config', configDef);
  52702. // exposed util methods.
  52703. // NOTE: these are not considered part of the public API - avoid relying on
  52704. // them unless you are aware of the risk.
  52705. Vue.util = {
  52706. warn: warn,
  52707. extend: extend,
  52708. mergeOptions: mergeOptions,
  52709. defineReactive: defineReactive$$1
  52710. };
  52711. Vue.set = set;
  52712. Vue.delete = del;
  52713. Vue.nextTick = nextTick;
  52714. // 2.6 explicit observable API
  52715. Vue.observable = function (obj) {
  52716. observe(obj);
  52717. return obj
  52718. };
  52719. Vue.options = Object.create(null);
  52720. ASSET_TYPES.forEach(function (type) {
  52721. Vue.options[type + 's'] = Object.create(null);
  52722. });
  52723. // this is used to identify the "base" constructor to extend all plain-object
  52724. // components with in Weex's multi-instance scenarios.
  52725. Vue.options._base = Vue;
  52726. extend(Vue.options.components, builtInComponents);
  52727. initUse(Vue);
  52728. initMixin$1(Vue);
  52729. initExtend(Vue);
  52730. initAssetRegisters(Vue);
  52731. }
  52732. initGlobalAPI(Vue);
  52733. Object.defineProperty(Vue.prototype, '$isServer', {
  52734. get: isServerRendering
  52735. });
  52736. Object.defineProperty(Vue.prototype, '$ssrContext', {
  52737. get: function get () {
  52738. /* istanbul ignore next */
  52739. return this.$vnode && this.$vnode.ssrContext
  52740. }
  52741. });
  52742. // expose FunctionalRenderContext for ssr runtime helper installation
  52743. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  52744. value: FunctionalRenderContext
  52745. });
  52746. Vue.version = '2.6.11';
  52747. /* */
  52748. // these are reserved for web because they are directly compiled away
  52749. // during template compilation
  52750. var isReservedAttr = makeMap('style,class');
  52751. // attributes that should be using props for binding
  52752. var acceptValue = makeMap('input,textarea,option,select,progress');
  52753. var mustUseProp = function (tag, type, attr) {
  52754. return (
  52755. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  52756. (attr === 'selected' && tag === 'option') ||
  52757. (attr === 'checked' && tag === 'input') ||
  52758. (attr === 'muted' && tag === 'video')
  52759. )
  52760. };
  52761. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  52762. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  52763. var convertEnumeratedValue = function (key, value) {
  52764. return isFalsyAttrValue(value) || value === 'false'
  52765. ? 'false'
  52766. // allow arbitrary string value for contenteditable
  52767. : key === 'contenteditable' && isValidContentEditableValue(value)
  52768. ? value
  52769. : 'true'
  52770. };
  52771. var isBooleanAttr = makeMap(
  52772. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  52773. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  52774. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  52775. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  52776. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  52777. 'truespeed,typemustmatch,visible'
  52778. );
  52779. var xlinkNS = 'http://www.w3.org/1999/xlink';
  52780. var isXlink = function (name) {
  52781. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  52782. };
  52783. var getXlinkProp = function (name) {
  52784. return isXlink(name) ? name.slice(6, name.length) : ''
  52785. };
  52786. var isFalsyAttrValue = function (val) {
  52787. return val == null || val === false
  52788. };
  52789. /* */
  52790. function genClassForVnode (vnode) {
  52791. var data = vnode.data;
  52792. var parentNode = vnode;
  52793. var childNode = vnode;
  52794. while (isDef(childNode.componentInstance)) {
  52795. childNode = childNode.componentInstance._vnode;
  52796. if (childNode && childNode.data) {
  52797. data = mergeClassData(childNode.data, data);
  52798. }
  52799. }
  52800. while (isDef(parentNode = parentNode.parent)) {
  52801. if (parentNode && parentNode.data) {
  52802. data = mergeClassData(data, parentNode.data);
  52803. }
  52804. }
  52805. return renderClass(data.staticClass, data.class)
  52806. }
  52807. function mergeClassData (child, parent) {
  52808. return {
  52809. staticClass: concat(child.staticClass, parent.staticClass),
  52810. class: isDef(child.class)
  52811. ? [child.class, parent.class]
  52812. : parent.class
  52813. }
  52814. }
  52815. function renderClass (
  52816. staticClass,
  52817. dynamicClass
  52818. ) {
  52819. if (isDef(staticClass) || isDef(dynamicClass)) {
  52820. return concat(staticClass, stringifyClass(dynamicClass))
  52821. }
  52822. /* istanbul ignore next */
  52823. return ''
  52824. }
  52825. function concat (a, b) {
  52826. return a ? b ? (a + ' ' + b) : a : (b || '')
  52827. }
  52828. function stringifyClass (value) {
  52829. if (Array.isArray(value)) {
  52830. return stringifyArray(value)
  52831. }
  52832. if (isObject(value)) {
  52833. return stringifyObject(value)
  52834. }
  52835. if (typeof value === 'string') {
  52836. return value
  52837. }
  52838. /* istanbul ignore next */
  52839. return ''
  52840. }
  52841. function stringifyArray (value) {
  52842. var res = '';
  52843. var stringified;
  52844. for (var i = 0, l = value.length; i < l; i++) {
  52845. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  52846. if (res) { res += ' '; }
  52847. res += stringified;
  52848. }
  52849. }
  52850. return res
  52851. }
  52852. function stringifyObject (value) {
  52853. var res = '';
  52854. for (var key in value) {
  52855. if (value[key]) {
  52856. if (res) { res += ' '; }
  52857. res += key;
  52858. }
  52859. }
  52860. return res
  52861. }
  52862. /* */
  52863. var namespaceMap = {
  52864. svg: 'http://www.w3.org/2000/svg',
  52865. math: 'http://www.w3.org/1998/Math/MathML'
  52866. };
  52867. var isHTMLTag = makeMap(
  52868. 'html,body,base,head,link,meta,style,title,' +
  52869. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  52870. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  52871. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  52872. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  52873. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  52874. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  52875. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  52876. 'output,progress,select,textarea,' +
  52877. 'details,dialog,menu,menuitem,summary,' +
  52878. 'content,element,shadow,template,blockquote,iframe,tfoot'
  52879. );
  52880. // this map is intentionally selective, only covering SVG elements that may
  52881. // contain child elements.
  52882. var isSVG = makeMap(
  52883. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  52884. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  52885. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  52886. true
  52887. );
  52888. var isPreTag = function (tag) { return tag === 'pre'; };
  52889. var isReservedTag = function (tag) {
  52890. return isHTMLTag(tag) || isSVG(tag)
  52891. };
  52892. function getTagNamespace (tag) {
  52893. if (isSVG(tag)) {
  52894. return 'svg'
  52895. }
  52896. // basic support for MathML
  52897. // note it doesn't support other MathML elements being component roots
  52898. if (tag === 'math') {
  52899. return 'math'
  52900. }
  52901. }
  52902. var unknownElementCache = Object.create(null);
  52903. function isUnknownElement (tag) {
  52904. /* istanbul ignore if */
  52905. if (!inBrowser) {
  52906. return true
  52907. }
  52908. if (isReservedTag(tag)) {
  52909. return false
  52910. }
  52911. tag = tag.toLowerCase();
  52912. /* istanbul ignore if */
  52913. if (unknownElementCache[tag] != null) {
  52914. return unknownElementCache[tag]
  52915. }
  52916. var el = document.createElement(tag);
  52917. if (tag.indexOf('-') > -1) {
  52918. // http://stackoverflow.com/a/28210364/1070244
  52919. return (unknownElementCache[tag] = (
  52920. el.constructor === window.HTMLUnknownElement ||
  52921. el.constructor === window.HTMLElement
  52922. ))
  52923. } else {
  52924. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  52925. }
  52926. }
  52927. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  52928. /* */
  52929. /**
  52930. * Query an element selector if it's not an element already.
  52931. */
  52932. function query (el) {
  52933. if (typeof el === 'string') {
  52934. var selected = document.querySelector(el);
  52935. if (!selected) {
  52936. warn(
  52937. 'Cannot find element: ' + el
  52938. );
  52939. return document.createElement('div')
  52940. }
  52941. return selected
  52942. } else {
  52943. return el
  52944. }
  52945. }
  52946. /* */
  52947. function createElement$1 (tagName, vnode) {
  52948. var elm = document.createElement(tagName);
  52949. if (tagName !== 'select') {
  52950. return elm
  52951. }
  52952. // false or null will remove the attribute but undefined will not
  52953. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  52954. elm.setAttribute('multiple', 'multiple');
  52955. }
  52956. return elm
  52957. }
  52958. function createElementNS (namespace, tagName) {
  52959. return document.createElementNS(namespaceMap[namespace], tagName)
  52960. }
  52961. function createTextNode (text) {
  52962. return document.createTextNode(text)
  52963. }
  52964. function createComment (text) {
  52965. return document.createComment(text)
  52966. }
  52967. function insertBefore (parentNode, newNode, referenceNode) {
  52968. parentNode.insertBefore(newNode, referenceNode);
  52969. }
  52970. function removeChild (node, child) {
  52971. node.removeChild(child);
  52972. }
  52973. function appendChild (node, child) {
  52974. node.appendChild(child);
  52975. }
  52976. function parentNode (node) {
  52977. return node.parentNode
  52978. }
  52979. function nextSibling (node) {
  52980. return node.nextSibling
  52981. }
  52982. function tagName (node) {
  52983. return node.tagName
  52984. }
  52985. function setTextContent (node, text) {
  52986. node.textContent = text;
  52987. }
  52988. function setStyleScope (node, scopeId) {
  52989. node.setAttribute(scopeId, '');
  52990. }
  52991. var nodeOps = /*#__PURE__*/Object.freeze({
  52992. createElement: createElement$1,
  52993. createElementNS: createElementNS,
  52994. createTextNode: createTextNode,
  52995. createComment: createComment,
  52996. insertBefore: insertBefore,
  52997. removeChild: removeChild,
  52998. appendChild: appendChild,
  52999. parentNode: parentNode,
  53000. nextSibling: nextSibling,
  53001. tagName: tagName,
  53002. setTextContent: setTextContent,
  53003. setStyleScope: setStyleScope
  53004. });
  53005. /* */
  53006. var ref = {
  53007. create: function create (_, vnode) {
  53008. registerRef(vnode);
  53009. },
  53010. update: function update (oldVnode, vnode) {
  53011. if (oldVnode.data.ref !== vnode.data.ref) {
  53012. registerRef(oldVnode, true);
  53013. registerRef(vnode);
  53014. }
  53015. },
  53016. destroy: function destroy (vnode) {
  53017. registerRef(vnode, true);
  53018. }
  53019. };
  53020. function registerRef (vnode, isRemoval) {
  53021. var key = vnode.data.ref;
  53022. if (!isDef(key)) { return }
  53023. var vm = vnode.context;
  53024. var ref = vnode.componentInstance || vnode.elm;
  53025. var refs = vm.$refs;
  53026. if (isRemoval) {
  53027. if (Array.isArray(refs[key])) {
  53028. remove(refs[key], ref);
  53029. } else if (refs[key] === ref) {
  53030. refs[key] = undefined;
  53031. }
  53032. } else {
  53033. if (vnode.data.refInFor) {
  53034. if (!Array.isArray(refs[key])) {
  53035. refs[key] = [ref];
  53036. } else if (refs[key].indexOf(ref) < 0) {
  53037. // $flow-disable-line
  53038. refs[key].push(ref);
  53039. }
  53040. } else {
  53041. refs[key] = ref;
  53042. }
  53043. }
  53044. }
  53045. /**
  53046. * Virtual DOM patching algorithm based on Snabbdom by
  53047. * Simon Friis Vindum (@paldepind)
  53048. * Licensed under the MIT License
  53049. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  53050. *
  53051. * modified by Evan You (@yyx990803)
  53052. *
  53053. * Not type-checking this because this file is perf-critical and the cost
  53054. * of making flow understand it is not worth it.
  53055. */
  53056. var emptyNode = new VNode('', {}, []);
  53057. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  53058. function sameVnode (a, b) {
  53059. return (
  53060. a.key === b.key && (
  53061. (
  53062. a.tag === b.tag &&
  53063. a.isComment === b.isComment &&
  53064. isDef(a.data) === isDef(b.data) &&
  53065. sameInputType(a, b)
  53066. ) || (
  53067. isTrue(a.isAsyncPlaceholder) &&
  53068. a.asyncFactory === b.asyncFactory &&
  53069. isUndef(b.asyncFactory.error)
  53070. )
  53071. )
  53072. )
  53073. }
  53074. function sameInputType (a, b) {
  53075. if (a.tag !== 'input') { return true }
  53076. var i;
  53077. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  53078. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  53079. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  53080. }
  53081. function createKeyToOldIdx (children, beginIdx, endIdx) {
  53082. var i, key;
  53083. var map = {};
  53084. for (i = beginIdx; i <= endIdx; ++i) {
  53085. key = children[i].key;
  53086. if (isDef(key)) { map[key] = i; }
  53087. }
  53088. return map
  53089. }
  53090. function createPatchFunction (backend) {
  53091. var i, j;
  53092. var cbs = {};
  53093. var modules = backend.modules;
  53094. var nodeOps = backend.nodeOps;
  53095. for (i = 0; i < hooks.length; ++i) {
  53096. cbs[hooks[i]] = [];
  53097. for (j = 0; j < modules.length; ++j) {
  53098. if (isDef(modules[j][hooks[i]])) {
  53099. cbs[hooks[i]].push(modules[j][hooks[i]]);
  53100. }
  53101. }
  53102. }
  53103. function emptyNodeAt (elm) {
  53104. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  53105. }
  53106. function createRmCb (childElm, listeners) {
  53107. function remove$$1 () {
  53108. if (--remove$$1.listeners === 0) {
  53109. removeNode(childElm);
  53110. }
  53111. }
  53112. remove$$1.listeners = listeners;
  53113. return remove$$1
  53114. }
  53115. function removeNode (el) {
  53116. var parent = nodeOps.parentNode(el);
  53117. // element may have already been removed due to v-html / v-text
  53118. if (isDef(parent)) {
  53119. nodeOps.removeChild(parent, el);
  53120. }
  53121. }
  53122. function isUnknownElement$$1 (vnode, inVPre) {
  53123. return (
  53124. !inVPre &&
  53125. !vnode.ns &&
  53126. !(
  53127. config.ignoredElements.length &&
  53128. config.ignoredElements.some(function (ignore) {
  53129. return isRegExp(ignore)
  53130. ? ignore.test(vnode.tag)
  53131. : ignore === vnode.tag
  53132. })
  53133. ) &&
  53134. config.isUnknownElement(vnode.tag)
  53135. )
  53136. }
  53137. var creatingElmInVPre = 0;
  53138. function createElm (
  53139. vnode,
  53140. insertedVnodeQueue,
  53141. parentElm,
  53142. refElm,
  53143. nested,
  53144. ownerArray,
  53145. index
  53146. ) {
  53147. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53148. // This vnode was used in a previous render!
  53149. // now it's used as a new node, overwriting its elm would cause
  53150. // potential patch errors down the road when it's used as an insertion
  53151. // reference node. Instead, we clone the node on-demand before creating
  53152. // associated DOM element for it.
  53153. vnode = ownerArray[index] = cloneVNode(vnode);
  53154. }
  53155. vnode.isRootInsert = !nested; // for transition enter check
  53156. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  53157. return
  53158. }
  53159. var data = vnode.data;
  53160. var children = vnode.children;
  53161. var tag = vnode.tag;
  53162. if (isDef(tag)) {
  53163. {
  53164. if (data && data.pre) {
  53165. creatingElmInVPre++;
  53166. }
  53167. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  53168. warn(
  53169. 'Unknown custom element: <' + tag + '> - did you ' +
  53170. 'register the component correctly? For recursive components, ' +
  53171. 'make sure to provide the "name" option.',
  53172. vnode.context
  53173. );
  53174. }
  53175. }
  53176. vnode.elm = vnode.ns
  53177. ? nodeOps.createElementNS(vnode.ns, tag)
  53178. : nodeOps.createElement(tag, vnode);
  53179. setScope(vnode);
  53180. /* istanbul ignore if */
  53181. {
  53182. createChildren(vnode, children, insertedVnodeQueue);
  53183. if (isDef(data)) {
  53184. invokeCreateHooks(vnode, insertedVnodeQueue);
  53185. }
  53186. insert(parentElm, vnode.elm, refElm);
  53187. }
  53188. if (data && data.pre) {
  53189. creatingElmInVPre--;
  53190. }
  53191. } else if (isTrue(vnode.isComment)) {
  53192. vnode.elm = nodeOps.createComment(vnode.text);
  53193. insert(parentElm, vnode.elm, refElm);
  53194. } else {
  53195. vnode.elm = nodeOps.createTextNode(vnode.text);
  53196. insert(parentElm, vnode.elm, refElm);
  53197. }
  53198. }
  53199. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  53200. var i = vnode.data;
  53201. if (isDef(i)) {
  53202. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  53203. if (isDef(i = i.hook) && isDef(i = i.init)) {
  53204. i(vnode, false /* hydrating */);
  53205. }
  53206. // after calling the init hook, if the vnode is a child component
  53207. // it should've created a child instance and mounted it. the child
  53208. // component also has set the placeholder vnode's elm.
  53209. // in that case we can just return the element and be done.
  53210. if (isDef(vnode.componentInstance)) {
  53211. initComponent(vnode, insertedVnodeQueue);
  53212. insert(parentElm, vnode.elm, refElm);
  53213. if (isTrue(isReactivated)) {
  53214. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  53215. }
  53216. return true
  53217. }
  53218. }
  53219. }
  53220. function initComponent (vnode, insertedVnodeQueue) {
  53221. if (isDef(vnode.data.pendingInsert)) {
  53222. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  53223. vnode.data.pendingInsert = null;
  53224. }
  53225. vnode.elm = vnode.componentInstance.$el;
  53226. if (isPatchable(vnode)) {
  53227. invokeCreateHooks(vnode, insertedVnodeQueue);
  53228. setScope(vnode);
  53229. } else {
  53230. // empty component root.
  53231. // skip all element-related modules except for ref (#3455)
  53232. registerRef(vnode);
  53233. // make sure to invoke the insert hook
  53234. insertedVnodeQueue.push(vnode);
  53235. }
  53236. }
  53237. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  53238. var i;
  53239. // hack for #4339: a reactivated component with inner transition
  53240. // does not trigger because the inner node's created hooks are not called
  53241. // again. It's not ideal to involve module-specific logic in here but
  53242. // there doesn't seem to be a better way to do it.
  53243. var innerNode = vnode;
  53244. while (innerNode.componentInstance) {
  53245. innerNode = innerNode.componentInstance._vnode;
  53246. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  53247. for (i = 0; i < cbs.activate.length; ++i) {
  53248. cbs.activate[i](emptyNode, innerNode);
  53249. }
  53250. insertedVnodeQueue.push(innerNode);
  53251. break
  53252. }
  53253. }
  53254. // unlike a newly created component,
  53255. // a reactivated keep-alive component doesn't insert itself
  53256. insert(parentElm, vnode.elm, refElm);
  53257. }
  53258. function insert (parent, elm, ref$$1) {
  53259. if (isDef(parent)) {
  53260. if (isDef(ref$$1)) {
  53261. if (nodeOps.parentNode(ref$$1) === parent) {
  53262. nodeOps.insertBefore(parent, elm, ref$$1);
  53263. }
  53264. } else {
  53265. nodeOps.appendChild(parent, elm);
  53266. }
  53267. }
  53268. }
  53269. function createChildren (vnode, children, insertedVnodeQueue) {
  53270. if (Array.isArray(children)) {
  53271. {
  53272. checkDuplicateKeys(children);
  53273. }
  53274. for (var i = 0; i < children.length; ++i) {
  53275. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  53276. }
  53277. } else if (isPrimitive(vnode.text)) {
  53278. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  53279. }
  53280. }
  53281. function isPatchable (vnode) {
  53282. while (vnode.componentInstance) {
  53283. vnode = vnode.componentInstance._vnode;
  53284. }
  53285. return isDef(vnode.tag)
  53286. }
  53287. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  53288. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53289. cbs.create[i$1](emptyNode, vnode);
  53290. }
  53291. i = vnode.data.hook; // Reuse variable
  53292. if (isDef(i)) {
  53293. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  53294. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  53295. }
  53296. }
  53297. // set scope id attribute for scoped CSS.
  53298. // this is implemented as a special case to avoid the overhead
  53299. // of going through the normal attribute patching process.
  53300. function setScope (vnode) {
  53301. var i;
  53302. if (isDef(i = vnode.fnScopeId)) {
  53303. nodeOps.setStyleScope(vnode.elm, i);
  53304. } else {
  53305. var ancestor = vnode;
  53306. while (ancestor) {
  53307. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  53308. nodeOps.setStyleScope(vnode.elm, i);
  53309. }
  53310. ancestor = ancestor.parent;
  53311. }
  53312. }
  53313. // for slot content they should also get the scopeId from the host instance.
  53314. if (isDef(i = activeInstance) &&
  53315. i !== vnode.context &&
  53316. i !== vnode.fnContext &&
  53317. isDef(i = i.$options._scopeId)
  53318. ) {
  53319. nodeOps.setStyleScope(vnode.elm, i);
  53320. }
  53321. }
  53322. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  53323. for (; startIdx <= endIdx; ++startIdx) {
  53324. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  53325. }
  53326. }
  53327. function invokeDestroyHook (vnode) {
  53328. var i, j;
  53329. var data = vnode.data;
  53330. if (isDef(data)) {
  53331. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  53332. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  53333. }
  53334. if (isDef(i = vnode.children)) {
  53335. for (j = 0; j < vnode.children.length; ++j) {
  53336. invokeDestroyHook(vnode.children[j]);
  53337. }
  53338. }
  53339. }
  53340. function removeVnodes (vnodes, startIdx, endIdx) {
  53341. for (; startIdx <= endIdx; ++startIdx) {
  53342. var ch = vnodes[startIdx];
  53343. if (isDef(ch)) {
  53344. if (isDef(ch.tag)) {
  53345. removeAndInvokeRemoveHook(ch);
  53346. invokeDestroyHook(ch);
  53347. } else { // Text node
  53348. removeNode(ch.elm);
  53349. }
  53350. }
  53351. }
  53352. }
  53353. function removeAndInvokeRemoveHook (vnode, rm) {
  53354. if (isDef(rm) || isDef(vnode.data)) {
  53355. var i;
  53356. var listeners = cbs.remove.length + 1;
  53357. if (isDef(rm)) {
  53358. // we have a recursively passed down rm callback
  53359. // increase the listeners count
  53360. rm.listeners += listeners;
  53361. } else {
  53362. // directly removing
  53363. rm = createRmCb(vnode.elm, listeners);
  53364. }
  53365. // recursively invoke hooks on child component root node
  53366. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  53367. removeAndInvokeRemoveHook(i, rm);
  53368. }
  53369. for (i = 0; i < cbs.remove.length; ++i) {
  53370. cbs.remove[i](vnode, rm);
  53371. }
  53372. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  53373. i(vnode, rm);
  53374. } else {
  53375. rm();
  53376. }
  53377. } else {
  53378. removeNode(vnode.elm);
  53379. }
  53380. }
  53381. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  53382. var oldStartIdx = 0;
  53383. var newStartIdx = 0;
  53384. var oldEndIdx = oldCh.length - 1;
  53385. var oldStartVnode = oldCh[0];
  53386. var oldEndVnode = oldCh[oldEndIdx];
  53387. var newEndIdx = newCh.length - 1;
  53388. var newStartVnode = newCh[0];
  53389. var newEndVnode = newCh[newEndIdx];
  53390. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  53391. // removeOnly is a special flag used only by <transition-group>
  53392. // to ensure removed elements stay in correct relative positions
  53393. // during leaving transitions
  53394. var canMove = !removeOnly;
  53395. {
  53396. checkDuplicateKeys(newCh);
  53397. }
  53398. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  53399. if (isUndef(oldStartVnode)) {
  53400. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  53401. } else if (isUndef(oldEndVnode)) {
  53402. oldEndVnode = oldCh[--oldEndIdx];
  53403. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  53404. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53405. oldStartVnode = oldCh[++oldStartIdx];
  53406. newStartVnode = newCh[++newStartIdx];
  53407. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  53408. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  53409. oldEndVnode = oldCh[--oldEndIdx];
  53410. newEndVnode = newCh[--newEndIdx];
  53411. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  53412. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  53413. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  53414. oldStartVnode = oldCh[++oldStartIdx];
  53415. newEndVnode = newCh[--newEndIdx];
  53416. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  53417. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53418. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  53419. oldEndVnode = oldCh[--oldEndIdx];
  53420. newStartVnode = newCh[++newStartIdx];
  53421. } else {
  53422. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  53423. idxInOld = isDef(newStartVnode.key)
  53424. ? oldKeyToIdx[newStartVnode.key]
  53425. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  53426. if (isUndef(idxInOld)) { // New element
  53427. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  53428. } else {
  53429. vnodeToMove = oldCh[idxInOld];
  53430. if (sameVnode(vnodeToMove, newStartVnode)) {
  53431. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53432. oldCh[idxInOld] = undefined;
  53433. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  53434. } else {
  53435. // same key but different element. treat as new element
  53436. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  53437. }
  53438. }
  53439. newStartVnode = newCh[++newStartIdx];
  53440. }
  53441. }
  53442. if (oldStartIdx > oldEndIdx) {
  53443. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  53444. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  53445. } else if (newStartIdx > newEndIdx) {
  53446. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  53447. }
  53448. }
  53449. function checkDuplicateKeys (children) {
  53450. var seenKeys = {};
  53451. for (var i = 0; i < children.length; i++) {
  53452. var vnode = children[i];
  53453. var key = vnode.key;
  53454. if (isDef(key)) {
  53455. if (seenKeys[key]) {
  53456. warn(
  53457. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  53458. vnode.context
  53459. );
  53460. } else {
  53461. seenKeys[key] = true;
  53462. }
  53463. }
  53464. }
  53465. }
  53466. function findIdxInOld (node, oldCh, start, end) {
  53467. for (var i = start; i < end; i++) {
  53468. var c = oldCh[i];
  53469. if (isDef(c) && sameVnode(node, c)) { return i }
  53470. }
  53471. }
  53472. function patchVnode (
  53473. oldVnode,
  53474. vnode,
  53475. insertedVnodeQueue,
  53476. ownerArray,
  53477. index,
  53478. removeOnly
  53479. ) {
  53480. if (oldVnode === vnode) {
  53481. return
  53482. }
  53483. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53484. // clone reused vnode
  53485. vnode = ownerArray[index] = cloneVNode(vnode);
  53486. }
  53487. var elm = vnode.elm = oldVnode.elm;
  53488. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  53489. if (isDef(vnode.asyncFactory.resolved)) {
  53490. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  53491. } else {
  53492. vnode.isAsyncPlaceholder = true;
  53493. }
  53494. return
  53495. }
  53496. // reuse element for static trees.
  53497. // note we only do this if the vnode is cloned -
  53498. // if the new node is not cloned it means the render functions have been
  53499. // reset by the hot-reload-api and we need to do a proper re-render.
  53500. if (isTrue(vnode.isStatic) &&
  53501. isTrue(oldVnode.isStatic) &&
  53502. vnode.key === oldVnode.key &&
  53503. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  53504. ) {
  53505. vnode.componentInstance = oldVnode.componentInstance;
  53506. return
  53507. }
  53508. var i;
  53509. var data = vnode.data;
  53510. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  53511. i(oldVnode, vnode);
  53512. }
  53513. var oldCh = oldVnode.children;
  53514. var ch = vnode.children;
  53515. if (isDef(data) && isPatchable(vnode)) {
  53516. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  53517. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  53518. }
  53519. if (isUndef(vnode.text)) {
  53520. if (isDef(oldCh) && isDef(ch)) {
  53521. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  53522. } else if (isDef(ch)) {
  53523. {
  53524. checkDuplicateKeys(ch);
  53525. }
  53526. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  53527. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  53528. } else if (isDef(oldCh)) {
  53529. removeVnodes(oldCh, 0, oldCh.length - 1);
  53530. } else if (isDef(oldVnode.text)) {
  53531. nodeOps.setTextContent(elm, '');
  53532. }
  53533. } else if (oldVnode.text !== vnode.text) {
  53534. nodeOps.setTextContent(elm, vnode.text);
  53535. }
  53536. if (isDef(data)) {
  53537. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  53538. }
  53539. }
  53540. function invokeInsertHook (vnode, queue, initial) {
  53541. // delay insert hooks for component root nodes, invoke them after the
  53542. // element is really inserted
  53543. if (isTrue(initial) && isDef(vnode.parent)) {
  53544. vnode.parent.data.pendingInsert = queue;
  53545. } else {
  53546. for (var i = 0; i < queue.length; ++i) {
  53547. queue[i].data.hook.insert(queue[i]);
  53548. }
  53549. }
  53550. }
  53551. var hydrationBailed = false;
  53552. // list of modules that can skip create hook during hydration because they
  53553. // are already rendered on the client or has no need for initialization
  53554. // Note: style is excluded because it relies on initial clone for future
  53555. // deep updates (#7063).
  53556. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  53557. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  53558. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  53559. var i;
  53560. var tag = vnode.tag;
  53561. var data = vnode.data;
  53562. var children = vnode.children;
  53563. inVPre = inVPre || (data && data.pre);
  53564. vnode.elm = elm;
  53565. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  53566. vnode.isAsyncPlaceholder = true;
  53567. return true
  53568. }
  53569. // assert node match
  53570. {
  53571. if (!assertNodeMatch(elm, vnode, inVPre)) {
  53572. return false
  53573. }
  53574. }
  53575. if (isDef(data)) {
  53576. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  53577. if (isDef(i = vnode.componentInstance)) {
  53578. // child component. it should have hydrated its own tree.
  53579. initComponent(vnode, insertedVnodeQueue);
  53580. return true
  53581. }
  53582. }
  53583. if (isDef(tag)) {
  53584. if (isDef(children)) {
  53585. // empty element, allow client to pick up and populate children
  53586. if (!elm.hasChildNodes()) {
  53587. createChildren(vnode, children, insertedVnodeQueue);
  53588. } else {
  53589. // v-html and domProps: innerHTML
  53590. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  53591. if (i !== elm.innerHTML) {
  53592. /* istanbul ignore if */
  53593. if (typeof console !== 'undefined' &&
  53594. !hydrationBailed
  53595. ) {
  53596. hydrationBailed = true;
  53597. console.warn('Parent: ', elm);
  53598. console.warn('server innerHTML: ', i);
  53599. console.warn('client innerHTML: ', elm.innerHTML);
  53600. }
  53601. return false
  53602. }
  53603. } else {
  53604. // iterate and compare children lists
  53605. var childrenMatch = true;
  53606. var childNode = elm.firstChild;
  53607. for (var i$1 = 0; i$1 < children.length; i$1++) {
  53608. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  53609. childrenMatch = false;
  53610. break
  53611. }
  53612. childNode = childNode.nextSibling;
  53613. }
  53614. // if childNode is not null, it means the actual childNodes list is
  53615. // longer than the virtual children list.
  53616. if (!childrenMatch || childNode) {
  53617. /* istanbul ignore if */
  53618. if (typeof console !== 'undefined' &&
  53619. !hydrationBailed
  53620. ) {
  53621. hydrationBailed = true;
  53622. console.warn('Parent: ', elm);
  53623. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  53624. }
  53625. return false
  53626. }
  53627. }
  53628. }
  53629. }
  53630. if (isDef(data)) {
  53631. var fullInvoke = false;
  53632. for (var key in data) {
  53633. if (!isRenderedModule(key)) {
  53634. fullInvoke = true;
  53635. invokeCreateHooks(vnode, insertedVnodeQueue);
  53636. break
  53637. }
  53638. }
  53639. if (!fullInvoke && data['class']) {
  53640. // ensure collecting deps for deep class bindings for future updates
  53641. traverse(data['class']);
  53642. }
  53643. }
  53644. } else if (elm.data !== vnode.text) {
  53645. elm.data = vnode.text;
  53646. }
  53647. return true
  53648. }
  53649. function assertNodeMatch (node, vnode, inVPre) {
  53650. if (isDef(vnode.tag)) {
  53651. return vnode.tag.indexOf('vue-component') === 0 || (
  53652. !isUnknownElement$$1(vnode, inVPre) &&
  53653. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  53654. )
  53655. } else {
  53656. return node.nodeType === (vnode.isComment ? 8 : 3)
  53657. }
  53658. }
  53659. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  53660. if (isUndef(vnode)) {
  53661. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  53662. return
  53663. }
  53664. var isInitialPatch = false;
  53665. var insertedVnodeQueue = [];
  53666. if (isUndef(oldVnode)) {
  53667. // empty mount (likely as component), create new root element
  53668. isInitialPatch = true;
  53669. createElm(vnode, insertedVnodeQueue);
  53670. } else {
  53671. var isRealElement = isDef(oldVnode.nodeType);
  53672. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  53673. // patch existing root node
  53674. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  53675. } else {
  53676. if (isRealElement) {
  53677. // mounting to a real element
  53678. // check if this is server-rendered content and if we can perform
  53679. // a successful hydration.
  53680. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  53681. oldVnode.removeAttribute(SSR_ATTR);
  53682. hydrating = true;
  53683. }
  53684. if (isTrue(hydrating)) {
  53685. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  53686. invokeInsertHook(vnode, insertedVnodeQueue, true);
  53687. return oldVnode
  53688. } else {
  53689. warn(
  53690. 'The client-side rendered virtual DOM tree is not matching ' +
  53691. 'server-rendered content. This is likely caused by incorrect ' +
  53692. 'HTML markup, for example nesting block-level elements inside ' +
  53693. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  53694. 'full client-side render.'
  53695. );
  53696. }
  53697. }
  53698. // either not server-rendered, or hydration failed.
  53699. // create an empty node and replace it
  53700. oldVnode = emptyNodeAt(oldVnode);
  53701. }
  53702. // replacing existing element
  53703. var oldElm = oldVnode.elm;
  53704. var parentElm = nodeOps.parentNode(oldElm);
  53705. // create new node
  53706. createElm(
  53707. vnode,
  53708. insertedVnodeQueue,
  53709. // extremely rare edge case: do not insert if old element is in a
  53710. // leaving transition. Only happens when combining transition +
  53711. // keep-alive + HOCs. (#4590)
  53712. oldElm._leaveCb ? null : parentElm,
  53713. nodeOps.nextSibling(oldElm)
  53714. );
  53715. // update parent placeholder node element, recursively
  53716. if (isDef(vnode.parent)) {
  53717. var ancestor = vnode.parent;
  53718. var patchable = isPatchable(vnode);
  53719. while (ancestor) {
  53720. for (var i = 0; i < cbs.destroy.length; ++i) {
  53721. cbs.destroy[i](ancestor);
  53722. }
  53723. ancestor.elm = vnode.elm;
  53724. if (patchable) {
  53725. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53726. cbs.create[i$1](emptyNode, ancestor);
  53727. }
  53728. // #6513
  53729. // invoke insert hooks that may have been merged by create hooks.
  53730. // e.g. for directives that uses the "inserted" hook.
  53731. var insert = ancestor.data.hook.insert;
  53732. if (insert.merged) {
  53733. // start at index 1 to avoid re-invoking component mounted hook
  53734. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  53735. insert.fns[i$2]();
  53736. }
  53737. }
  53738. } else {
  53739. registerRef(ancestor);
  53740. }
  53741. ancestor = ancestor.parent;
  53742. }
  53743. }
  53744. // destroy old node
  53745. if (isDef(parentElm)) {
  53746. removeVnodes([oldVnode], 0, 0);
  53747. } else if (isDef(oldVnode.tag)) {
  53748. invokeDestroyHook(oldVnode);
  53749. }
  53750. }
  53751. }
  53752. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  53753. return vnode.elm
  53754. }
  53755. }
  53756. /* */
  53757. var directives = {
  53758. create: updateDirectives,
  53759. update: updateDirectives,
  53760. destroy: function unbindDirectives (vnode) {
  53761. updateDirectives(vnode, emptyNode);
  53762. }
  53763. };
  53764. function updateDirectives (oldVnode, vnode) {
  53765. if (oldVnode.data.directives || vnode.data.directives) {
  53766. _update(oldVnode, vnode);
  53767. }
  53768. }
  53769. function _update (oldVnode, vnode) {
  53770. var isCreate = oldVnode === emptyNode;
  53771. var isDestroy = vnode === emptyNode;
  53772. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  53773. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  53774. var dirsWithInsert = [];
  53775. var dirsWithPostpatch = [];
  53776. var key, oldDir, dir;
  53777. for (key in newDirs) {
  53778. oldDir = oldDirs[key];
  53779. dir = newDirs[key];
  53780. if (!oldDir) {
  53781. // new directive, bind
  53782. callHook$1(dir, 'bind', vnode, oldVnode);
  53783. if (dir.def && dir.def.inserted) {
  53784. dirsWithInsert.push(dir);
  53785. }
  53786. } else {
  53787. // existing directive, update
  53788. dir.oldValue = oldDir.value;
  53789. dir.oldArg = oldDir.arg;
  53790. callHook$1(dir, 'update', vnode, oldVnode);
  53791. if (dir.def && dir.def.componentUpdated) {
  53792. dirsWithPostpatch.push(dir);
  53793. }
  53794. }
  53795. }
  53796. if (dirsWithInsert.length) {
  53797. var callInsert = function () {
  53798. for (var i = 0; i < dirsWithInsert.length; i++) {
  53799. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  53800. }
  53801. };
  53802. if (isCreate) {
  53803. mergeVNodeHook(vnode, 'insert', callInsert);
  53804. } else {
  53805. callInsert();
  53806. }
  53807. }
  53808. if (dirsWithPostpatch.length) {
  53809. mergeVNodeHook(vnode, 'postpatch', function () {
  53810. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  53811. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  53812. }
  53813. });
  53814. }
  53815. if (!isCreate) {
  53816. for (key in oldDirs) {
  53817. if (!newDirs[key]) {
  53818. // no longer present, unbind
  53819. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  53820. }
  53821. }
  53822. }
  53823. }
  53824. var emptyModifiers = Object.create(null);
  53825. function normalizeDirectives$1 (
  53826. dirs,
  53827. vm
  53828. ) {
  53829. var res = Object.create(null);
  53830. if (!dirs) {
  53831. // $flow-disable-line
  53832. return res
  53833. }
  53834. var i, dir;
  53835. for (i = 0; i < dirs.length; i++) {
  53836. dir = dirs[i];
  53837. if (!dir.modifiers) {
  53838. // $flow-disable-line
  53839. dir.modifiers = emptyModifiers;
  53840. }
  53841. res[getRawDirName(dir)] = dir;
  53842. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  53843. }
  53844. // $flow-disable-line
  53845. return res
  53846. }
  53847. function getRawDirName (dir) {
  53848. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  53849. }
  53850. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  53851. var fn = dir.def && dir.def[hook];
  53852. if (fn) {
  53853. try {
  53854. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  53855. } catch (e) {
  53856. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  53857. }
  53858. }
  53859. }
  53860. var baseModules = [
  53861. ref,
  53862. directives
  53863. ];
  53864. /* */
  53865. function updateAttrs (oldVnode, vnode) {
  53866. var opts = vnode.componentOptions;
  53867. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  53868. return
  53869. }
  53870. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  53871. return
  53872. }
  53873. var key, cur, old;
  53874. var elm = vnode.elm;
  53875. var oldAttrs = oldVnode.data.attrs || {};
  53876. var attrs = vnode.data.attrs || {};
  53877. // clone observed objects, as the user probably wants to mutate it
  53878. if (isDef(attrs.__ob__)) {
  53879. attrs = vnode.data.attrs = extend({}, attrs);
  53880. }
  53881. for (key in attrs) {
  53882. cur = attrs[key];
  53883. old = oldAttrs[key];
  53884. if (old !== cur) {
  53885. setAttr(elm, key, cur);
  53886. }
  53887. }
  53888. // #4391: in IE9, setting type can reset value for input[type=radio]
  53889. // #6666: IE/Edge forces progress value down to 1 before setting a max
  53890. /* istanbul ignore if */
  53891. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  53892. setAttr(elm, 'value', attrs.value);
  53893. }
  53894. for (key in oldAttrs) {
  53895. if (isUndef(attrs[key])) {
  53896. if (isXlink(key)) {
  53897. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53898. } else if (!isEnumeratedAttr(key)) {
  53899. elm.removeAttribute(key);
  53900. }
  53901. }
  53902. }
  53903. }
  53904. function setAttr (el, key, value) {
  53905. if (el.tagName.indexOf('-') > -1) {
  53906. baseSetAttr(el, key, value);
  53907. } else if (isBooleanAttr(key)) {
  53908. // set attribute for blank value
  53909. // e.g. <option disabled>Select one</option>
  53910. if (isFalsyAttrValue(value)) {
  53911. el.removeAttribute(key);
  53912. } else {
  53913. // technically allowfullscreen is a boolean attribute for <iframe>,
  53914. // but Flash expects a value of "true" when used on <embed> tag
  53915. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  53916. ? 'true'
  53917. : key;
  53918. el.setAttribute(key, value);
  53919. }
  53920. } else if (isEnumeratedAttr(key)) {
  53921. el.setAttribute(key, convertEnumeratedValue(key, value));
  53922. } else if (isXlink(key)) {
  53923. if (isFalsyAttrValue(value)) {
  53924. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53925. } else {
  53926. el.setAttributeNS(xlinkNS, key, value);
  53927. }
  53928. } else {
  53929. baseSetAttr(el, key, value);
  53930. }
  53931. }
  53932. function baseSetAttr (el, key, value) {
  53933. if (isFalsyAttrValue(value)) {
  53934. el.removeAttribute(key);
  53935. } else {
  53936. // #7138: IE10 & 11 fires input event when setting placeholder on
  53937. // <textarea>... block the first input event and remove the blocker
  53938. // immediately.
  53939. /* istanbul ignore if */
  53940. if (
  53941. isIE && !isIE9 &&
  53942. el.tagName === 'TEXTAREA' &&
  53943. key === 'placeholder' && value !== '' && !el.__ieph
  53944. ) {
  53945. var blocker = function (e) {
  53946. e.stopImmediatePropagation();
  53947. el.removeEventListener('input', blocker);
  53948. };
  53949. el.addEventListener('input', blocker);
  53950. // $flow-disable-line
  53951. el.__ieph = true; /* IE placeholder patched */
  53952. }
  53953. el.setAttribute(key, value);
  53954. }
  53955. }
  53956. var attrs = {
  53957. create: updateAttrs,
  53958. update: updateAttrs
  53959. };
  53960. /* */
  53961. function updateClass (oldVnode, vnode) {
  53962. var el = vnode.elm;
  53963. var data = vnode.data;
  53964. var oldData = oldVnode.data;
  53965. if (
  53966. isUndef(data.staticClass) &&
  53967. isUndef(data.class) && (
  53968. isUndef(oldData) || (
  53969. isUndef(oldData.staticClass) &&
  53970. isUndef(oldData.class)
  53971. )
  53972. )
  53973. ) {
  53974. return
  53975. }
  53976. var cls = genClassForVnode(vnode);
  53977. // handle transition classes
  53978. var transitionClass = el._transitionClasses;
  53979. if (isDef(transitionClass)) {
  53980. cls = concat(cls, stringifyClass(transitionClass));
  53981. }
  53982. // set the class
  53983. if (cls !== el._prevClass) {
  53984. el.setAttribute('class', cls);
  53985. el._prevClass = cls;
  53986. }
  53987. }
  53988. var klass = {
  53989. create: updateClass,
  53990. update: updateClass
  53991. };
  53992. /* */
  53993. var validDivisionCharRE = /[\w).+\-_$\]]/;
  53994. function parseFilters (exp) {
  53995. var inSingle = false;
  53996. var inDouble = false;
  53997. var inTemplateString = false;
  53998. var inRegex = false;
  53999. var curly = 0;
  54000. var square = 0;
  54001. var paren = 0;
  54002. var lastFilterIndex = 0;
  54003. var c, prev, i, expression, filters;
  54004. for (i = 0; i < exp.length; i++) {
  54005. prev = c;
  54006. c = exp.charCodeAt(i);
  54007. if (inSingle) {
  54008. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  54009. } else if (inDouble) {
  54010. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  54011. } else if (inTemplateString) {
  54012. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  54013. } else if (inRegex) {
  54014. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  54015. } else if (
  54016. c === 0x7C && // pipe
  54017. exp.charCodeAt(i + 1) !== 0x7C &&
  54018. exp.charCodeAt(i - 1) !== 0x7C &&
  54019. !curly && !square && !paren
  54020. ) {
  54021. if (expression === undefined) {
  54022. // first filter, end of expression
  54023. lastFilterIndex = i + 1;
  54024. expression = exp.slice(0, i).trim();
  54025. } else {
  54026. pushFilter();
  54027. }
  54028. } else {
  54029. switch (c) {
  54030. case 0x22: inDouble = true; break // "
  54031. case 0x27: inSingle = true; break // '
  54032. case 0x60: inTemplateString = true; break // `
  54033. case 0x28: paren++; break // (
  54034. case 0x29: paren--; break // )
  54035. case 0x5B: square++; break // [
  54036. case 0x5D: square--; break // ]
  54037. case 0x7B: curly++; break // {
  54038. case 0x7D: curly--; break // }
  54039. }
  54040. if (c === 0x2f) { // /
  54041. var j = i - 1;
  54042. var p = (void 0);
  54043. // find first non-whitespace prev char
  54044. for (; j >= 0; j--) {
  54045. p = exp.charAt(j);
  54046. if (p !== ' ') { break }
  54047. }
  54048. if (!p || !validDivisionCharRE.test(p)) {
  54049. inRegex = true;
  54050. }
  54051. }
  54052. }
  54053. }
  54054. if (expression === undefined) {
  54055. expression = exp.slice(0, i).trim();
  54056. } else if (lastFilterIndex !== 0) {
  54057. pushFilter();
  54058. }
  54059. function pushFilter () {
  54060. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  54061. lastFilterIndex = i + 1;
  54062. }
  54063. if (filters) {
  54064. for (i = 0; i < filters.length; i++) {
  54065. expression = wrapFilter(expression, filters[i]);
  54066. }
  54067. }
  54068. return expression
  54069. }
  54070. function wrapFilter (exp, filter) {
  54071. var i = filter.indexOf('(');
  54072. if (i < 0) {
  54073. // _f: resolveFilter
  54074. return ("_f(\"" + filter + "\")(" + exp + ")")
  54075. } else {
  54076. var name = filter.slice(0, i);
  54077. var args = filter.slice(i + 1);
  54078. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  54079. }
  54080. }
  54081. /* */
  54082. /* eslint-disable no-unused-vars */
  54083. function baseWarn (msg, range) {
  54084. console.error(("[Vue compiler]: " + msg));
  54085. }
  54086. /* eslint-enable no-unused-vars */
  54087. function pluckModuleFunction (
  54088. modules,
  54089. key
  54090. ) {
  54091. return modules
  54092. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  54093. : []
  54094. }
  54095. function addProp (el, name, value, range, dynamic) {
  54096. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54097. el.plain = false;
  54098. }
  54099. function addAttr (el, name, value, range, dynamic) {
  54100. var attrs = dynamic
  54101. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  54102. : (el.attrs || (el.attrs = []));
  54103. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54104. el.plain = false;
  54105. }
  54106. // add a raw attr (use this in preTransforms)
  54107. function addRawAttr (el, name, value, range) {
  54108. el.attrsMap[name] = value;
  54109. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  54110. }
  54111. function addDirective (
  54112. el,
  54113. name,
  54114. rawName,
  54115. value,
  54116. arg,
  54117. isDynamicArg,
  54118. modifiers,
  54119. range
  54120. ) {
  54121. (el.directives || (el.directives = [])).push(rangeSetItem({
  54122. name: name,
  54123. rawName: rawName,
  54124. value: value,
  54125. arg: arg,
  54126. isDynamicArg: isDynamicArg,
  54127. modifiers: modifiers
  54128. }, range));
  54129. el.plain = false;
  54130. }
  54131. function prependModifierMarker (symbol, name, dynamic) {
  54132. return dynamic
  54133. ? ("_p(" + name + ",\"" + symbol + "\")")
  54134. : symbol + name // mark the event as captured
  54135. }
  54136. function addHandler (
  54137. el,
  54138. name,
  54139. value,
  54140. modifiers,
  54141. important,
  54142. warn,
  54143. range,
  54144. dynamic
  54145. ) {
  54146. modifiers = modifiers || emptyObject;
  54147. // warn prevent and passive modifier
  54148. /* istanbul ignore if */
  54149. if (
  54150. warn &&
  54151. modifiers.prevent && modifiers.passive
  54152. ) {
  54153. warn(
  54154. 'passive and prevent can\'t be used together. ' +
  54155. 'Passive handler can\'t prevent default event.',
  54156. range
  54157. );
  54158. }
  54159. // normalize click.right and click.middle since they don't actually fire
  54160. // this is technically browser-specific, but at least for now browsers are
  54161. // the only target envs that have right/middle clicks.
  54162. if (modifiers.right) {
  54163. if (dynamic) {
  54164. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  54165. } else if (name === 'click') {
  54166. name = 'contextmenu';
  54167. delete modifiers.right;
  54168. }
  54169. } else if (modifiers.middle) {
  54170. if (dynamic) {
  54171. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  54172. } else if (name === 'click') {
  54173. name = 'mouseup';
  54174. }
  54175. }
  54176. // check capture modifier
  54177. if (modifiers.capture) {
  54178. delete modifiers.capture;
  54179. name = prependModifierMarker('!', name, dynamic);
  54180. }
  54181. if (modifiers.once) {
  54182. delete modifiers.once;
  54183. name = prependModifierMarker('~', name, dynamic);
  54184. }
  54185. /* istanbul ignore if */
  54186. if (modifiers.passive) {
  54187. delete modifiers.passive;
  54188. name = prependModifierMarker('&', name, dynamic);
  54189. }
  54190. var events;
  54191. if (modifiers.native) {
  54192. delete modifiers.native;
  54193. events = el.nativeEvents || (el.nativeEvents = {});
  54194. } else {
  54195. events = el.events || (el.events = {});
  54196. }
  54197. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  54198. if (modifiers !== emptyObject) {
  54199. newHandler.modifiers = modifiers;
  54200. }
  54201. var handlers = events[name];
  54202. /* istanbul ignore if */
  54203. if (Array.isArray(handlers)) {
  54204. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  54205. } else if (handlers) {
  54206. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  54207. } else {
  54208. events[name] = newHandler;
  54209. }
  54210. el.plain = false;
  54211. }
  54212. function getRawBindingAttr (
  54213. el,
  54214. name
  54215. ) {
  54216. return el.rawAttrsMap[':' + name] ||
  54217. el.rawAttrsMap['v-bind:' + name] ||
  54218. el.rawAttrsMap[name]
  54219. }
  54220. function getBindingAttr (
  54221. el,
  54222. name,
  54223. getStatic
  54224. ) {
  54225. var dynamicValue =
  54226. getAndRemoveAttr(el, ':' + name) ||
  54227. getAndRemoveAttr(el, 'v-bind:' + name);
  54228. if (dynamicValue != null) {
  54229. return parseFilters(dynamicValue)
  54230. } else if (getStatic !== false) {
  54231. var staticValue = getAndRemoveAttr(el, name);
  54232. if (staticValue != null) {
  54233. return JSON.stringify(staticValue)
  54234. }
  54235. }
  54236. }
  54237. // note: this only removes the attr from the Array (attrsList) so that it
  54238. // doesn't get processed by processAttrs.
  54239. // By default it does NOT remove it from the map (attrsMap) because the map is
  54240. // needed during codegen.
  54241. function getAndRemoveAttr (
  54242. el,
  54243. name,
  54244. removeFromMap
  54245. ) {
  54246. var val;
  54247. if ((val = el.attrsMap[name]) != null) {
  54248. var list = el.attrsList;
  54249. for (var i = 0, l = list.length; i < l; i++) {
  54250. if (list[i].name === name) {
  54251. list.splice(i, 1);
  54252. break
  54253. }
  54254. }
  54255. }
  54256. if (removeFromMap) {
  54257. delete el.attrsMap[name];
  54258. }
  54259. return val
  54260. }
  54261. function getAndRemoveAttrByRegex (
  54262. el,
  54263. name
  54264. ) {
  54265. var list = el.attrsList;
  54266. for (var i = 0, l = list.length; i < l; i++) {
  54267. var attr = list[i];
  54268. if (name.test(attr.name)) {
  54269. list.splice(i, 1);
  54270. return attr
  54271. }
  54272. }
  54273. }
  54274. function rangeSetItem (
  54275. item,
  54276. range
  54277. ) {
  54278. if (range) {
  54279. if (range.start != null) {
  54280. item.start = range.start;
  54281. }
  54282. if (range.end != null) {
  54283. item.end = range.end;
  54284. }
  54285. }
  54286. return item
  54287. }
  54288. /* */
  54289. /**
  54290. * Cross-platform code generation for component v-model
  54291. */
  54292. function genComponentModel (
  54293. el,
  54294. value,
  54295. modifiers
  54296. ) {
  54297. var ref = modifiers || {};
  54298. var number = ref.number;
  54299. var trim = ref.trim;
  54300. var baseValueExpression = '$$v';
  54301. var valueExpression = baseValueExpression;
  54302. if (trim) {
  54303. valueExpression =
  54304. "(typeof " + baseValueExpression + " === 'string'" +
  54305. "? " + baseValueExpression + ".trim()" +
  54306. ": " + baseValueExpression + ")";
  54307. }
  54308. if (number) {
  54309. valueExpression = "_n(" + valueExpression + ")";
  54310. }
  54311. var assignment = genAssignmentCode(value, valueExpression);
  54312. el.model = {
  54313. value: ("(" + value + ")"),
  54314. expression: JSON.stringify(value),
  54315. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  54316. };
  54317. }
  54318. /**
  54319. * Cross-platform codegen helper for generating v-model value assignment code.
  54320. */
  54321. function genAssignmentCode (
  54322. value,
  54323. assignment
  54324. ) {
  54325. var res = parseModel(value);
  54326. if (res.key === null) {
  54327. return (value + "=" + assignment)
  54328. } else {
  54329. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  54330. }
  54331. }
  54332. /**
  54333. * Parse a v-model expression into a base path and a final key segment.
  54334. * Handles both dot-path and possible square brackets.
  54335. *
  54336. * Possible cases:
  54337. *
  54338. * - test
  54339. * - test[key]
  54340. * - test[test1[key]]
  54341. * - test["a"][key]
  54342. * - xxx.test[a[a].test1[key]]
  54343. * - test.xxx.a["asa"][test1[key]]
  54344. *
  54345. */
  54346. var len, str, chr, index$1, expressionPos, expressionEndPos;
  54347. function parseModel (val) {
  54348. // Fix https://github.com/vuejs/vue/pull/7730
  54349. // allow v-model="obj.val " (trailing whitespace)
  54350. val = val.trim();
  54351. len = val.length;
  54352. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  54353. index$1 = val.lastIndexOf('.');
  54354. if (index$1 > -1) {
  54355. return {
  54356. exp: val.slice(0, index$1),
  54357. key: '"' + val.slice(index$1 + 1) + '"'
  54358. }
  54359. } else {
  54360. return {
  54361. exp: val,
  54362. key: null
  54363. }
  54364. }
  54365. }
  54366. str = val;
  54367. index$1 = expressionPos = expressionEndPos = 0;
  54368. while (!eof()) {
  54369. chr = next();
  54370. /* istanbul ignore if */
  54371. if (isStringStart(chr)) {
  54372. parseString(chr);
  54373. } else if (chr === 0x5B) {
  54374. parseBracket(chr);
  54375. }
  54376. }
  54377. return {
  54378. exp: val.slice(0, expressionPos),
  54379. key: val.slice(expressionPos + 1, expressionEndPos)
  54380. }
  54381. }
  54382. function next () {
  54383. return str.charCodeAt(++index$1)
  54384. }
  54385. function eof () {
  54386. return index$1 >= len
  54387. }
  54388. function isStringStart (chr) {
  54389. return chr === 0x22 || chr === 0x27
  54390. }
  54391. function parseBracket (chr) {
  54392. var inBracket = 1;
  54393. expressionPos = index$1;
  54394. while (!eof()) {
  54395. chr = next();
  54396. if (isStringStart(chr)) {
  54397. parseString(chr);
  54398. continue
  54399. }
  54400. if (chr === 0x5B) { inBracket++; }
  54401. if (chr === 0x5D) { inBracket--; }
  54402. if (inBracket === 0) {
  54403. expressionEndPos = index$1;
  54404. break
  54405. }
  54406. }
  54407. }
  54408. function parseString (chr) {
  54409. var stringQuote = chr;
  54410. while (!eof()) {
  54411. chr = next();
  54412. if (chr === stringQuote) {
  54413. break
  54414. }
  54415. }
  54416. }
  54417. /* */
  54418. var warn$1;
  54419. // in some cases, the event used has to be determined at runtime
  54420. // so we used some reserved tokens during compile.
  54421. var RANGE_TOKEN = '__r';
  54422. var CHECKBOX_RADIO_TOKEN = '__c';
  54423. function model (
  54424. el,
  54425. dir,
  54426. _warn
  54427. ) {
  54428. warn$1 = _warn;
  54429. var value = dir.value;
  54430. var modifiers = dir.modifiers;
  54431. var tag = el.tag;
  54432. var type = el.attrsMap.type;
  54433. {
  54434. // inputs with type="file" are read only and setting the input's
  54435. // value will throw an error.
  54436. if (tag === 'input' && type === 'file') {
  54437. warn$1(
  54438. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  54439. "File inputs are read only. Use a v-on:change listener instead.",
  54440. el.rawAttrsMap['v-model']
  54441. );
  54442. }
  54443. }
  54444. if (el.component) {
  54445. genComponentModel(el, value, modifiers);
  54446. // component v-model doesn't need extra runtime
  54447. return false
  54448. } else if (tag === 'select') {
  54449. genSelect(el, value, modifiers);
  54450. } else if (tag === 'input' && type === 'checkbox') {
  54451. genCheckboxModel(el, value, modifiers);
  54452. } else if (tag === 'input' && type === 'radio') {
  54453. genRadioModel(el, value, modifiers);
  54454. } else if (tag === 'input' || tag === 'textarea') {
  54455. genDefaultModel(el, value, modifiers);
  54456. } else if (!config.isReservedTag(tag)) {
  54457. genComponentModel(el, value, modifiers);
  54458. // component v-model doesn't need extra runtime
  54459. return false
  54460. } else {
  54461. warn$1(
  54462. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54463. "v-model is not supported on this element type. " +
  54464. 'If you are working with contenteditable, it\'s recommended to ' +
  54465. 'wrap a library dedicated for that purpose inside a custom component.',
  54466. el.rawAttrsMap['v-model']
  54467. );
  54468. }
  54469. // ensure runtime directive metadata
  54470. return true
  54471. }
  54472. function genCheckboxModel (
  54473. el,
  54474. value,
  54475. modifiers
  54476. ) {
  54477. var number = modifiers && modifiers.number;
  54478. var valueBinding = getBindingAttr(el, 'value') || 'null';
  54479. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  54480. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  54481. addProp(el, 'checked',
  54482. "Array.isArray(" + value + ")" +
  54483. "?_i(" + value + "," + valueBinding + ")>-1" + (
  54484. trueValueBinding === 'true'
  54485. ? (":(" + value + ")")
  54486. : (":_q(" + value + "," + trueValueBinding + ")")
  54487. )
  54488. );
  54489. addHandler(el, 'change',
  54490. "var $$a=" + value + "," +
  54491. '$$el=$event.target,' +
  54492. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  54493. 'if(Array.isArray($$a)){' +
  54494. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  54495. '$$i=_i($$a,$$v);' +
  54496. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  54497. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  54498. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  54499. null, true
  54500. );
  54501. }
  54502. function genRadioModel (
  54503. el,
  54504. value,
  54505. modifiers
  54506. ) {
  54507. var number = modifiers && modifiers.number;
  54508. var valueBinding = getBindingAttr(el, 'value') || 'null';
  54509. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  54510. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  54511. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  54512. }
  54513. function genSelect (
  54514. el,
  54515. value,
  54516. modifiers
  54517. ) {
  54518. var number = modifiers && modifiers.number;
  54519. var selectedVal = "Array.prototype.filter" +
  54520. ".call($event.target.options,function(o){return o.selected})" +
  54521. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  54522. "return " + (number ? '_n(val)' : 'val') + "})";
  54523. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  54524. var code = "var $$selectedVal = " + selectedVal + ";";
  54525. code = code + " " + (genAssignmentCode(value, assignment));
  54526. addHandler(el, 'change', code, null, true);
  54527. }
  54528. function genDefaultModel (
  54529. el,
  54530. value,
  54531. modifiers
  54532. ) {
  54533. var type = el.attrsMap.type;
  54534. // warn if v-bind:value conflicts with v-model
  54535. // except for inputs with v-bind:type
  54536. {
  54537. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  54538. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  54539. if (value$1 && !typeBinding) {
  54540. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  54541. warn$1(
  54542. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  54543. 'because the latter already expands to a value binding internally',
  54544. el.rawAttrsMap[binding]
  54545. );
  54546. }
  54547. }
  54548. var ref = modifiers || {};
  54549. var lazy = ref.lazy;
  54550. var number = ref.number;
  54551. var trim = ref.trim;
  54552. var needCompositionGuard = !lazy && type !== 'range';
  54553. var event = lazy
  54554. ? 'change'
  54555. : type === 'range'
  54556. ? RANGE_TOKEN
  54557. : 'input';
  54558. var valueExpression = '$event.target.value';
  54559. if (trim) {
  54560. valueExpression = "$event.target.value.trim()";
  54561. }
  54562. if (number) {
  54563. valueExpression = "_n(" + valueExpression + ")";
  54564. }
  54565. var code = genAssignmentCode(value, valueExpression);
  54566. if (needCompositionGuard) {
  54567. code = "if($event.target.composing)return;" + code;
  54568. }
  54569. addProp(el, 'value', ("(" + value + ")"));
  54570. addHandler(el, event, code, null, true);
  54571. if (trim || number) {
  54572. addHandler(el, 'blur', '$forceUpdate()');
  54573. }
  54574. }
  54575. /* */
  54576. // normalize v-model event tokens that can only be determined at runtime.
  54577. // it's important to place the event as the first in the array because
  54578. // the whole point is ensuring the v-model callback gets called before
  54579. // user-attached handlers.
  54580. function normalizeEvents (on) {
  54581. /* istanbul ignore if */
  54582. if (isDef(on[RANGE_TOKEN])) {
  54583. // IE input[type=range] only supports `change` event
  54584. var event = isIE ? 'change' : 'input';
  54585. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  54586. delete on[RANGE_TOKEN];
  54587. }
  54588. // This was originally intended to fix #4521 but no longer necessary
  54589. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  54590. /* istanbul ignore if */
  54591. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  54592. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  54593. delete on[CHECKBOX_RADIO_TOKEN];
  54594. }
  54595. }
  54596. var target$1;
  54597. function createOnceHandler$1 (event, handler, capture) {
  54598. var _target = target$1; // save current target element in closure
  54599. return function onceHandler () {
  54600. var res = handler.apply(null, arguments);
  54601. if (res !== null) {
  54602. remove$2(event, onceHandler, capture, _target);
  54603. }
  54604. }
  54605. }
  54606. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  54607. // implementation and does not fire microtasks in between event propagation, so
  54608. // safe to exclude.
  54609. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  54610. function add$1 (
  54611. name,
  54612. handler,
  54613. capture,
  54614. passive
  54615. ) {
  54616. // async edge case #6566: inner click event triggers patch, event handler
  54617. // attached to outer element during patch, and triggered again. This
  54618. // happens because browsers fire microtask ticks between event propagation.
  54619. // the solution is simple: we save the timestamp when a handler is attached,
  54620. // and the handler would only fire if the event passed to it was fired
  54621. // AFTER it was attached.
  54622. if (useMicrotaskFix) {
  54623. var attachedTimestamp = currentFlushTimestamp;
  54624. var original = handler;
  54625. handler = original._wrapper = function (e) {
  54626. if (
  54627. // no bubbling, should always fire.
  54628. // this is just a safety net in case event.timeStamp is unreliable in
  54629. // certain weird environments...
  54630. e.target === e.currentTarget ||
  54631. // event is fired after handler attachment
  54632. e.timeStamp >= attachedTimestamp ||
  54633. // bail for environments that have buggy event.timeStamp implementations
  54634. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  54635. // #9681 QtWebEngine event.timeStamp is negative value
  54636. e.timeStamp <= 0 ||
  54637. // #9448 bail if event is fired in another document in a multi-page
  54638. // electron/nw.js app, since event.timeStamp will be using a different
  54639. // starting reference
  54640. e.target.ownerDocument !== document
  54641. ) {
  54642. return original.apply(this, arguments)
  54643. }
  54644. };
  54645. }
  54646. target$1.addEventListener(
  54647. name,
  54648. handler,
  54649. supportsPassive
  54650. ? { capture: capture, passive: passive }
  54651. : capture
  54652. );
  54653. }
  54654. function remove$2 (
  54655. name,
  54656. handler,
  54657. capture,
  54658. _target
  54659. ) {
  54660. (_target || target$1).removeEventListener(
  54661. name,
  54662. handler._wrapper || handler,
  54663. capture
  54664. );
  54665. }
  54666. function updateDOMListeners (oldVnode, vnode) {
  54667. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  54668. return
  54669. }
  54670. var on = vnode.data.on || {};
  54671. var oldOn = oldVnode.data.on || {};
  54672. target$1 = vnode.elm;
  54673. normalizeEvents(on);
  54674. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  54675. target$1 = undefined;
  54676. }
  54677. var events = {
  54678. create: updateDOMListeners,
  54679. update: updateDOMListeners
  54680. };
  54681. /* */
  54682. var svgContainer;
  54683. function updateDOMProps (oldVnode, vnode) {
  54684. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  54685. return
  54686. }
  54687. var key, cur;
  54688. var elm = vnode.elm;
  54689. var oldProps = oldVnode.data.domProps || {};
  54690. var props = vnode.data.domProps || {};
  54691. // clone observed objects, as the user probably wants to mutate it
  54692. if (isDef(props.__ob__)) {
  54693. props = vnode.data.domProps = extend({}, props);
  54694. }
  54695. for (key in oldProps) {
  54696. if (!(key in props)) {
  54697. elm[key] = '';
  54698. }
  54699. }
  54700. for (key in props) {
  54701. cur = props[key];
  54702. // ignore children if the node has textContent or innerHTML,
  54703. // as these will throw away existing DOM nodes and cause removal errors
  54704. // on subsequent patches (#3360)
  54705. if (key === 'textContent' || key === 'innerHTML') {
  54706. if (vnode.children) { vnode.children.length = 0; }
  54707. if (cur === oldProps[key]) { continue }
  54708. // #6601 work around Chrome version <= 55 bug where single textNode
  54709. // replaced by innerHTML/textContent retains its parentNode property
  54710. if (elm.childNodes.length === 1) {
  54711. elm.removeChild(elm.childNodes[0]);
  54712. }
  54713. }
  54714. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  54715. // store value as _value as well since
  54716. // non-string values will be stringified
  54717. elm._value = cur;
  54718. // avoid resetting cursor position when value is the same
  54719. var strCur = isUndef(cur) ? '' : String(cur);
  54720. if (shouldUpdateValue(elm, strCur)) {
  54721. elm.value = strCur;
  54722. }
  54723. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  54724. // IE doesn't support innerHTML for SVG elements
  54725. svgContainer = svgContainer || document.createElement('div');
  54726. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  54727. var svg = svgContainer.firstChild;
  54728. while (elm.firstChild) {
  54729. elm.removeChild(elm.firstChild);
  54730. }
  54731. while (svg.firstChild) {
  54732. elm.appendChild(svg.firstChild);
  54733. }
  54734. } else if (
  54735. // skip the update if old and new VDOM state is the same.
  54736. // `value` is handled separately because the DOM value may be temporarily
  54737. // out of sync with VDOM state due to focus, composition and modifiers.
  54738. // This #4521 by skipping the unnecesarry `checked` update.
  54739. cur !== oldProps[key]
  54740. ) {
  54741. // some property updates can throw
  54742. // e.g. `value` on <progress> w/ non-finite value
  54743. try {
  54744. elm[key] = cur;
  54745. } catch (e) {}
  54746. }
  54747. }
  54748. }
  54749. // check platforms/web/util/attrs.js acceptValue
  54750. function shouldUpdateValue (elm, checkVal) {
  54751. return (!elm.composing && (
  54752. elm.tagName === 'OPTION' ||
  54753. isNotInFocusAndDirty(elm, checkVal) ||
  54754. isDirtyWithModifiers(elm, checkVal)
  54755. ))
  54756. }
  54757. function isNotInFocusAndDirty (elm, checkVal) {
  54758. // return true when textbox (.number and .trim) loses focus and its value is
  54759. // not equal to the updated value
  54760. var notInFocus = true;
  54761. // #6157
  54762. // work around IE bug when accessing document.activeElement in an iframe
  54763. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  54764. return notInFocus && elm.value !== checkVal
  54765. }
  54766. function isDirtyWithModifiers (elm, newVal) {
  54767. var value = elm.value;
  54768. var modifiers = elm._vModifiers; // injected by v-model runtime
  54769. if (isDef(modifiers)) {
  54770. if (modifiers.number) {
  54771. return toNumber(value) !== toNumber(newVal)
  54772. }
  54773. if (modifiers.trim) {
  54774. return value.trim() !== newVal.trim()
  54775. }
  54776. }
  54777. return value !== newVal
  54778. }
  54779. var domProps = {
  54780. create: updateDOMProps,
  54781. update: updateDOMProps
  54782. };
  54783. /* */
  54784. var parseStyleText = cached(function (cssText) {
  54785. var res = {};
  54786. var listDelimiter = /;(?![^(]*\))/g;
  54787. var propertyDelimiter = /:(.+)/;
  54788. cssText.split(listDelimiter).forEach(function (item) {
  54789. if (item) {
  54790. var tmp = item.split(propertyDelimiter);
  54791. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  54792. }
  54793. });
  54794. return res
  54795. });
  54796. // merge static and dynamic style data on the same vnode
  54797. function normalizeStyleData (data) {
  54798. var style = normalizeStyleBinding(data.style);
  54799. // static style is pre-processed into an object during compilation
  54800. // and is always a fresh object, so it's safe to merge into it
  54801. return data.staticStyle
  54802. ? extend(data.staticStyle, style)
  54803. : style
  54804. }
  54805. // normalize possible array / string values into Object
  54806. function normalizeStyleBinding (bindingStyle) {
  54807. if (Array.isArray(bindingStyle)) {
  54808. return toObject(bindingStyle)
  54809. }
  54810. if (typeof bindingStyle === 'string') {
  54811. return parseStyleText(bindingStyle)
  54812. }
  54813. return bindingStyle
  54814. }
  54815. /**
  54816. * parent component style should be after child's
  54817. * so that parent component's style could override it
  54818. */
  54819. function getStyle (vnode, checkChild) {
  54820. var res = {};
  54821. var styleData;
  54822. if (checkChild) {
  54823. var childNode = vnode;
  54824. while (childNode.componentInstance) {
  54825. childNode = childNode.componentInstance._vnode;
  54826. if (
  54827. childNode && childNode.data &&
  54828. (styleData = normalizeStyleData(childNode.data))
  54829. ) {
  54830. extend(res, styleData);
  54831. }
  54832. }
  54833. }
  54834. if ((styleData = normalizeStyleData(vnode.data))) {
  54835. extend(res, styleData);
  54836. }
  54837. var parentNode = vnode;
  54838. while ((parentNode = parentNode.parent)) {
  54839. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  54840. extend(res, styleData);
  54841. }
  54842. }
  54843. return res
  54844. }
  54845. /* */
  54846. var cssVarRE = /^--/;
  54847. var importantRE = /\s*!important$/;
  54848. var setProp = function (el, name, val) {
  54849. /* istanbul ignore if */
  54850. if (cssVarRE.test(name)) {
  54851. el.style.setProperty(name, val);
  54852. } else if (importantRE.test(val)) {
  54853. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  54854. } else {
  54855. var normalizedName = normalize(name);
  54856. if (Array.isArray(val)) {
  54857. // Support values array created by autoprefixer, e.g.
  54858. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  54859. // Set them one by one, and the browser will only set those it can recognize
  54860. for (var i = 0, len = val.length; i < len; i++) {
  54861. el.style[normalizedName] = val[i];
  54862. }
  54863. } else {
  54864. el.style[normalizedName] = val;
  54865. }
  54866. }
  54867. };
  54868. var vendorNames = ['Webkit', 'Moz', 'ms'];
  54869. var emptyStyle;
  54870. var normalize = cached(function (prop) {
  54871. emptyStyle = emptyStyle || document.createElement('div').style;
  54872. prop = camelize(prop);
  54873. if (prop !== 'filter' && (prop in emptyStyle)) {
  54874. return prop
  54875. }
  54876. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  54877. for (var i = 0; i < vendorNames.length; i++) {
  54878. var name = vendorNames[i] + capName;
  54879. if (name in emptyStyle) {
  54880. return name
  54881. }
  54882. }
  54883. });
  54884. function updateStyle (oldVnode, vnode) {
  54885. var data = vnode.data;
  54886. var oldData = oldVnode.data;
  54887. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  54888. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  54889. ) {
  54890. return
  54891. }
  54892. var cur, name;
  54893. var el = vnode.elm;
  54894. var oldStaticStyle = oldData.staticStyle;
  54895. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  54896. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  54897. var oldStyle = oldStaticStyle || oldStyleBinding;
  54898. var style = normalizeStyleBinding(vnode.data.style) || {};
  54899. // store normalized style under a different key for next diff
  54900. // make sure to clone it if it's reactive, since the user likely wants
  54901. // to mutate it.
  54902. vnode.data.normalizedStyle = isDef(style.__ob__)
  54903. ? extend({}, style)
  54904. : style;
  54905. var newStyle = getStyle(vnode, true);
  54906. for (name in oldStyle) {
  54907. if (isUndef(newStyle[name])) {
  54908. setProp(el, name, '');
  54909. }
  54910. }
  54911. for (name in newStyle) {
  54912. cur = newStyle[name];
  54913. if (cur !== oldStyle[name]) {
  54914. // ie9 setting to null has no effect, must use empty string
  54915. setProp(el, name, cur == null ? '' : cur);
  54916. }
  54917. }
  54918. }
  54919. var style = {
  54920. create: updateStyle,
  54921. update: updateStyle
  54922. };
  54923. /* */
  54924. var whitespaceRE = /\s+/;
  54925. /**
  54926. * Add class with compatibility for SVG since classList is not supported on
  54927. * SVG elements in IE
  54928. */
  54929. function addClass (el, cls) {
  54930. /* istanbul ignore if */
  54931. if (!cls || !(cls = cls.trim())) {
  54932. return
  54933. }
  54934. /* istanbul ignore else */
  54935. if (el.classList) {
  54936. if (cls.indexOf(' ') > -1) {
  54937. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  54938. } else {
  54939. el.classList.add(cls);
  54940. }
  54941. } else {
  54942. var cur = " " + (el.getAttribute('class') || '') + " ";
  54943. if (cur.indexOf(' ' + cls + ' ') < 0) {
  54944. el.setAttribute('class', (cur + cls).trim());
  54945. }
  54946. }
  54947. }
  54948. /**
  54949. * Remove class with compatibility for SVG since classList is not supported on
  54950. * SVG elements in IE
  54951. */
  54952. function removeClass (el, cls) {
  54953. /* istanbul ignore if */
  54954. if (!cls || !(cls = cls.trim())) {
  54955. return
  54956. }
  54957. /* istanbul ignore else */
  54958. if (el.classList) {
  54959. if (cls.indexOf(' ') > -1) {
  54960. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  54961. } else {
  54962. el.classList.remove(cls);
  54963. }
  54964. if (!el.classList.length) {
  54965. el.removeAttribute('class');
  54966. }
  54967. } else {
  54968. var cur = " " + (el.getAttribute('class') || '') + " ";
  54969. var tar = ' ' + cls + ' ';
  54970. while (cur.indexOf(tar) >= 0) {
  54971. cur = cur.replace(tar, ' ');
  54972. }
  54973. cur = cur.trim();
  54974. if (cur) {
  54975. el.setAttribute('class', cur);
  54976. } else {
  54977. el.removeAttribute('class');
  54978. }
  54979. }
  54980. }
  54981. /* */
  54982. function resolveTransition (def$$1) {
  54983. if (!def$$1) {
  54984. return
  54985. }
  54986. /* istanbul ignore else */
  54987. if (typeof def$$1 === 'object') {
  54988. var res = {};
  54989. if (def$$1.css !== false) {
  54990. extend(res, autoCssTransition(def$$1.name || 'v'));
  54991. }
  54992. extend(res, def$$1);
  54993. return res
  54994. } else if (typeof def$$1 === 'string') {
  54995. return autoCssTransition(def$$1)
  54996. }
  54997. }
  54998. var autoCssTransition = cached(function (name) {
  54999. return {
  55000. enterClass: (name + "-enter"),
  55001. enterToClass: (name + "-enter-to"),
  55002. enterActiveClass: (name + "-enter-active"),
  55003. leaveClass: (name + "-leave"),
  55004. leaveToClass: (name + "-leave-to"),
  55005. leaveActiveClass: (name + "-leave-active")
  55006. }
  55007. });
  55008. var hasTransition = inBrowser && !isIE9;
  55009. var TRANSITION = 'transition';
  55010. var ANIMATION = 'animation';
  55011. // Transition property/event sniffing
  55012. var transitionProp = 'transition';
  55013. var transitionEndEvent = 'transitionend';
  55014. var animationProp = 'animation';
  55015. var animationEndEvent = 'animationend';
  55016. if (hasTransition) {
  55017. /* istanbul ignore if */
  55018. if (window.ontransitionend === undefined &&
  55019. window.onwebkittransitionend !== undefined
  55020. ) {
  55021. transitionProp = 'WebkitTransition';
  55022. transitionEndEvent = 'webkitTransitionEnd';
  55023. }
  55024. if (window.onanimationend === undefined &&
  55025. window.onwebkitanimationend !== undefined
  55026. ) {
  55027. animationProp = 'WebkitAnimation';
  55028. animationEndEvent = 'webkitAnimationEnd';
  55029. }
  55030. }
  55031. // binding to window is necessary to make hot reload work in IE in strict mode
  55032. var raf = inBrowser
  55033. ? window.requestAnimationFrame
  55034. ? window.requestAnimationFrame.bind(window)
  55035. : setTimeout
  55036. : /* istanbul ignore next */ function (fn) { return fn(); };
  55037. function nextFrame (fn) {
  55038. raf(function () {
  55039. raf(fn);
  55040. });
  55041. }
  55042. function addTransitionClass (el, cls) {
  55043. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  55044. if (transitionClasses.indexOf(cls) < 0) {
  55045. transitionClasses.push(cls);
  55046. addClass(el, cls);
  55047. }
  55048. }
  55049. function removeTransitionClass (el, cls) {
  55050. if (el._transitionClasses) {
  55051. remove(el._transitionClasses, cls);
  55052. }
  55053. removeClass(el, cls);
  55054. }
  55055. function whenTransitionEnds (
  55056. el,
  55057. expectedType,
  55058. cb
  55059. ) {
  55060. var ref = getTransitionInfo(el, expectedType);
  55061. var type = ref.type;
  55062. var timeout = ref.timeout;
  55063. var propCount = ref.propCount;
  55064. if (!type) { return cb() }
  55065. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  55066. var ended = 0;
  55067. var end = function () {
  55068. el.removeEventListener(event, onEnd);
  55069. cb();
  55070. };
  55071. var onEnd = function (e) {
  55072. if (e.target === el) {
  55073. if (++ended >= propCount) {
  55074. end();
  55075. }
  55076. }
  55077. };
  55078. setTimeout(function () {
  55079. if (ended < propCount) {
  55080. end();
  55081. }
  55082. }, timeout + 1);
  55083. el.addEventListener(event, onEnd);
  55084. }
  55085. var transformRE = /\b(transform|all)(,|$)/;
  55086. function getTransitionInfo (el, expectedType) {
  55087. var styles = window.getComputedStyle(el);
  55088. // JSDOM may return undefined for transition properties
  55089. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  55090. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  55091. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  55092. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  55093. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  55094. var animationTimeout = getTimeout(animationDelays, animationDurations);
  55095. var type;
  55096. var timeout = 0;
  55097. var propCount = 0;
  55098. /* istanbul ignore if */
  55099. if (expectedType === TRANSITION) {
  55100. if (transitionTimeout > 0) {
  55101. type = TRANSITION;
  55102. timeout = transitionTimeout;
  55103. propCount = transitionDurations.length;
  55104. }
  55105. } else if (expectedType === ANIMATION) {
  55106. if (animationTimeout > 0) {
  55107. type = ANIMATION;
  55108. timeout = animationTimeout;
  55109. propCount = animationDurations.length;
  55110. }
  55111. } else {
  55112. timeout = Math.max(transitionTimeout, animationTimeout);
  55113. type = timeout > 0
  55114. ? transitionTimeout > animationTimeout
  55115. ? TRANSITION
  55116. : ANIMATION
  55117. : null;
  55118. propCount = type
  55119. ? type === TRANSITION
  55120. ? transitionDurations.length
  55121. : animationDurations.length
  55122. : 0;
  55123. }
  55124. var hasTransform =
  55125. type === TRANSITION &&
  55126. transformRE.test(styles[transitionProp + 'Property']);
  55127. return {
  55128. type: type,
  55129. timeout: timeout,
  55130. propCount: propCount,
  55131. hasTransform: hasTransform
  55132. }
  55133. }
  55134. function getTimeout (delays, durations) {
  55135. /* istanbul ignore next */
  55136. while (delays.length < durations.length) {
  55137. delays = delays.concat(delays);
  55138. }
  55139. return Math.max.apply(null, durations.map(function (d, i) {
  55140. return toMs(d) + toMs(delays[i])
  55141. }))
  55142. }
  55143. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  55144. // in a locale-dependent way, using a comma instead of a dot.
  55145. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  55146. // as a floor function) causing unexpected behaviors
  55147. function toMs (s) {
  55148. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  55149. }
  55150. /* */
  55151. function enter (vnode, toggleDisplay) {
  55152. var el = vnode.elm;
  55153. // call leave callback now
  55154. if (isDef(el._leaveCb)) {
  55155. el._leaveCb.cancelled = true;
  55156. el._leaveCb();
  55157. }
  55158. var data = resolveTransition(vnode.data.transition);
  55159. if (isUndef(data)) {
  55160. return
  55161. }
  55162. /* istanbul ignore if */
  55163. if (isDef(el._enterCb) || el.nodeType !== 1) {
  55164. return
  55165. }
  55166. var css = data.css;
  55167. var type = data.type;
  55168. var enterClass = data.enterClass;
  55169. var enterToClass = data.enterToClass;
  55170. var enterActiveClass = data.enterActiveClass;
  55171. var appearClass = data.appearClass;
  55172. var appearToClass = data.appearToClass;
  55173. var appearActiveClass = data.appearActiveClass;
  55174. var beforeEnter = data.beforeEnter;
  55175. var enter = data.enter;
  55176. var afterEnter = data.afterEnter;
  55177. var enterCancelled = data.enterCancelled;
  55178. var beforeAppear = data.beforeAppear;
  55179. var appear = data.appear;
  55180. var afterAppear = data.afterAppear;
  55181. var appearCancelled = data.appearCancelled;
  55182. var duration = data.duration;
  55183. // activeInstance will always be the <transition> component managing this
  55184. // transition. One edge case to check is when the <transition> is placed
  55185. // as the root node of a child component. In that case we need to check
  55186. // <transition>'s parent for appear check.
  55187. var context = activeInstance;
  55188. var transitionNode = activeInstance.$vnode;
  55189. while (transitionNode && transitionNode.parent) {
  55190. context = transitionNode.context;
  55191. transitionNode = transitionNode.parent;
  55192. }
  55193. var isAppear = !context._isMounted || !vnode.isRootInsert;
  55194. if (isAppear && !appear && appear !== '') {
  55195. return
  55196. }
  55197. var startClass = isAppear && appearClass
  55198. ? appearClass
  55199. : enterClass;
  55200. var activeClass = isAppear && appearActiveClass
  55201. ? appearActiveClass
  55202. : enterActiveClass;
  55203. var toClass = isAppear && appearToClass
  55204. ? appearToClass
  55205. : enterToClass;
  55206. var beforeEnterHook = isAppear
  55207. ? (beforeAppear || beforeEnter)
  55208. : beforeEnter;
  55209. var enterHook = isAppear
  55210. ? (typeof appear === 'function' ? appear : enter)
  55211. : enter;
  55212. var afterEnterHook = isAppear
  55213. ? (afterAppear || afterEnter)
  55214. : afterEnter;
  55215. var enterCancelledHook = isAppear
  55216. ? (appearCancelled || enterCancelled)
  55217. : enterCancelled;
  55218. var explicitEnterDuration = toNumber(
  55219. isObject(duration)
  55220. ? duration.enter
  55221. : duration
  55222. );
  55223. if (explicitEnterDuration != null) {
  55224. checkDuration(explicitEnterDuration, 'enter', vnode);
  55225. }
  55226. var expectsCSS = css !== false && !isIE9;
  55227. var userWantsControl = getHookArgumentsLength(enterHook);
  55228. var cb = el._enterCb = once(function () {
  55229. if (expectsCSS) {
  55230. removeTransitionClass(el, toClass);
  55231. removeTransitionClass(el, activeClass);
  55232. }
  55233. if (cb.cancelled) {
  55234. if (expectsCSS) {
  55235. removeTransitionClass(el, startClass);
  55236. }
  55237. enterCancelledHook && enterCancelledHook(el);
  55238. } else {
  55239. afterEnterHook && afterEnterHook(el);
  55240. }
  55241. el._enterCb = null;
  55242. });
  55243. if (!vnode.data.show) {
  55244. // remove pending leave element on enter by injecting an insert hook
  55245. mergeVNodeHook(vnode, 'insert', function () {
  55246. var parent = el.parentNode;
  55247. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  55248. if (pendingNode &&
  55249. pendingNode.tag === vnode.tag &&
  55250. pendingNode.elm._leaveCb
  55251. ) {
  55252. pendingNode.elm._leaveCb();
  55253. }
  55254. enterHook && enterHook(el, cb);
  55255. });
  55256. }
  55257. // start enter transition
  55258. beforeEnterHook && beforeEnterHook(el);
  55259. if (expectsCSS) {
  55260. addTransitionClass(el, startClass);
  55261. addTransitionClass(el, activeClass);
  55262. nextFrame(function () {
  55263. removeTransitionClass(el, startClass);
  55264. if (!cb.cancelled) {
  55265. addTransitionClass(el, toClass);
  55266. if (!userWantsControl) {
  55267. if (isValidDuration(explicitEnterDuration)) {
  55268. setTimeout(cb, explicitEnterDuration);
  55269. } else {
  55270. whenTransitionEnds(el, type, cb);
  55271. }
  55272. }
  55273. }
  55274. });
  55275. }
  55276. if (vnode.data.show) {
  55277. toggleDisplay && toggleDisplay();
  55278. enterHook && enterHook(el, cb);
  55279. }
  55280. if (!expectsCSS && !userWantsControl) {
  55281. cb();
  55282. }
  55283. }
  55284. function leave (vnode, rm) {
  55285. var el = vnode.elm;
  55286. // call enter callback now
  55287. if (isDef(el._enterCb)) {
  55288. el._enterCb.cancelled = true;
  55289. el._enterCb();
  55290. }
  55291. var data = resolveTransition(vnode.data.transition);
  55292. if (isUndef(data) || el.nodeType !== 1) {
  55293. return rm()
  55294. }
  55295. /* istanbul ignore if */
  55296. if (isDef(el._leaveCb)) {
  55297. return
  55298. }
  55299. var css = data.css;
  55300. var type = data.type;
  55301. var leaveClass = data.leaveClass;
  55302. var leaveToClass = data.leaveToClass;
  55303. var leaveActiveClass = data.leaveActiveClass;
  55304. var beforeLeave = data.beforeLeave;
  55305. var leave = data.leave;
  55306. var afterLeave = data.afterLeave;
  55307. var leaveCancelled = data.leaveCancelled;
  55308. var delayLeave = data.delayLeave;
  55309. var duration = data.duration;
  55310. var expectsCSS = css !== false && !isIE9;
  55311. var userWantsControl = getHookArgumentsLength(leave);
  55312. var explicitLeaveDuration = toNumber(
  55313. isObject(duration)
  55314. ? duration.leave
  55315. : duration
  55316. );
  55317. if (isDef(explicitLeaveDuration)) {
  55318. checkDuration(explicitLeaveDuration, 'leave', vnode);
  55319. }
  55320. var cb = el._leaveCb = once(function () {
  55321. if (el.parentNode && el.parentNode._pending) {
  55322. el.parentNode._pending[vnode.key] = null;
  55323. }
  55324. if (expectsCSS) {
  55325. removeTransitionClass(el, leaveToClass);
  55326. removeTransitionClass(el, leaveActiveClass);
  55327. }
  55328. if (cb.cancelled) {
  55329. if (expectsCSS) {
  55330. removeTransitionClass(el, leaveClass);
  55331. }
  55332. leaveCancelled && leaveCancelled(el);
  55333. } else {
  55334. rm();
  55335. afterLeave && afterLeave(el);
  55336. }
  55337. el._leaveCb = null;
  55338. });
  55339. if (delayLeave) {
  55340. delayLeave(performLeave);
  55341. } else {
  55342. performLeave();
  55343. }
  55344. function performLeave () {
  55345. // the delayed leave may have already been cancelled
  55346. if (cb.cancelled) {
  55347. return
  55348. }
  55349. // record leaving element
  55350. if (!vnode.data.show && el.parentNode) {
  55351. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  55352. }
  55353. beforeLeave && beforeLeave(el);
  55354. if (expectsCSS) {
  55355. addTransitionClass(el, leaveClass);
  55356. addTransitionClass(el, leaveActiveClass);
  55357. nextFrame(function () {
  55358. removeTransitionClass(el, leaveClass);
  55359. if (!cb.cancelled) {
  55360. addTransitionClass(el, leaveToClass);
  55361. if (!userWantsControl) {
  55362. if (isValidDuration(explicitLeaveDuration)) {
  55363. setTimeout(cb, explicitLeaveDuration);
  55364. } else {
  55365. whenTransitionEnds(el, type, cb);
  55366. }
  55367. }
  55368. }
  55369. });
  55370. }
  55371. leave && leave(el, cb);
  55372. if (!expectsCSS && !userWantsControl) {
  55373. cb();
  55374. }
  55375. }
  55376. }
  55377. // only used in dev mode
  55378. function checkDuration (val, name, vnode) {
  55379. if (typeof val !== 'number') {
  55380. warn(
  55381. "<transition> explicit " + name + " duration is not a valid number - " +
  55382. "got " + (JSON.stringify(val)) + ".",
  55383. vnode.context
  55384. );
  55385. } else if (isNaN(val)) {
  55386. warn(
  55387. "<transition> explicit " + name + " duration is NaN - " +
  55388. 'the duration expression might be incorrect.',
  55389. vnode.context
  55390. );
  55391. }
  55392. }
  55393. function isValidDuration (val) {
  55394. return typeof val === 'number' && !isNaN(val)
  55395. }
  55396. /**
  55397. * Normalize a transition hook's argument length. The hook may be:
  55398. * - a merged hook (invoker) with the original in .fns
  55399. * - a wrapped component method (check ._length)
  55400. * - a plain function (.length)
  55401. */
  55402. function getHookArgumentsLength (fn) {
  55403. if (isUndef(fn)) {
  55404. return false
  55405. }
  55406. var invokerFns = fn.fns;
  55407. if (isDef(invokerFns)) {
  55408. // invoker
  55409. return getHookArgumentsLength(
  55410. Array.isArray(invokerFns)
  55411. ? invokerFns[0]
  55412. : invokerFns
  55413. )
  55414. } else {
  55415. return (fn._length || fn.length) > 1
  55416. }
  55417. }
  55418. function _enter (_, vnode) {
  55419. if (vnode.data.show !== true) {
  55420. enter(vnode);
  55421. }
  55422. }
  55423. var transition = inBrowser ? {
  55424. create: _enter,
  55425. activate: _enter,
  55426. remove: function remove$$1 (vnode, rm) {
  55427. /* istanbul ignore else */
  55428. if (vnode.data.show !== true) {
  55429. leave(vnode, rm);
  55430. } else {
  55431. rm();
  55432. }
  55433. }
  55434. } : {};
  55435. var platformModules = [
  55436. attrs,
  55437. klass,
  55438. events,
  55439. domProps,
  55440. style,
  55441. transition
  55442. ];
  55443. /* */
  55444. // the directive module should be applied last, after all
  55445. // built-in modules have been applied.
  55446. var modules = platformModules.concat(baseModules);
  55447. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  55448. /**
  55449. * Not type checking this file because flow doesn't like attaching
  55450. * properties to Elements.
  55451. */
  55452. /* istanbul ignore if */
  55453. if (isIE9) {
  55454. // http://www.matts411.com/post/internet-explorer-9-oninput/
  55455. document.addEventListener('selectionchange', function () {
  55456. var el = document.activeElement;
  55457. if (el && el.vmodel) {
  55458. trigger(el, 'input');
  55459. }
  55460. });
  55461. }
  55462. var directive = {
  55463. inserted: function inserted (el, binding, vnode, oldVnode) {
  55464. if (vnode.tag === 'select') {
  55465. // #6903
  55466. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  55467. mergeVNodeHook(vnode, 'postpatch', function () {
  55468. directive.componentUpdated(el, binding, vnode);
  55469. });
  55470. } else {
  55471. setSelected(el, binding, vnode.context);
  55472. }
  55473. el._vOptions = [].map.call(el.options, getValue);
  55474. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  55475. el._vModifiers = binding.modifiers;
  55476. if (!binding.modifiers.lazy) {
  55477. el.addEventListener('compositionstart', onCompositionStart);
  55478. el.addEventListener('compositionend', onCompositionEnd);
  55479. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  55480. // switching focus before confirming composition choice
  55481. // this also fixes the issue where some browsers e.g. iOS Chrome
  55482. // fires "change" instead of "input" on autocomplete.
  55483. el.addEventListener('change', onCompositionEnd);
  55484. /* istanbul ignore if */
  55485. if (isIE9) {
  55486. el.vmodel = true;
  55487. }
  55488. }
  55489. }
  55490. },
  55491. componentUpdated: function componentUpdated (el, binding, vnode) {
  55492. if (vnode.tag === 'select') {
  55493. setSelected(el, binding, vnode.context);
  55494. // in case the options rendered by v-for have changed,
  55495. // it's possible that the value is out-of-sync with the rendered options.
  55496. // detect such cases and filter out values that no longer has a matching
  55497. // option in the DOM.
  55498. var prevOptions = el._vOptions;
  55499. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  55500. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  55501. // trigger change event if
  55502. // no matching option found for at least one value
  55503. var needReset = el.multiple
  55504. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  55505. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  55506. if (needReset) {
  55507. trigger(el, 'change');
  55508. }
  55509. }
  55510. }
  55511. }
  55512. };
  55513. function setSelected (el, binding, vm) {
  55514. actuallySetSelected(el, binding, vm);
  55515. /* istanbul ignore if */
  55516. if (isIE || isEdge) {
  55517. setTimeout(function () {
  55518. actuallySetSelected(el, binding, vm);
  55519. }, 0);
  55520. }
  55521. }
  55522. function actuallySetSelected (el, binding, vm) {
  55523. var value = binding.value;
  55524. var isMultiple = el.multiple;
  55525. if (isMultiple && !Array.isArray(value)) {
  55526. warn(
  55527. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  55528. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  55529. vm
  55530. );
  55531. return
  55532. }
  55533. var selected, option;
  55534. for (var i = 0, l = el.options.length; i < l; i++) {
  55535. option = el.options[i];
  55536. if (isMultiple) {
  55537. selected = looseIndexOf(value, getValue(option)) > -1;
  55538. if (option.selected !== selected) {
  55539. option.selected = selected;
  55540. }
  55541. } else {
  55542. if (looseEqual(getValue(option), value)) {
  55543. if (el.selectedIndex !== i) {
  55544. el.selectedIndex = i;
  55545. }
  55546. return
  55547. }
  55548. }
  55549. }
  55550. if (!isMultiple) {
  55551. el.selectedIndex = -1;
  55552. }
  55553. }
  55554. function hasNoMatchingOption (value, options) {
  55555. return options.every(function (o) { return !looseEqual(o, value); })
  55556. }
  55557. function getValue (option) {
  55558. return '_value' in option
  55559. ? option._value
  55560. : option.value
  55561. }
  55562. function onCompositionStart (e) {
  55563. e.target.composing = true;
  55564. }
  55565. function onCompositionEnd (e) {
  55566. // prevent triggering an input event for no reason
  55567. if (!e.target.composing) { return }
  55568. e.target.composing = false;
  55569. trigger(e.target, 'input');
  55570. }
  55571. function trigger (el, type) {
  55572. var e = document.createEvent('HTMLEvents');
  55573. e.initEvent(type, true, true);
  55574. el.dispatchEvent(e);
  55575. }
  55576. /* */
  55577. // recursively search for possible transition defined inside the component root
  55578. function locateNode (vnode) {
  55579. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  55580. ? locateNode(vnode.componentInstance._vnode)
  55581. : vnode
  55582. }
  55583. var show = {
  55584. bind: function bind (el, ref, vnode) {
  55585. var value = ref.value;
  55586. vnode = locateNode(vnode);
  55587. var transition$$1 = vnode.data && vnode.data.transition;
  55588. var originalDisplay = el.__vOriginalDisplay =
  55589. el.style.display === 'none' ? '' : el.style.display;
  55590. if (value && transition$$1) {
  55591. vnode.data.show = true;
  55592. enter(vnode, function () {
  55593. el.style.display = originalDisplay;
  55594. });
  55595. } else {
  55596. el.style.display = value ? originalDisplay : 'none';
  55597. }
  55598. },
  55599. update: function update (el, ref, vnode) {
  55600. var value = ref.value;
  55601. var oldValue = ref.oldValue;
  55602. /* istanbul ignore if */
  55603. if (!value === !oldValue) { return }
  55604. vnode = locateNode(vnode);
  55605. var transition$$1 = vnode.data && vnode.data.transition;
  55606. if (transition$$1) {
  55607. vnode.data.show = true;
  55608. if (value) {
  55609. enter(vnode, function () {
  55610. el.style.display = el.__vOriginalDisplay;
  55611. });
  55612. } else {
  55613. leave(vnode, function () {
  55614. el.style.display = 'none';
  55615. });
  55616. }
  55617. } else {
  55618. el.style.display = value ? el.__vOriginalDisplay : 'none';
  55619. }
  55620. },
  55621. unbind: function unbind (
  55622. el,
  55623. binding,
  55624. vnode,
  55625. oldVnode,
  55626. isDestroy
  55627. ) {
  55628. if (!isDestroy) {
  55629. el.style.display = el.__vOriginalDisplay;
  55630. }
  55631. }
  55632. };
  55633. var platformDirectives = {
  55634. model: directive,
  55635. show: show
  55636. };
  55637. /* */
  55638. var transitionProps = {
  55639. name: String,
  55640. appear: Boolean,
  55641. css: Boolean,
  55642. mode: String,
  55643. type: String,
  55644. enterClass: String,
  55645. leaveClass: String,
  55646. enterToClass: String,
  55647. leaveToClass: String,
  55648. enterActiveClass: String,
  55649. leaveActiveClass: String,
  55650. appearClass: String,
  55651. appearActiveClass: String,
  55652. appearToClass: String,
  55653. duration: [Number, String, Object]
  55654. };
  55655. // in case the child is also an abstract component, e.g. <keep-alive>
  55656. // we want to recursively retrieve the real component to be rendered
  55657. function getRealChild (vnode) {
  55658. var compOptions = vnode && vnode.componentOptions;
  55659. if (compOptions && compOptions.Ctor.options.abstract) {
  55660. return getRealChild(getFirstComponentChild(compOptions.children))
  55661. } else {
  55662. return vnode
  55663. }
  55664. }
  55665. function extractTransitionData (comp) {
  55666. var data = {};
  55667. var options = comp.$options;
  55668. // props
  55669. for (var key in options.propsData) {
  55670. data[key] = comp[key];
  55671. }
  55672. // events.
  55673. // extract listeners and pass them directly to the transition methods
  55674. var listeners = options._parentListeners;
  55675. for (var key$1 in listeners) {
  55676. data[camelize(key$1)] = listeners[key$1];
  55677. }
  55678. return data
  55679. }
  55680. function placeholder (h, rawChild) {
  55681. if (/\d-keep-alive$/.test(rawChild.tag)) {
  55682. return h('keep-alive', {
  55683. props: rawChild.componentOptions.propsData
  55684. })
  55685. }
  55686. }
  55687. function hasParentTransition (vnode) {
  55688. while ((vnode = vnode.parent)) {
  55689. if (vnode.data.transition) {
  55690. return true
  55691. }
  55692. }
  55693. }
  55694. function isSameChild (child, oldChild) {
  55695. return oldChild.key === child.key && oldChild.tag === child.tag
  55696. }
  55697. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  55698. var isVShowDirective = function (d) { return d.name === 'show'; };
  55699. var Transition = {
  55700. name: 'transition',
  55701. props: transitionProps,
  55702. abstract: true,
  55703. render: function render (h) {
  55704. var this$1 = this;
  55705. var children = this.$slots.default;
  55706. if (!children) {
  55707. return
  55708. }
  55709. // filter out text nodes (possible whitespaces)
  55710. children = children.filter(isNotTextNode);
  55711. /* istanbul ignore if */
  55712. if (!children.length) {
  55713. return
  55714. }
  55715. // warn multiple elements
  55716. if (children.length > 1) {
  55717. warn(
  55718. '<transition> can only be used on a single element. Use ' +
  55719. '<transition-group> for lists.',
  55720. this.$parent
  55721. );
  55722. }
  55723. var mode = this.mode;
  55724. // warn invalid mode
  55725. if (mode && mode !== 'in-out' && mode !== 'out-in'
  55726. ) {
  55727. warn(
  55728. 'invalid <transition> mode: ' + mode,
  55729. this.$parent
  55730. );
  55731. }
  55732. var rawChild = children[0];
  55733. // if this is a component root node and the component's
  55734. // parent container node also has transition, skip.
  55735. if (hasParentTransition(this.$vnode)) {
  55736. return rawChild
  55737. }
  55738. // apply transition data to child
  55739. // use getRealChild() to ignore abstract components e.g. keep-alive
  55740. var child = getRealChild(rawChild);
  55741. /* istanbul ignore if */
  55742. if (!child) {
  55743. return rawChild
  55744. }
  55745. if (this._leaving) {
  55746. return placeholder(h, rawChild)
  55747. }
  55748. // ensure a key that is unique to the vnode type and to this transition
  55749. // component instance. This key will be used to remove pending leaving nodes
  55750. // during entering.
  55751. var id = "__transition-" + (this._uid) + "-";
  55752. child.key = child.key == null
  55753. ? child.isComment
  55754. ? id + 'comment'
  55755. : id + child.tag
  55756. : isPrimitive(child.key)
  55757. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  55758. : child.key;
  55759. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  55760. var oldRawChild = this._vnode;
  55761. var oldChild = getRealChild(oldRawChild);
  55762. // mark v-show
  55763. // so that the transition module can hand over the control to the directive
  55764. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  55765. child.data.show = true;
  55766. }
  55767. if (
  55768. oldChild &&
  55769. oldChild.data &&
  55770. !isSameChild(child, oldChild) &&
  55771. !isAsyncPlaceholder(oldChild) &&
  55772. // #6687 component root is a comment node
  55773. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  55774. ) {
  55775. // replace old child transition data with fresh one
  55776. // important for dynamic transitions!
  55777. var oldData = oldChild.data.transition = extend({}, data);
  55778. // handle transition mode
  55779. if (mode === 'out-in') {
  55780. // return placeholder node and queue update when leave finishes
  55781. this._leaving = true;
  55782. mergeVNodeHook(oldData, 'afterLeave', function () {
  55783. this$1._leaving = false;
  55784. this$1.$forceUpdate();
  55785. });
  55786. return placeholder(h, rawChild)
  55787. } else if (mode === 'in-out') {
  55788. if (isAsyncPlaceholder(child)) {
  55789. return oldRawChild
  55790. }
  55791. var delayedLeave;
  55792. var performLeave = function () { delayedLeave(); };
  55793. mergeVNodeHook(data, 'afterEnter', performLeave);
  55794. mergeVNodeHook(data, 'enterCancelled', performLeave);
  55795. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  55796. }
  55797. }
  55798. return rawChild
  55799. }
  55800. };
  55801. /* */
  55802. var props = extend({
  55803. tag: String,
  55804. moveClass: String
  55805. }, transitionProps);
  55806. delete props.mode;
  55807. var TransitionGroup = {
  55808. props: props,
  55809. beforeMount: function beforeMount () {
  55810. var this$1 = this;
  55811. var update = this._update;
  55812. this._update = function (vnode, hydrating) {
  55813. var restoreActiveInstance = setActiveInstance(this$1);
  55814. // force removing pass
  55815. this$1.__patch__(
  55816. this$1._vnode,
  55817. this$1.kept,
  55818. false, // hydrating
  55819. true // removeOnly (!important, avoids unnecessary moves)
  55820. );
  55821. this$1._vnode = this$1.kept;
  55822. restoreActiveInstance();
  55823. update.call(this$1, vnode, hydrating);
  55824. };
  55825. },
  55826. render: function render (h) {
  55827. var tag = this.tag || this.$vnode.data.tag || 'span';
  55828. var map = Object.create(null);
  55829. var prevChildren = this.prevChildren = this.children;
  55830. var rawChildren = this.$slots.default || [];
  55831. var children = this.children = [];
  55832. var transitionData = extractTransitionData(this);
  55833. for (var i = 0; i < rawChildren.length; i++) {
  55834. var c = rawChildren[i];
  55835. if (c.tag) {
  55836. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  55837. children.push(c);
  55838. map[c.key] = c
  55839. ;(c.data || (c.data = {})).transition = transitionData;
  55840. } else {
  55841. var opts = c.componentOptions;
  55842. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  55843. warn(("<transition-group> children must be keyed: <" + name + ">"));
  55844. }
  55845. }
  55846. }
  55847. if (prevChildren) {
  55848. var kept = [];
  55849. var removed = [];
  55850. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  55851. var c$1 = prevChildren[i$1];
  55852. c$1.data.transition = transitionData;
  55853. c$1.data.pos = c$1.elm.getBoundingClientRect();
  55854. if (map[c$1.key]) {
  55855. kept.push(c$1);
  55856. } else {
  55857. removed.push(c$1);
  55858. }
  55859. }
  55860. this.kept = h(tag, null, kept);
  55861. this.removed = removed;
  55862. }
  55863. return h(tag, null, children)
  55864. },
  55865. updated: function updated () {
  55866. var children = this.prevChildren;
  55867. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  55868. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  55869. return
  55870. }
  55871. // we divide the work into three loops to avoid mixing DOM reads and writes
  55872. // in each iteration - which helps prevent layout thrashing.
  55873. children.forEach(callPendingCbs);
  55874. children.forEach(recordPosition);
  55875. children.forEach(applyTranslation);
  55876. // force reflow to put everything in position
  55877. // assign to this to avoid being removed in tree-shaking
  55878. // $flow-disable-line
  55879. this._reflow = document.body.offsetHeight;
  55880. children.forEach(function (c) {
  55881. if (c.data.moved) {
  55882. var el = c.elm;
  55883. var s = el.style;
  55884. addTransitionClass(el, moveClass);
  55885. s.transform = s.WebkitTransform = s.transitionDuration = '';
  55886. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  55887. if (e && e.target !== el) {
  55888. return
  55889. }
  55890. if (!e || /transform$/.test(e.propertyName)) {
  55891. el.removeEventListener(transitionEndEvent, cb);
  55892. el._moveCb = null;
  55893. removeTransitionClass(el, moveClass);
  55894. }
  55895. });
  55896. }
  55897. });
  55898. },
  55899. methods: {
  55900. hasMove: function hasMove (el, moveClass) {
  55901. /* istanbul ignore if */
  55902. if (!hasTransition) {
  55903. return false
  55904. }
  55905. /* istanbul ignore if */
  55906. if (this._hasMove) {
  55907. return this._hasMove
  55908. }
  55909. // Detect whether an element with the move class applied has
  55910. // CSS transitions. Since the element may be inside an entering
  55911. // transition at this very moment, we make a clone of it and remove
  55912. // all other transition classes applied to ensure only the move class
  55913. // is applied.
  55914. var clone = el.cloneNode();
  55915. if (el._transitionClasses) {
  55916. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  55917. }
  55918. addClass(clone, moveClass);
  55919. clone.style.display = 'none';
  55920. this.$el.appendChild(clone);
  55921. var info = getTransitionInfo(clone);
  55922. this.$el.removeChild(clone);
  55923. return (this._hasMove = info.hasTransform)
  55924. }
  55925. }
  55926. };
  55927. function callPendingCbs (c) {
  55928. /* istanbul ignore if */
  55929. if (c.elm._moveCb) {
  55930. c.elm._moveCb();
  55931. }
  55932. /* istanbul ignore if */
  55933. if (c.elm._enterCb) {
  55934. c.elm._enterCb();
  55935. }
  55936. }
  55937. function recordPosition (c) {
  55938. c.data.newPos = c.elm.getBoundingClientRect();
  55939. }
  55940. function applyTranslation (c) {
  55941. var oldPos = c.data.pos;
  55942. var newPos = c.data.newPos;
  55943. var dx = oldPos.left - newPos.left;
  55944. var dy = oldPos.top - newPos.top;
  55945. if (dx || dy) {
  55946. c.data.moved = true;
  55947. var s = c.elm.style;
  55948. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  55949. s.transitionDuration = '0s';
  55950. }
  55951. }
  55952. var platformComponents = {
  55953. Transition: Transition,
  55954. TransitionGroup: TransitionGroup
  55955. };
  55956. /* */
  55957. // install platform specific utils
  55958. Vue.config.mustUseProp = mustUseProp;
  55959. Vue.config.isReservedTag = isReservedTag;
  55960. Vue.config.isReservedAttr = isReservedAttr;
  55961. Vue.config.getTagNamespace = getTagNamespace;
  55962. Vue.config.isUnknownElement = isUnknownElement;
  55963. // install platform runtime directives & components
  55964. extend(Vue.options.directives, platformDirectives);
  55965. extend(Vue.options.components, platformComponents);
  55966. // install platform patch function
  55967. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  55968. // public mount method
  55969. Vue.prototype.$mount = function (
  55970. el,
  55971. hydrating
  55972. ) {
  55973. el = el && inBrowser ? query(el) : undefined;
  55974. return mountComponent(this, el, hydrating)
  55975. };
  55976. // devtools global hook
  55977. /* istanbul ignore next */
  55978. if (inBrowser) {
  55979. setTimeout(function () {
  55980. if (config.devtools) {
  55981. if (devtools) {
  55982. devtools.emit('init', Vue);
  55983. } else {
  55984. console[console.info ? 'info' : 'log'](
  55985. 'Download the Vue Devtools extension for a better development experience:\n' +
  55986. 'https://github.com/vuejs/vue-devtools'
  55987. );
  55988. }
  55989. }
  55990. if (config.productionTip !== false &&
  55991. typeof console !== 'undefined'
  55992. ) {
  55993. console[console.info ? 'info' : 'log'](
  55994. "You are running Vue in development mode.\n" +
  55995. "Make sure to turn on production mode when deploying for production.\n" +
  55996. "See more tips at https://vuejs.org/guide/deployment.html"
  55997. );
  55998. }
  55999. }, 0);
  56000. }
  56001. /* */
  56002. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  56003. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  56004. var buildRegex = cached(function (delimiters) {
  56005. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  56006. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  56007. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  56008. });
  56009. function parseText (
  56010. text,
  56011. delimiters
  56012. ) {
  56013. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  56014. if (!tagRE.test(text)) {
  56015. return
  56016. }
  56017. var tokens = [];
  56018. var rawTokens = [];
  56019. var lastIndex = tagRE.lastIndex = 0;
  56020. var match, index, tokenValue;
  56021. while ((match = tagRE.exec(text))) {
  56022. index = match.index;
  56023. // push text token
  56024. if (index > lastIndex) {
  56025. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  56026. tokens.push(JSON.stringify(tokenValue));
  56027. }
  56028. // tag token
  56029. var exp = parseFilters(match[1].trim());
  56030. tokens.push(("_s(" + exp + ")"));
  56031. rawTokens.push({ '@binding': exp });
  56032. lastIndex = index + match[0].length;
  56033. }
  56034. if (lastIndex < text.length) {
  56035. rawTokens.push(tokenValue = text.slice(lastIndex));
  56036. tokens.push(JSON.stringify(tokenValue));
  56037. }
  56038. return {
  56039. expression: tokens.join('+'),
  56040. tokens: rawTokens
  56041. }
  56042. }
  56043. /* */
  56044. function transformNode (el, options) {
  56045. var warn = options.warn || baseWarn;
  56046. var staticClass = getAndRemoveAttr(el, 'class');
  56047. if (staticClass) {
  56048. var res = parseText(staticClass, options.delimiters);
  56049. if (res) {
  56050. warn(
  56051. "class=\"" + staticClass + "\": " +
  56052. 'Interpolation inside attributes has been removed. ' +
  56053. 'Use v-bind or the colon shorthand instead. For example, ' +
  56054. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  56055. el.rawAttrsMap['class']
  56056. );
  56057. }
  56058. }
  56059. if (staticClass) {
  56060. el.staticClass = JSON.stringify(staticClass);
  56061. }
  56062. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  56063. if (classBinding) {
  56064. el.classBinding = classBinding;
  56065. }
  56066. }
  56067. function genData (el) {
  56068. var data = '';
  56069. if (el.staticClass) {
  56070. data += "staticClass:" + (el.staticClass) + ",";
  56071. }
  56072. if (el.classBinding) {
  56073. data += "class:" + (el.classBinding) + ",";
  56074. }
  56075. return data
  56076. }
  56077. var klass$1 = {
  56078. staticKeys: ['staticClass'],
  56079. transformNode: transformNode,
  56080. genData: genData
  56081. };
  56082. /* */
  56083. function transformNode$1 (el, options) {
  56084. var warn = options.warn || baseWarn;
  56085. var staticStyle = getAndRemoveAttr(el, 'style');
  56086. if (staticStyle) {
  56087. /* istanbul ignore if */
  56088. {
  56089. var res = parseText(staticStyle, options.delimiters);
  56090. if (res) {
  56091. warn(
  56092. "style=\"" + staticStyle + "\": " +
  56093. 'Interpolation inside attributes has been removed. ' +
  56094. 'Use v-bind or the colon shorthand instead. For example, ' +
  56095. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  56096. el.rawAttrsMap['style']
  56097. );
  56098. }
  56099. }
  56100. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  56101. }
  56102. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  56103. if (styleBinding) {
  56104. el.styleBinding = styleBinding;
  56105. }
  56106. }
  56107. function genData$1 (el) {
  56108. var data = '';
  56109. if (el.staticStyle) {
  56110. data += "staticStyle:" + (el.staticStyle) + ",";
  56111. }
  56112. if (el.styleBinding) {
  56113. data += "style:(" + (el.styleBinding) + "),";
  56114. }
  56115. return data
  56116. }
  56117. var style$1 = {
  56118. staticKeys: ['staticStyle'],
  56119. transformNode: transformNode$1,
  56120. genData: genData$1
  56121. };
  56122. /* */
  56123. var decoder;
  56124. var he = {
  56125. decode: function decode (html) {
  56126. decoder = decoder || document.createElement('div');
  56127. decoder.innerHTML = html;
  56128. return decoder.textContent
  56129. }
  56130. };
  56131. /* */
  56132. var isUnaryTag = makeMap(
  56133. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  56134. 'link,meta,param,source,track,wbr'
  56135. );
  56136. // Elements that you can, intentionally, leave open
  56137. // (and which close themselves)
  56138. var canBeLeftOpenTag = makeMap(
  56139. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  56140. );
  56141. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  56142. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  56143. var isNonPhrasingTag = makeMap(
  56144. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  56145. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  56146. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  56147. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  56148. 'title,tr,track'
  56149. );
  56150. /**
  56151. * Not type-checking this file because it's mostly vendor code.
  56152. */
  56153. // Regular Expressions for parsing tags and attributes
  56154. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56155. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56156. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  56157. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  56158. var startTagOpen = new RegExp(("^<" + qnameCapture));
  56159. var startTagClose = /^\s*(\/?)>/;
  56160. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  56161. var doctype = /^<!DOCTYPE [^>]+>/i;
  56162. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  56163. var comment = /^<!\--/;
  56164. var conditionalComment = /^<!\[/;
  56165. // Special Elements (can contain anything)
  56166. var isPlainTextElement = makeMap('script,style,textarea', true);
  56167. var reCache = {};
  56168. var decodingMap = {
  56169. '&lt;': '<',
  56170. '&gt;': '>',
  56171. '&quot;': '"',
  56172. '&amp;': '&',
  56173. '&#10;': '\n',
  56174. '&#9;': '\t',
  56175. '&#39;': "'"
  56176. };
  56177. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  56178. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  56179. // #5992
  56180. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  56181. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  56182. function decodeAttr (value, shouldDecodeNewlines) {
  56183. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  56184. return value.replace(re, function (match) { return decodingMap[match]; })
  56185. }
  56186. function parseHTML (html, options) {
  56187. var stack = [];
  56188. var expectHTML = options.expectHTML;
  56189. var isUnaryTag$$1 = options.isUnaryTag || no;
  56190. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  56191. var index = 0;
  56192. var last, lastTag;
  56193. while (html) {
  56194. last = html;
  56195. // Make sure we're not in a plaintext content element like script/style
  56196. if (!lastTag || !isPlainTextElement(lastTag)) {
  56197. var textEnd = html.indexOf('<');
  56198. if (textEnd === 0) {
  56199. // Comment:
  56200. if (comment.test(html)) {
  56201. var commentEnd = html.indexOf('-->');
  56202. if (commentEnd >= 0) {
  56203. if (options.shouldKeepComment) {
  56204. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  56205. }
  56206. advance(commentEnd + 3);
  56207. continue
  56208. }
  56209. }
  56210. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  56211. if (conditionalComment.test(html)) {
  56212. var conditionalEnd = html.indexOf(']>');
  56213. if (conditionalEnd >= 0) {
  56214. advance(conditionalEnd + 2);
  56215. continue
  56216. }
  56217. }
  56218. // Doctype:
  56219. var doctypeMatch = html.match(doctype);
  56220. if (doctypeMatch) {
  56221. advance(doctypeMatch[0].length);
  56222. continue
  56223. }
  56224. // End tag:
  56225. var endTagMatch = html.match(endTag);
  56226. if (endTagMatch) {
  56227. var curIndex = index;
  56228. advance(endTagMatch[0].length);
  56229. parseEndTag(endTagMatch[1], curIndex, index);
  56230. continue
  56231. }
  56232. // Start tag:
  56233. var startTagMatch = parseStartTag();
  56234. if (startTagMatch) {
  56235. handleStartTag(startTagMatch);
  56236. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  56237. advance(1);
  56238. }
  56239. continue
  56240. }
  56241. }
  56242. var text = (void 0), rest = (void 0), next = (void 0);
  56243. if (textEnd >= 0) {
  56244. rest = html.slice(textEnd);
  56245. while (
  56246. !endTag.test(rest) &&
  56247. !startTagOpen.test(rest) &&
  56248. !comment.test(rest) &&
  56249. !conditionalComment.test(rest)
  56250. ) {
  56251. // < in plain text, be forgiving and treat it as text
  56252. next = rest.indexOf('<', 1);
  56253. if (next < 0) { break }
  56254. textEnd += next;
  56255. rest = html.slice(textEnd);
  56256. }
  56257. text = html.substring(0, textEnd);
  56258. }
  56259. if (textEnd < 0) {
  56260. text = html;
  56261. }
  56262. if (text) {
  56263. advance(text.length);
  56264. }
  56265. if (options.chars && text) {
  56266. options.chars(text, index - text.length, index);
  56267. }
  56268. } else {
  56269. var endTagLength = 0;
  56270. var stackedTag = lastTag.toLowerCase();
  56271. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  56272. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  56273. endTagLength = endTag.length;
  56274. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  56275. text = text
  56276. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  56277. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  56278. }
  56279. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  56280. text = text.slice(1);
  56281. }
  56282. if (options.chars) {
  56283. options.chars(text);
  56284. }
  56285. return ''
  56286. });
  56287. index += html.length - rest$1.length;
  56288. html = rest$1;
  56289. parseEndTag(stackedTag, index - endTagLength, index);
  56290. }
  56291. if (html === last) {
  56292. options.chars && options.chars(html);
  56293. if (!stack.length && options.warn) {
  56294. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  56295. }
  56296. break
  56297. }
  56298. }
  56299. // Clean up any remaining tags
  56300. parseEndTag();
  56301. function advance (n) {
  56302. index += n;
  56303. html = html.substring(n);
  56304. }
  56305. function parseStartTag () {
  56306. var start = html.match(startTagOpen);
  56307. if (start) {
  56308. var match = {
  56309. tagName: start[1],
  56310. attrs: [],
  56311. start: index
  56312. };
  56313. advance(start[0].length);
  56314. var end, attr;
  56315. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  56316. attr.start = index;
  56317. advance(attr[0].length);
  56318. attr.end = index;
  56319. match.attrs.push(attr);
  56320. }
  56321. if (end) {
  56322. match.unarySlash = end[1];
  56323. advance(end[0].length);
  56324. match.end = index;
  56325. return match
  56326. }
  56327. }
  56328. }
  56329. function handleStartTag (match) {
  56330. var tagName = match.tagName;
  56331. var unarySlash = match.unarySlash;
  56332. if (expectHTML) {
  56333. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  56334. parseEndTag(lastTag);
  56335. }
  56336. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  56337. parseEndTag(tagName);
  56338. }
  56339. }
  56340. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  56341. var l = match.attrs.length;
  56342. var attrs = new Array(l);
  56343. for (var i = 0; i < l; i++) {
  56344. var args = match.attrs[i];
  56345. var value = args[3] || args[4] || args[5] || '';
  56346. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  56347. ? options.shouldDecodeNewlinesForHref
  56348. : options.shouldDecodeNewlines;
  56349. attrs[i] = {
  56350. name: args[1],
  56351. value: decodeAttr(value, shouldDecodeNewlines)
  56352. };
  56353. if (options.outputSourceRange) {
  56354. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  56355. attrs[i].end = args.end;
  56356. }
  56357. }
  56358. if (!unary) {
  56359. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  56360. lastTag = tagName;
  56361. }
  56362. if (options.start) {
  56363. options.start(tagName, attrs, unary, match.start, match.end);
  56364. }
  56365. }
  56366. function parseEndTag (tagName, start, end) {
  56367. var pos, lowerCasedTagName;
  56368. if (start == null) { start = index; }
  56369. if (end == null) { end = index; }
  56370. // Find the closest opened tag of the same type
  56371. if (tagName) {
  56372. lowerCasedTagName = tagName.toLowerCase();
  56373. for (pos = stack.length - 1; pos >= 0; pos--) {
  56374. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  56375. break
  56376. }
  56377. }
  56378. } else {
  56379. // If no tag name is provided, clean shop
  56380. pos = 0;
  56381. }
  56382. if (pos >= 0) {
  56383. // Close all the open elements, up the stack
  56384. for (var i = stack.length - 1; i >= pos; i--) {
  56385. if (i > pos || !tagName &&
  56386. options.warn
  56387. ) {
  56388. options.warn(
  56389. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  56390. { start: stack[i].start, end: stack[i].end }
  56391. );
  56392. }
  56393. if (options.end) {
  56394. options.end(stack[i].tag, start, end);
  56395. }
  56396. }
  56397. // Remove the open elements from the stack
  56398. stack.length = pos;
  56399. lastTag = pos && stack[pos - 1].tag;
  56400. } else if (lowerCasedTagName === 'br') {
  56401. if (options.start) {
  56402. options.start(tagName, [], true, start, end);
  56403. }
  56404. } else if (lowerCasedTagName === 'p') {
  56405. if (options.start) {
  56406. options.start(tagName, [], false, start, end);
  56407. }
  56408. if (options.end) {
  56409. options.end(tagName, start, end);
  56410. }
  56411. }
  56412. }
  56413. }
  56414. /* */
  56415. var onRE = /^@|^v-on:/;
  56416. var dirRE = /^v-|^@|^:|^#/;
  56417. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  56418. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  56419. var stripParensRE = /^\(|\)$/g;
  56420. var dynamicArgRE = /^\[.*\]$/;
  56421. var argRE = /:(.*)$/;
  56422. var bindRE = /^:|^\.|^v-bind:/;
  56423. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  56424. var slotRE = /^v-slot(:|$)|^#/;
  56425. var lineBreakRE = /[\r\n]/;
  56426. var whitespaceRE$1 = /\s+/g;
  56427. var invalidAttributeRE = /[\s"'<>\/=]/;
  56428. var decodeHTMLCached = cached(he.decode);
  56429. var emptySlotScopeToken = "_empty_";
  56430. // configurable state
  56431. var warn$2;
  56432. var delimiters;
  56433. var transforms;
  56434. var preTransforms;
  56435. var postTransforms;
  56436. var platformIsPreTag;
  56437. var platformMustUseProp;
  56438. var platformGetTagNamespace;
  56439. var maybeComponent;
  56440. function createASTElement (
  56441. tag,
  56442. attrs,
  56443. parent
  56444. ) {
  56445. return {
  56446. type: 1,
  56447. tag: tag,
  56448. attrsList: attrs,
  56449. attrsMap: makeAttrsMap(attrs),
  56450. rawAttrsMap: {},
  56451. parent: parent,
  56452. children: []
  56453. }
  56454. }
  56455. /**
  56456. * Convert HTML string to AST.
  56457. */
  56458. function parse (
  56459. template,
  56460. options
  56461. ) {
  56462. warn$2 = options.warn || baseWarn;
  56463. platformIsPreTag = options.isPreTag || no;
  56464. platformMustUseProp = options.mustUseProp || no;
  56465. platformGetTagNamespace = options.getTagNamespace || no;
  56466. var isReservedTag = options.isReservedTag || no;
  56467. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  56468. transforms = pluckModuleFunction(options.modules, 'transformNode');
  56469. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  56470. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  56471. delimiters = options.delimiters;
  56472. var stack = [];
  56473. var preserveWhitespace = options.preserveWhitespace !== false;
  56474. var whitespaceOption = options.whitespace;
  56475. var root;
  56476. var currentParent;
  56477. var inVPre = false;
  56478. var inPre = false;
  56479. var warned = false;
  56480. function warnOnce (msg, range) {
  56481. if (!warned) {
  56482. warned = true;
  56483. warn$2(msg, range);
  56484. }
  56485. }
  56486. function closeElement (element) {
  56487. trimEndingWhitespace(element);
  56488. if (!inVPre && !element.processed) {
  56489. element = processElement(element, options);
  56490. }
  56491. // tree management
  56492. if (!stack.length && element !== root) {
  56493. // allow root elements with v-if, v-else-if and v-else
  56494. if (root.if && (element.elseif || element.else)) {
  56495. {
  56496. checkRootConstraints(element);
  56497. }
  56498. addIfCondition(root, {
  56499. exp: element.elseif,
  56500. block: element
  56501. });
  56502. } else {
  56503. warnOnce(
  56504. "Component template should contain exactly one root element. " +
  56505. "If you are using v-if on multiple elements, " +
  56506. "use v-else-if to chain them instead.",
  56507. { start: element.start }
  56508. );
  56509. }
  56510. }
  56511. if (currentParent && !element.forbidden) {
  56512. if (element.elseif || element.else) {
  56513. processIfConditions(element, currentParent);
  56514. } else {
  56515. if (element.slotScope) {
  56516. // scoped slot
  56517. // keep it in the children list so that v-else(-if) conditions can
  56518. // find it as the prev node.
  56519. var name = element.slotTarget || '"default"'
  56520. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  56521. }
  56522. currentParent.children.push(element);
  56523. element.parent = currentParent;
  56524. }
  56525. }
  56526. // final children cleanup
  56527. // filter out scoped slots
  56528. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  56529. // remove trailing whitespace node again
  56530. trimEndingWhitespace(element);
  56531. // check pre state
  56532. if (element.pre) {
  56533. inVPre = false;
  56534. }
  56535. if (platformIsPreTag(element.tag)) {
  56536. inPre = false;
  56537. }
  56538. // apply post-transforms
  56539. for (var i = 0; i < postTransforms.length; i++) {
  56540. postTransforms[i](element, options);
  56541. }
  56542. }
  56543. function trimEndingWhitespace (el) {
  56544. // remove trailing whitespace node
  56545. if (!inPre) {
  56546. var lastNode;
  56547. while (
  56548. (lastNode = el.children[el.children.length - 1]) &&
  56549. lastNode.type === 3 &&
  56550. lastNode.text === ' '
  56551. ) {
  56552. el.children.pop();
  56553. }
  56554. }
  56555. }
  56556. function checkRootConstraints (el) {
  56557. if (el.tag === 'slot' || el.tag === 'template') {
  56558. warnOnce(
  56559. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  56560. 'contain multiple nodes.',
  56561. { start: el.start }
  56562. );
  56563. }
  56564. if (el.attrsMap.hasOwnProperty('v-for')) {
  56565. warnOnce(
  56566. 'Cannot use v-for on stateful component root element because ' +
  56567. 'it renders multiple elements.',
  56568. el.rawAttrsMap['v-for']
  56569. );
  56570. }
  56571. }
  56572. parseHTML(template, {
  56573. warn: warn$2,
  56574. expectHTML: options.expectHTML,
  56575. isUnaryTag: options.isUnaryTag,
  56576. canBeLeftOpenTag: options.canBeLeftOpenTag,
  56577. shouldDecodeNewlines: options.shouldDecodeNewlines,
  56578. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  56579. shouldKeepComment: options.comments,
  56580. outputSourceRange: options.outputSourceRange,
  56581. start: function start (tag, attrs, unary, start$1, end) {
  56582. // check namespace.
  56583. // inherit parent ns if there is one
  56584. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  56585. // handle IE svg bug
  56586. /* istanbul ignore if */
  56587. if (isIE && ns === 'svg') {
  56588. attrs = guardIESVGBug(attrs);
  56589. }
  56590. var element = createASTElement(tag, attrs, currentParent);
  56591. if (ns) {
  56592. element.ns = ns;
  56593. }
  56594. {
  56595. if (options.outputSourceRange) {
  56596. element.start = start$1;
  56597. element.end = end;
  56598. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  56599. cumulated[attr.name] = attr;
  56600. return cumulated
  56601. }, {});
  56602. }
  56603. attrs.forEach(function (attr) {
  56604. if (invalidAttributeRE.test(attr.name)) {
  56605. warn$2(
  56606. "Invalid dynamic argument expression: attribute names cannot contain " +
  56607. "spaces, quotes, <, >, / or =.",
  56608. {
  56609. start: attr.start + attr.name.indexOf("["),
  56610. end: attr.start + attr.name.length
  56611. }
  56612. );
  56613. }
  56614. });
  56615. }
  56616. if (isForbiddenTag(element) && !isServerRendering()) {
  56617. element.forbidden = true;
  56618. warn$2(
  56619. 'Templates should only be responsible for mapping the state to the ' +
  56620. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  56621. "<" + tag + ">" + ', as they will not be parsed.',
  56622. { start: element.start }
  56623. );
  56624. }
  56625. // apply pre-transforms
  56626. for (var i = 0; i < preTransforms.length; i++) {
  56627. element = preTransforms[i](element, options) || element;
  56628. }
  56629. if (!inVPre) {
  56630. processPre(element);
  56631. if (element.pre) {
  56632. inVPre = true;
  56633. }
  56634. }
  56635. if (platformIsPreTag(element.tag)) {
  56636. inPre = true;
  56637. }
  56638. if (inVPre) {
  56639. processRawAttrs(element);
  56640. } else if (!element.processed) {
  56641. // structural directives
  56642. processFor(element);
  56643. processIf(element);
  56644. processOnce(element);
  56645. }
  56646. if (!root) {
  56647. root = element;
  56648. {
  56649. checkRootConstraints(root);
  56650. }
  56651. }
  56652. if (!unary) {
  56653. currentParent = element;
  56654. stack.push(element);
  56655. } else {
  56656. closeElement(element);
  56657. }
  56658. },
  56659. end: function end (tag, start, end$1) {
  56660. var element = stack[stack.length - 1];
  56661. // pop stack
  56662. stack.length -= 1;
  56663. currentParent = stack[stack.length - 1];
  56664. if (options.outputSourceRange) {
  56665. element.end = end$1;
  56666. }
  56667. closeElement(element);
  56668. },
  56669. chars: function chars (text, start, end) {
  56670. if (!currentParent) {
  56671. {
  56672. if (text === template) {
  56673. warnOnce(
  56674. 'Component template requires a root element, rather than just text.',
  56675. { start: start }
  56676. );
  56677. } else if ((text = text.trim())) {
  56678. warnOnce(
  56679. ("text \"" + text + "\" outside root element will be ignored."),
  56680. { start: start }
  56681. );
  56682. }
  56683. }
  56684. return
  56685. }
  56686. // IE textarea placeholder bug
  56687. /* istanbul ignore if */
  56688. if (isIE &&
  56689. currentParent.tag === 'textarea' &&
  56690. currentParent.attrsMap.placeholder === text
  56691. ) {
  56692. return
  56693. }
  56694. var children = currentParent.children;
  56695. if (inPre || text.trim()) {
  56696. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  56697. } else if (!children.length) {
  56698. // remove the whitespace-only node right after an opening tag
  56699. text = '';
  56700. } else if (whitespaceOption) {
  56701. if (whitespaceOption === 'condense') {
  56702. // in condense mode, remove the whitespace node if it contains
  56703. // line break, otherwise condense to a single space
  56704. text = lineBreakRE.test(text) ? '' : ' ';
  56705. } else {
  56706. text = ' ';
  56707. }
  56708. } else {
  56709. text = preserveWhitespace ? ' ' : '';
  56710. }
  56711. if (text) {
  56712. if (!inPre && whitespaceOption === 'condense') {
  56713. // condense consecutive whitespaces into single space
  56714. text = text.replace(whitespaceRE$1, ' ');
  56715. }
  56716. var res;
  56717. var child;
  56718. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  56719. child = {
  56720. type: 2,
  56721. expression: res.expression,
  56722. tokens: res.tokens,
  56723. text: text
  56724. };
  56725. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  56726. child = {
  56727. type: 3,
  56728. text: text
  56729. };
  56730. }
  56731. if (child) {
  56732. if (options.outputSourceRange) {
  56733. child.start = start;
  56734. child.end = end;
  56735. }
  56736. children.push(child);
  56737. }
  56738. }
  56739. },
  56740. comment: function comment (text, start, end) {
  56741. // adding anyting as a sibling to the root node is forbidden
  56742. // comments should still be allowed, but ignored
  56743. if (currentParent) {
  56744. var child = {
  56745. type: 3,
  56746. text: text,
  56747. isComment: true
  56748. };
  56749. if (options.outputSourceRange) {
  56750. child.start = start;
  56751. child.end = end;
  56752. }
  56753. currentParent.children.push(child);
  56754. }
  56755. }
  56756. });
  56757. return root
  56758. }
  56759. function processPre (el) {
  56760. if (getAndRemoveAttr(el, 'v-pre') != null) {
  56761. el.pre = true;
  56762. }
  56763. }
  56764. function processRawAttrs (el) {
  56765. var list = el.attrsList;
  56766. var len = list.length;
  56767. if (len) {
  56768. var attrs = el.attrs = new Array(len);
  56769. for (var i = 0; i < len; i++) {
  56770. attrs[i] = {
  56771. name: list[i].name,
  56772. value: JSON.stringify(list[i].value)
  56773. };
  56774. if (list[i].start != null) {
  56775. attrs[i].start = list[i].start;
  56776. attrs[i].end = list[i].end;
  56777. }
  56778. }
  56779. } else if (!el.pre) {
  56780. // non root node in pre blocks with no attributes
  56781. el.plain = true;
  56782. }
  56783. }
  56784. function processElement (
  56785. element,
  56786. options
  56787. ) {
  56788. processKey(element);
  56789. // determine whether this is a plain element after
  56790. // removing structural attributes
  56791. element.plain = (
  56792. !element.key &&
  56793. !element.scopedSlots &&
  56794. !element.attrsList.length
  56795. );
  56796. processRef(element);
  56797. processSlotContent(element);
  56798. processSlotOutlet(element);
  56799. processComponent(element);
  56800. for (var i = 0; i < transforms.length; i++) {
  56801. element = transforms[i](element, options) || element;
  56802. }
  56803. processAttrs(element);
  56804. return element
  56805. }
  56806. function processKey (el) {
  56807. var exp = getBindingAttr(el, 'key');
  56808. if (exp) {
  56809. {
  56810. if (el.tag === 'template') {
  56811. warn$2(
  56812. "<template> cannot be keyed. Place the key on real elements instead.",
  56813. getRawBindingAttr(el, 'key')
  56814. );
  56815. }
  56816. if (el.for) {
  56817. var iterator = el.iterator2 || el.iterator1;
  56818. var parent = el.parent;
  56819. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  56820. warn$2(
  56821. "Do not use v-for index as key on <transition-group> children, " +
  56822. "this is the same as not using keys.",
  56823. getRawBindingAttr(el, 'key'),
  56824. true /* tip */
  56825. );
  56826. }
  56827. }
  56828. }
  56829. el.key = exp;
  56830. }
  56831. }
  56832. function processRef (el) {
  56833. var ref = getBindingAttr(el, 'ref');
  56834. if (ref) {
  56835. el.ref = ref;
  56836. el.refInFor = checkInFor(el);
  56837. }
  56838. }
  56839. function processFor (el) {
  56840. var exp;
  56841. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  56842. var res = parseFor(exp);
  56843. if (res) {
  56844. extend(el, res);
  56845. } else {
  56846. warn$2(
  56847. ("Invalid v-for expression: " + exp),
  56848. el.rawAttrsMap['v-for']
  56849. );
  56850. }
  56851. }
  56852. }
  56853. function parseFor (exp) {
  56854. var inMatch = exp.match(forAliasRE);
  56855. if (!inMatch) { return }
  56856. var res = {};
  56857. res.for = inMatch[2].trim();
  56858. var alias = inMatch[1].trim().replace(stripParensRE, '');
  56859. var iteratorMatch = alias.match(forIteratorRE);
  56860. if (iteratorMatch) {
  56861. res.alias = alias.replace(forIteratorRE, '').trim();
  56862. res.iterator1 = iteratorMatch[1].trim();
  56863. if (iteratorMatch[2]) {
  56864. res.iterator2 = iteratorMatch[2].trim();
  56865. }
  56866. } else {
  56867. res.alias = alias;
  56868. }
  56869. return res
  56870. }
  56871. function processIf (el) {
  56872. var exp = getAndRemoveAttr(el, 'v-if');
  56873. if (exp) {
  56874. el.if = exp;
  56875. addIfCondition(el, {
  56876. exp: exp,
  56877. block: el
  56878. });
  56879. } else {
  56880. if (getAndRemoveAttr(el, 'v-else') != null) {
  56881. el.else = true;
  56882. }
  56883. var elseif = getAndRemoveAttr(el, 'v-else-if');
  56884. if (elseif) {
  56885. el.elseif = elseif;
  56886. }
  56887. }
  56888. }
  56889. function processIfConditions (el, parent) {
  56890. var prev = findPrevElement(parent.children);
  56891. if (prev && prev.if) {
  56892. addIfCondition(prev, {
  56893. exp: el.elseif,
  56894. block: el
  56895. });
  56896. } else {
  56897. warn$2(
  56898. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  56899. "used on element <" + (el.tag) + "> without corresponding v-if.",
  56900. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  56901. );
  56902. }
  56903. }
  56904. function findPrevElement (children) {
  56905. var i = children.length;
  56906. while (i--) {
  56907. if (children[i].type === 1) {
  56908. return children[i]
  56909. } else {
  56910. if (children[i].text !== ' ') {
  56911. warn$2(
  56912. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  56913. "will be ignored.",
  56914. children[i]
  56915. );
  56916. }
  56917. children.pop();
  56918. }
  56919. }
  56920. }
  56921. function addIfCondition (el, condition) {
  56922. if (!el.ifConditions) {
  56923. el.ifConditions = [];
  56924. }
  56925. el.ifConditions.push(condition);
  56926. }
  56927. function processOnce (el) {
  56928. var once$$1 = getAndRemoveAttr(el, 'v-once');
  56929. if (once$$1 != null) {
  56930. el.once = true;
  56931. }
  56932. }
  56933. // handle content being passed to a component as slot,
  56934. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  56935. function processSlotContent (el) {
  56936. var slotScope;
  56937. if (el.tag === 'template') {
  56938. slotScope = getAndRemoveAttr(el, 'scope');
  56939. /* istanbul ignore if */
  56940. if (slotScope) {
  56941. warn$2(
  56942. "the \"scope\" attribute for scoped slots have been deprecated and " +
  56943. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  56944. "can also be used on plain elements in addition to <template> to " +
  56945. "denote scoped slots.",
  56946. el.rawAttrsMap['scope'],
  56947. true
  56948. );
  56949. }
  56950. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  56951. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  56952. /* istanbul ignore if */
  56953. if (el.attrsMap['v-for']) {
  56954. warn$2(
  56955. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  56956. "(v-for takes higher priority). Use a wrapper <template> for the " +
  56957. "scoped slot to make it clearer.",
  56958. el.rawAttrsMap['slot-scope'],
  56959. true
  56960. );
  56961. }
  56962. el.slotScope = slotScope;
  56963. }
  56964. // slot="xxx"
  56965. var slotTarget = getBindingAttr(el, 'slot');
  56966. if (slotTarget) {
  56967. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  56968. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  56969. // preserve slot as an attribute for native shadow DOM compat
  56970. // only for non-scoped slots.
  56971. if (el.tag !== 'template' && !el.slotScope) {
  56972. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  56973. }
  56974. }
  56975. // 2.6 v-slot syntax
  56976. {
  56977. if (el.tag === 'template') {
  56978. // v-slot on <template>
  56979. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  56980. if (slotBinding) {
  56981. {
  56982. if (el.slotTarget || el.slotScope) {
  56983. warn$2(
  56984. "Unexpected mixed usage of different slot syntaxes.",
  56985. el
  56986. );
  56987. }
  56988. if (el.parent && !maybeComponent(el.parent)) {
  56989. warn$2(
  56990. "<template v-slot> can only appear at the root level inside " +
  56991. "the receiving component",
  56992. el
  56993. );
  56994. }
  56995. }
  56996. var ref = getSlotName(slotBinding);
  56997. var name = ref.name;
  56998. var dynamic = ref.dynamic;
  56999. el.slotTarget = name;
  57000. el.slotTargetDynamic = dynamic;
  57001. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  57002. }
  57003. } else {
  57004. // v-slot on component, denotes default slot
  57005. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  57006. if (slotBinding$1) {
  57007. {
  57008. if (!maybeComponent(el)) {
  57009. warn$2(
  57010. "v-slot can only be used on components or <template>.",
  57011. slotBinding$1
  57012. );
  57013. }
  57014. if (el.slotScope || el.slotTarget) {
  57015. warn$2(
  57016. "Unexpected mixed usage of different slot syntaxes.",
  57017. el
  57018. );
  57019. }
  57020. if (el.scopedSlots) {
  57021. warn$2(
  57022. "To avoid scope ambiguity, the default slot should also use " +
  57023. "<template> syntax when there are other named slots.",
  57024. slotBinding$1
  57025. );
  57026. }
  57027. }
  57028. // add the component's children to its default slot
  57029. var slots = el.scopedSlots || (el.scopedSlots = {});
  57030. var ref$1 = getSlotName(slotBinding$1);
  57031. var name$1 = ref$1.name;
  57032. var dynamic$1 = ref$1.dynamic;
  57033. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  57034. slotContainer.slotTarget = name$1;
  57035. slotContainer.slotTargetDynamic = dynamic$1;
  57036. slotContainer.children = el.children.filter(function (c) {
  57037. if (!c.slotScope) {
  57038. c.parent = slotContainer;
  57039. return true
  57040. }
  57041. });
  57042. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  57043. // remove children as they are returned from scopedSlots now
  57044. el.children = [];
  57045. // mark el non-plain so data gets generated
  57046. el.plain = false;
  57047. }
  57048. }
  57049. }
  57050. }
  57051. function getSlotName (binding) {
  57052. var name = binding.name.replace(slotRE, '');
  57053. if (!name) {
  57054. if (binding.name[0] !== '#') {
  57055. name = 'default';
  57056. } else {
  57057. warn$2(
  57058. "v-slot shorthand syntax requires a slot name.",
  57059. binding
  57060. );
  57061. }
  57062. }
  57063. return dynamicArgRE.test(name)
  57064. // dynamic [name]
  57065. ? { name: name.slice(1, -1), dynamic: true }
  57066. // static name
  57067. : { name: ("\"" + name + "\""), dynamic: false }
  57068. }
  57069. // handle <slot/> outlets
  57070. function processSlotOutlet (el) {
  57071. if (el.tag === 'slot') {
  57072. el.slotName = getBindingAttr(el, 'name');
  57073. if (el.key) {
  57074. warn$2(
  57075. "`key` does not work on <slot> because slots are abstract outlets " +
  57076. "and can possibly expand into multiple elements. " +
  57077. "Use the key on a wrapping element instead.",
  57078. getRawBindingAttr(el, 'key')
  57079. );
  57080. }
  57081. }
  57082. }
  57083. function processComponent (el) {
  57084. var binding;
  57085. if ((binding = getBindingAttr(el, 'is'))) {
  57086. el.component = binding;
  57087. }
  57088. if (getAndRemoveAttr(el, 'inline-template') != null) {
  57089. el.inlineTemplate = true;
  57090. }
  57091. }
  57092. function processAttrs (el) {
  57093. var list = el.attrsList;
  57094. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  57095. for (i = 0, l = list.length; i < l; i++) {
  57096. name = rawName = list[i].name;
  57097. value = list[i].value;
  57098. if (dirRE.test(name)) {
  57099. // mark element as dynamic
  57100. el.hasBindings = true;
  57101. // modifiers
  57102. modifiers = parseModifiers(name.replace(dirRE, ''));
  57103. // support .foo shorthand syntax for the .prop modifier
  57104. if (modifiers) {
  57105. name = name.replace(modifierRE, '');
  57106. }
  57107. if (bindRE.test(name)) { // v-bind
  57108. name = name.replace(bindRE, '');
  57109. value = parseFilters(value);
  57110. isDynamic = dynamicArgRE.test(name);
  57111. if (isDynamic) {
  57112. name = name.slice(1, -1);
  57113. }
  57114. if (
  57115. value.trim().length === 0
  57116. ) {
  57117. warn$2(
  57118. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  57119. );
  57120. }
  57121. if (modifiers) {
  57122. if (modifiers.prop && !isDynamic) {
  57123. name = camelize(name);
  57124. if (name === 'innerHtml') { name = 'innerHTML'; }
  57125. }
  57126. if (modifiers.camel && !isDynamic) {
  57127. name = camelize(name);
  57128. }
  57129. if (modifiers.sync) {
  57130. syncGen = genAssignmentCode(value, "$event");
  57131. if (!isDynamic) {
  57132. addHandler(
  57133. el,
  57134. ("update:" + (camelize(name))),
  57135. syncGen,
  57136. null,
  57137. false,
  57138. warn$2,
  57139. list[i]
  57140. );
  57141. if (hyphenate(name) !== camelize(name)) {
  57142. addHandler(
  57143. el,
  57144. ("update:" + (hyphenate(name))),
  57145. syncGen,
  57146. null,
  57147. false,
  57148. warn$2,
  57149. list[i]
  57150. );
  57151. }
  57152. } else {
  57153. // handler w/ dynamic event name
  57154. addHandler(
  57155. el,
  57156. ("\"update:\"+(" + name + ")"),
  57157. syncGen,
  57158. null,
  57159. false,
  57160. warn$2,
  57161. list[i],
  57162. true // dynamic
  57163. );
  57164. }
  57165. }
  57166. }
  57167. if ((modifiers && modifiers.prop) || (
  57168. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  57169. )) {
  57170. addProp(el, name, value, list[i], isDynamic);
  57171. } else {
  57172. addAttr(el, name, value, list[i], isDynamic);
  57173. }
  57174. } else if (onRE.test(name)) { // v-on
  57175. name = name.replace(onRE, '');
  57176. isDynamic = dynamicArgRE.test(name);
  57177. if (isDynamic) {
  57178. name = name.slice(1, -1);
  57179. }
  57180. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  57181. } else { // normal directives
  57182. name = name.replace(dirRE, '');
  57183. // parse arg
  57184. var argMatch = name.match(argRE);
  57185. var arg = argMatch && argMatch[1];
  57186. isDynamic = false;
  57187. if (arg) {
  57188. name = name.slice(0, -(arg.length + 1));
  57189. if (dynamicArgRE.test(arg)) {
  57190. arg = arg.slice(1, -1);
  57191. isDynamic = true;
  57192. }
  57193. }
  57194. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  57195. if (name === 'model') {
  57196. checkForAliasModel(el, value);
  57197. }
  57198. }
  57199. } else {
  57200. // literal attribute
  57201. {
  57202. var res = parseText(value, delimiters);
  57203. if (res) {
  57204. warn$2(
  57205. name + "=\"" + value + "\": " +
  57206. 'Interpolation inside attributes has been removed. ' +
  57207. 'Use v-bind or the colon shorthand instead. For example, ' +
  57208. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  57209. list[i]
  57210. );
  57211. }
  57212. }
  57213. addAttr(el, name, JSON.stringify(value), list[i]);
  57214. // #6887 firefox doesn't update muted state if set via attribute
  57215. // even immediately after element creation
  57216. if (!el.component &&
  57217. name === 'muted' &&
  57218. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  57219. addProp(el, name, 'true', list[i]);
  57220. }
  57221. }
  57222. }
  57223. }
  57224. function checkInFor (el) {
  57225. var parent = el;
  57226. while (parent) {
  57227. if (parent.for !== undefined) {
  57228. return true
  57229. }
  57230. parent = parent.parent;
  57231. }
  57232. return false
  57233. }
  57234. function parseModifiers (name) {
  57235. var match = name.match(modifierRE);
  57236. if (match) {
  57237. var ret = {};
  57238. match.forEach(function (m) { ret[m.slice(1)] = true; });
  57239. return ret
  57240. }
  57241. }
  57242. function makeAttrsMap (attrs) {
  57243. var map = {};
  57244. for (var i = 0, l = attrs.length; i < l; i++) {
  57245. if (
  57246. map[attrs[i].name] && !isIE && !isEdge
  57247. ) {
  57248. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  57249. }
  57250. map[attrs[i].name] = attrs[i].value;
  57251. }
  57252. return map
  57253. }
  57254. // for script (e.g. type="x/template") or style, do not decode content
  57255. function isTextTag (el) {
  57256. return el.tag === 'script' || el.tag === 'style'
  57257. }
  57258. function isForbiddenTag (el) {
  57259. return (
  57260. el.tag === 'style' ||
  57261. (el.tag === 'script' && (
  57262. !el.attrsMap.type ||
  57263. el.attrsMap.type === 'text/javascript'
  57264. ))
  57265. )
  57266. }
  57267. var ieNSBug = /^xmlns:NS\d+/;
  57268. var ieNSPrefix = /^NS\d+:/;
  57269. /* istanbul ignore next */
  57270. function guardIESVGBug (attrs) {
  57271. var res = [];
  57272. for (var i = 0; i < attrs.length; i++) {
  57273. var attr = attrs[i];
  57274. if (!ieNSBug.test(attr.name)) {
  57275. attr.name = attr.name.replace(ieNSPrefix, '');
  57276. res.push(attr);
  57277. }
  57278. }
  57279. return res
  57280. }
  57281. function checkForAliasModel (el, value) {
  57282. var _el = el;
  57283. while (_el) {
  57284. if (_el.for && _el.alias === value) {
  57285. warn$2(
  57286. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  57287. "You are binding v-model directly to a v-for iteration alias. " +
  57288. "This will not be able to modify the v-for source array because " +
  57289. "writing to the alias is like modifying a function local variable. " +
  57290. "Consider using an array of objects and use v-model on an object property instead.",
  57291. el.rawAttrsMap['v-model']
  57292. );
  57293. }
  57294. _el = _el.parent;
  57295. }
  57296. }
  57297. /* */
  57298. function preTransformNode (el, options) {
  57299. if (el.tag === 'input') {
  57300. var map = el.attrsMap;
  57301. if (!map['v-model']) {
  57302. return
  57303. }
  57304. var typeBinding;
  57305. if (map[':type'] || map['v-bind:type']) {
  57306. typeBinding = getBindingAttr(el, 'type');
  57307. }
  57308. if (!map.type && !typeBinding && map['v-bind']) {
  57309. typeBinding = "(" + (map['v-bind']) + ").type";
  57310. }
  57311. if (typeBinding) {
  57312. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  57313. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  57314. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  57315. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  57316. // 1. checkbox
  57317. var branch0 = cloneASTElement(el);
  57318. // process for on the main node
  57319. processFor(branch0);
  57320. addRawAttr(branch0, 'type', 'checkbox');
  57321. processElement(branch0, options);
  57322. branch0.processed = true; // prevent it from double-processed
  57323. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  57324. addIfCondition(branch0, {
  57325. exp: branch0.if,
  57326. block: branch0
  57327. });
  57328. // 2. add radio else-if condition
  57329. var branch1 = cloneASTElement(el);
  57330. getAndRemoveAttr(branch1, 'v-for', true);
  57331. addRawAttr(branch1, 'type', 'radio');
  57332. processElement(branch1, options);
  57333. addIfCondition(branch0, {
  57334. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  57335. block: branch1
  57336. });
  57337. // 3. other
  57338. var branch2 = cloneASTElement(el);
  57339. getAndRemoveAttr(branch2, 'v-for', true);
  57340. addRawAttr(branch2, ':type', typeBinding);
  57341. processElement(branch2, options);
  57342. addIfCondition(branch0, {
  57343. exp: ifCondition,
  57344. block: branch2
  57345. });
  57346. if (hasElse) {
  57347. branch0.else = true;
  57348. } else if (elseIfCondition) {
  57349. branch0.elseif = elseIfCondition;
  57350. }
  57351. return branch0
  57352. }
  57353. }
  57354. }
  57355. function cloneASTElement (el) {
  57356. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  57357. }
  57358. var model$1 = {
  57359. preTransformNode: preTransformNode
  57360. };
  57361. var modules$1 = [
  57362. klass$1,
  57363. style$1,
  57364. model$1
  57365. ];
  57366. /* */
  57367. function text (el, dir) {
  57368. if (dir.value) {
  57369. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  57370. }
  57371. }
  57372. /* */
  57373. function html (el, dir) {
  57374. if (dir.value) {
  57375. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  57376. }
  57377. }
  57378. var directives$1 = {
  57379. model: model,
  57380. text: text,
  57381. html: html
  57382. };
  57383. /* */
  57384. var baseOptions = {
  57385. expectHTML: true,
  57386. modules: modules$1,
  57387. directives: directives$1,
  57388. isPreTag: isPreTag,
  57389. isUnaryTag: isUnaryTag,
  57390. mustUseProp: mustUseProp,
  57391. canBeLeftOpenTag: canBeLeftOpenTag,
  57392. isReservedTag: isReservedTag,
  57393. getTagNamespace: getTagNamespace,
  57394. staticKeys: genStaticKeys(modules$1)
  57395. };
  57396. /* */
  57397. var isStaticKey;
  57398. var isPlatformReservedTag;
  57399. var genStaticKeysCached = cached(genStaticKeys$1);
  57400. /**
  57401. * Goal of the optimizer: walk the generated template AST tree
  57402. * and detect sub-trees that are purely static, i.e. parts of
  57403. * the DOM that never needs to change.
  57404. *
  57405. * Once we detect these sub-trees, we can:
  57406. *
  57407. * 1. Hoist them into constants, so that we no longer need to
  57408. * create fresh nodes for them on each re-render;
  57409. * 2. Completely skip them in the patching process.
  57410. */
  57411. function optimize (root, options) {
  57412. if (!root) { return }
  57413. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  57414. isPlatformReservedTag = options.isReservedTag || no;
  57415. // first pass: mark all non-static nodes.
  57416. markStatic$1(root);
  57417. // second pass: mark static roots.
  57418. markStaticRoots(root, false);
  57419. }
  57420. function genStaticKeys$1 (keys) {
  57421. return makeMap(
  57422. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  57423. (keys ? ',' + keys : '')
  57424. )
  57425. }
  57426. function markStatic$1 (node) {
  57427. node.static = isStatic(node);
  57428. if (node.type === 1) {
  57429. // do not make component slot content static. this avoids
  57430. // 1. components not able to mutate slot nodes
  57431. // 2. static slot content fails for hot-reloading
  57432. if (
  57433. !isPlatformReservedTag(node.tag) &&
  57434. node.tag !== 'slot' &&
  57435. node.attrsMap['inline-template'] == null
  57436. ) {
  57437. return
  57438. }
  57439. for (var i = 0, l = node.children.length; i < l; i++) {
  57440. var child = node.children[i];
  57441. markStatic$1(child);
  57442. if (!child.static) {
  57443. node.static = false;
  57444. }
  57445. }
  57446. if (node.ifConditions) {
  57447. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  57448. var block = node.ifConditions[i$1].block;
  57449. markStatic$1(block);
  57450. if (!block.static) {
  57451. node.static = false;
  57452. }
  57453. }
  57454. }
  57455. }
  57456. }
  57457. function markStaticRoots (node, isInFor) {
  57458. if (node.type === 1) {
  57459. if (node.static || node.once) {
  57460. node.staticInFor = isInFor;
  57461. }
  57462. // For a node to qualify as a static root, it should have children that
  57463. // are not just static text. Otherwise the cost of hoisting out will
  57464. // outweigh the benefits and it's better off to just always render it fresh.
  57465. if (node.static && node.children.length && !(
  57466. node.children.length === 1 &&
  57467. node.children[0].type === 3
  57468. )) {
  57469. node.staticRoot = true;
  57470. return
  57471. } else {
  57472. node.staticRoot = false;
  57473. }
  57474. if (node.children) {
  57475. for (var i = 0, l = node.children.length; i < l; i++) {
  57476. markStaticRoots(node.children[i], isInFor || !!node.for);
  57477. }
  57478. }
  57479. if (node.ifConditions) {
  57480. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  57481. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  57482. }
  57483. }
  57484. }
  57485. }
  57486. function isStatic (node) {
  57487. if (node.type === 2) { // expression
  57488. return false
  57489. }
  57490. if (node.type === 3) { // text
  57491. return true
  57492. }
  57493. return !!(node.pre || (
  57494. !node.hasBindings && // no dynamic bindings
  57495. !node.if && !node.for && // not v-if or v-for or v-else
  57496. !isBuiltInTag(node.tag) && // not a built-in
  57497. isPlatformReservedTag(node.tag) && // not a component
  57498. !isDirectChildOfTemplateFor(node) &&
  57499. Object.keys(node).every(isStaticKey)
  57500. ))
  57501. }
  57502. function isDirectChildOfTemplateFor (node) {
  57503. while (node.parent) {
  57504. node = node.parent;
  57505. if (node.tag !== 'template') {
  57506. return false
  57507. }
  57508. if (node.for) {
  57509. return true
  57510. }
  57511. }
  57512. return false
  57513. }
  57514. /* */
  57515. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  57516. var fnInvokeRE = /\([^)]*?\);*$/;
  57517. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  57518. // KeyboardEvent.keyCode aliases
  57519. var keyCodes = {
  57520. esc: 27,
  57521. tab: 9,
  57522. enter: 13,
  57523. space: 32,
  57524. up: 38,
  57525. left: 37,
  57526. right: 39,
  57527. down: 40,
  57528. 'delete': [8, 46]
  57529. };
  57530. // KeyboardEvent.key aliases
  57531. var keyNames = {
  57532. // #7880: IE11 and Edge use `Esc` for Escape key name.
  57533. esc: ['Esc', 'Escape'],
  57534. tab: 'Tab',
  57535. enter: 'Enter',
  57536. // #9112: IE11 uses `Spacebar` for Space key name.
  57537. space: [' ', 'Spacebar'],
  57538. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  57539. up: ['Up', 'ArrowUp'],
  57540. left: ['Left', 'ArrowLeft'],
  57541. right: ['Right', 'ArrowRight'],
  57542. down: ['Down', 'ArrowDown'],
  57543. // #9112: IE11 uses `Del` for Delete key name.
  57544. 'delete': ['Backspace', 'Delete', 'Del']
  57545. };
  57546. // #4868: modifiers that prevent the execution of the listener
  57547. // need to explicitly return null so that we can determine whether to remove
  57548. // the listener for .once
  57549. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  57550. var modifierCode = {
  57551. stop: '$event.stopPropagation();',
  57552. prevent: '$event.preventDefault();',
  57553. self: genGuard("$event.target !== $event.currentTarget"),
  57554. ctrl: genGuard("!$event.ctrlKey"),
  57555. shift: genGuard("!$event.shiftKey"),
  57556. alt: genGuard("!$event.altKey"),
  57557. meta: genGuard("!$event.metaKey"),
  57558. left: genGuard("'button' in $event && $event.button !== 0"),
  57559. middle: genGuard("'button' in $event && $event.button !== 1"),
  57560. right: genGuard("'button' in $event && $event.button !== 2")
  57561. };
  57562. function genHandlers (
  57563. events,
  57564. isNative
  57565. ) {
  57566. var prefix = isNative ? 'nativeOn:' : 'on:';
  57567. var staticHandlers = "";
  57568. var dynamicHandlers = "";
  57569. for (var name in events) {
  57570. var handlerCode = genHandler(events[name]);
  57571. if (events[name] && events[name].dynamic) {
  57572. dynamicHandlers += name + "," + handlerCode + ",";
  57573. } else {
  57574. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  57575. }
  57576. }
  57577. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  57578. if (dynamicHandlers) {
  57579. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  57580. } else {
  57581. return prefix + staticHandlers
  57582. }
  57583. }
  57584. function genHandler (handler) {
  57585. if (!handler) {
  57586. return 'function(){}'
  57587. }
  57588. if (Array.isArray(handler)) {
  57589. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  57590. }
  57591. var isMethodPath = simplePathRE.test(handler.value);
  57592. var isFunctionExpression = fnExpRE.test(handler.value);
  57593. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  57594. if (!handler.modifiers) {
  57595. if (isMethodPath || isFunctionExpression) {
  57596. return handler.value
  57597. }
  57598. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  57599. } else {
  57600. var code = '';
  57601. var genModifierCode = '';
  57602. var keys = [];
  57603. for (var key in handler.modifiers) {
  57604. if (modifierCode[key]) {
  57605. genModifierCode += modifierCode[key];
  57606. // left/right
  57607. if (keyCodes[key]) {
  57608. keys.push(key);
  57609. }
  57610. } else if (key === 'exact') {
  57611. var modifiers = (handler.modifiers);
  57612. genModifierCode += genGuard(
  57613. ['ctrl', 'shift', 'alt', 'meta']
  57614. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  57615. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  57616. .join('||')
  57617. );
  57618. } else {
  57619. keys.push(key);
  57620. }
  57621. }
  57622. if (keys.length) {
  57623. code += genKeyFilter(keys);
  57624. }
  57625. // Make sure modifiers like prevent and stop get executed after key filtering
  57626. if (genModifierCode) {
  57627. code += genModifierCode;
  57628. }
  57629. var handlerCode = isMethodPath
  57630. ? ("return " + (handler.value) + "($event)")
  57631. : isFunctionExpression
  57632. ? ("return (" + (handler.value) + ")($event)")
  57633. : isFunctionInvocation
  57634. ? ("return " + (handler.value))
  57635. : handler.value;
  57636. return ("function($event){" + code + handlerCode + "}")
  57637. }
  57638. }
  57639. function genKeyFilter (keys) {
  57640. return (
  57641. // make sure the key filters only apply to KeyboardEvents
  57642. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  57643. // key events that do not have keyCode property...
  57644. "if(!$event.type.indexOf('key')&&" +
  57645. (keys.map(genFilterCode).join('&&')) + ")return null;"
  57646. )
  57647. }
  57648. function genFilterCode (key) {
  57649. var keyVal = parseInt(key, 10);
  57650. if (keyVal) {
  57651. return ("$event.keyCode!==" + keyVal)
  57652. }
  57653. var keyCode = keyCodes[key];
  57654. var keyName = keyNames[key];
  57655. return (
  57656. "_k($event.keyCode," +
  57657. (JSON.stringify(key)) + "," +
  57658. (JSON.stringify(keyCode)) + "," +
  57659. "$event.key," +
  57660. "" + (JSON.stringify(keyName)) +
  57661. ")"
  57662. )
  57663. }
  57664. /* */
  57665. function on (el, dir) {
  57666. if (dir.modifiers) {
  57667. warn("v-on without argument does not support modifiers.");
  57668. }
  57669. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  57670. }
  57671. /* */
  57672. function bind$1 (el, dir) {
  57673. el.wrapData = function (code) {
  57674. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  57675. };
  57676. }
  57677. /* */
  57678. var baseDirectives = {
  57679. on: on,
  57680. bind: bind$1,
  57681. cloak: noop
  57682. };
  57683. /* */
  57684. var CodegenState = function CodegenState (options) {
  57685. this.options = options;
  57686. this.warn = options.warn || baseWarn;
  57687. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  57688. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  57689. this.directives = extend(extend({}, baseDirectives), options.directives);
  57690. var isReservedTag = options.isReservedTag || no;
  57691. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57692. this.onceId = 0;
  57693. this.staticRenderFns = [];
  57694. this.pre = false;
  57695. };
  57696. function generate (
  57697. ast,
  57698. options
  57699. ) {
  57700. var state = new CodegenState(options);
  57701. var code = ast ? genElement(ast, state) : '_c("div")';
  57702. return {
  57703. render: ("with(this){return " + code + "}"),
  57704. staticRenderFns: state.staticRenderFns
  57705. }
  57706. }
  57707. function genElement (el, state) {
  57708. if (el.parent) {
  57709. el.pre = el.pre || el.parent.pre;
  57710. }
  57711. if (el.staticRoot && !el.staticProcessed) {
  57712. return genStatic(el, state)
  57713. } else if (el.once && !el.onceProcessed) {
  57714. return genOnce(el, state)
  57715. } else if (el.for && !el.forProcessed) {
  57716. return genFor(el, state)
  57717. } else if (el.if && !el.ifProcessed) {
  57718. return genIf(el, state)
  57719. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  57720. return genChildren(el, state) || 'void 0'
  57721. } else if (el.tag === 'slot') {
  57722. return genSlot(el, state)
  57723. } else {
  57724. // component or element
  57725. var code;
  57726. if (el.component) {
  57727. code = genComponent(el.component, el, state);
  57728. } else {
  57729. var data;
  57730. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  57731. data = genData$2(el, state);
  57732. }
  57733. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57734. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  57735. }
  57736. // module transforms
  57737. for (var i = 0; i < state.transforms.length; i++) {
  57738. code = state.transforms[i](el, code);
  57739. }
  57740. return code
  57741. }
  57742. }
  57743. // hoist static sub-trees out
  57744. function genStatic (el, state) {
  57745. el.staticProcessed = true;
  57746. // Some elements (templates) need to behave differently inside of a v-pre
  57747. // node. All pre nodes are static roots, so we can use this as a location to
  57748. // wrap a state change and reset it upon exiting the pre node.
  57749. var originalPreState = state.pre;
  57750. if (el.pre) {
  57751. state.pre = el.pre;
  57752. }
  57753. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  57754. state.pre = originalPreState;
  57755. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  57756. }
  57757. // v-once
  57758. function genOnce (el, state) {
  57759. el.onceProcessed = true;
  57760. if (el.if && !el.ifProcessed) {
  57761. return genIf(el, state)
  57762. } else if (el.staticInFor) {
  57763. var key = '';
  57764. var parent = el.parent;
  57765. while (parent) {
  57766. if (parent.for) {
  57767. key = parent.key;
  57768. break
  57769. }
  57770. parent = parent.parent;
  57771. }
  57772. if (!key) {
  57773. state.warn(
  57774. "v-once can only be used inside v-for that is keyed. ",
  57775. el.rawAttrsMap['v-once']
  57776. );
  57777. return genElement(el, state)
  57778. }
  57779. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  57780. } else {
  57781. return genStatic(el, state)
  57782. }
  57783. }
  57784. function genIf (
  57785. el,
  57786. state,
  57787. altGen,
  57788. altEmpty
  57789. ) {
  57790. el.ifProcessed = true; // avoid recursion
  57791. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  57792. }
  57793. function genIfConditions (
  57794. conditions,
  57795. state,
  57796. altGen,
  57797. altEmpty
  57798. ) {
  57799. if (!conditions.length) {
  57800. return altEmpty || '_e()'
  57801. }
  57802. var condition = conditions.shift();
  57803. if (condition.exp) {
  57804. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  57805. } else {
  57806. return ("" + (genTernaryExp(condition.block)))
  57807. }
  57808. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  57809. function genTernaryExp (el) {
  57810. return altGen
  57811. ? altGen(el, state)
  57812. : el.once
  57813. ? genOnce(el, state)
  57814. : genElement(el, state)
  57815. }
  57816. }
  57817. function genFor (
  57818. el,
  57819. state,
  57820. altGen,
  57821. altHelper
  57822. ) {
  57823. var exp = el.for;
  57824. var alias = el.alias;
  57825. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  57826. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  57827. if (state.maybeComponent(el) &&
  57828. el.tag !== 'slot' &&
  57829. el.tag !== 'template' &&
  57830. !el.key
  57831. ) {
  57832. state.warn(
  57833. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  57834. "v-for should have explicit keys. " +
  57835. "See https://vuejs.org/guide/list.html#key for more info.",
  57836. el.rawAttrsMap['v-for'],
  57837. true /* tip */
  57838. );
  57839. }
  57840. el.forProcessed = true; // avoid recursion
  57841. return (altHelper || '_l') + "((" + exp + ")," +
  57842. "function(" + alias + iterator1 + iterator2 + "){" +
  57843. "return " + ((altGen || genElement)(el, state)) +
  57844. '})'
  57845. }
  57846. function genData$2 (el, state) {
  57847. var data = '{';
  57848. // directives first.
  57849. // directives may mutate the el's other properties before they are generated.
  57850. var dirs = genDirectives(el, state);
  57851. if (dirs) { data += dirs + ','; }
  57852. // key
  57853. if (el.key) {
  57854. data += "key:" + (el.key) + ",";
  57855. }
  57856. // ref
  57857. if (el.ref) {
  57858. data += "ref:" + (el.ref) + ",";
  57859. }
  57860. if (el.refInFor) {
  57861. data += "refInFor:true,";
  57862. }
  57863. // pre
  57864. if (el.pre) {
  57865. data += "pre:true,";
  57866. }
  57867. // record original tag name for components using "is" attribute
  57868. if (el.component) {
  57869. data += "tag:\"" + (el.tag) + "\",";
  57870. }
  57871. // module data generation functions
  57872. for (var i = 0; i < state.dataGenFns.length; i++) {
  57873. data += state.dataGenFns[i](el);
  57874. }
  57875. // attributes
  57876. if (el.attrs) {
  57877. data += "attrs:" + (genProps(el.attrs)) + ",";
  57878. }
  57879. // DOM props
  57880. if (el.props) {
  57881. data += "domProps:" + (genProps(el.props)) + ",";
  57882. }
  57883. // event handlers
  57884. if (el.events) {
  57885. data += (genHandlers(el.events, false)) + ",";
  57886. }
  57887. if (el.nativeEvents) {
  57888. data += (genHandlers(el.nativeEvents, true)) + ",";
  57889. }
  57890. // slot target
  57891. // only for non-scoped slots
  57892. if (el.slotTarget && !el.slotScope) {
  57893. data += "slot:" + (el.slotTarget) + ",";
  57894. }
  57895. // scoped slots
  57896. if (el.scopedSlots) {
  57897. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  57898. }
  57899. // component v-model
  57900. if (el.model) {
  57901. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  57902. }
  57903. // inline-template
  57904. if (el.inlineTemplate) {
  57905. var inlineTemplate = genInlineTemplate(el, state);
  57906. if (inlineTemplate) {
  57907. data += inlineTemplate + ",";
  57908. }
  57909. }
  57910. data = data.replace(/,$/, '') + '}';
  57911. // v-bind dynamic argument wrap
  57912. // v-bind with dynamic arguments must be applied using the same v-bind object
  57913. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  57914. if (el.dynamicAttrs) {
  57915. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  57916. }
  57917. // v-bind data wrap
  57918. if (el.wrapData) {
  57919. data = el.wrapData(data);
  57920. }
  57921. // v-on data wrap
  57922. if (el.wrapListeners) {
  57923. data = el.wrapListeners(data);
  57924. }
  57925. return data
  57926. }
  57927. function genDirectives (el, state) {
  57928. var dirs = el.directives;
  57929. if (!dirs) { return }
  57930. var res = 'directives:[';
  57931. var hasRuntime = false;
  57932. var i, l, dir, needRuntime;
  57933. for (i = 0, l = dirs.length; i < l; i++) {
  57934. dir = dirs[i];
  57935. needRuntime = true;
  57936. var gen = state.directives[dir.name];
  57937. if (gen) {
  57938. // compile-time directive that manipulates AST.
  57939. // returns true if it also needs a runtime counterpart.
  57940. needRuntime = !!gen(el, dir, state.warn);
  57941. }
  57942. if (needRuntime) {
  57943. hasRuntime = true;
  57944. 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))) : '') + "},";
  57945. }
  57946. }
  57947. if (hasRuntime) {
  57948. return res.slice(0, -1) + ']'
  57949. }
  57950. }
  57951. function genInlineTemplate (el, state) {
  57952. var ast = el.children[0];
  57953. if (el.children.length !== 1 || ast.type !== 1) {
  57954. state.warn(
  57955. 'Inline-template components must have exactly one child element.',
  57956. { start: el.start }
  57957. );
  57958. }
  57959. if (ast && ast.type === 1) {
  57960. var inlineRenderFns = generate(ast, state.options);
  57961. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  57962. }
  57963. }
  57964. function genScopedSlots (
  57965. el,
  57966. slots,
  57967. state
  57968. ) {
  57969. // by default scoped slots are considered "stable", this allows child
  57970. // components with only scoped slots to skip forced updates from parent.
  57971. // but in some cases we have to bail-out of this optimization
  57972. // for example if the slot contains dynamic names, has v-if or v-for on them...
  57973. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  57974. var slot = slots[key];
  57975. return (
  57976. slot.slotTargetDynamic ||
  57977. slot.if ||
  57978. slot.for ||
  57979. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  57980. )
  57981. });
  57982. // #9534: if a component with scoped slots is inside a conditional branch,
  57983. // it's possible for the same component to be reused but with different
  57984. // compiled slot content. To avoid that, we generate a unique key based on
  57985. // the generated code of all the slot contents.
  57986. var needsKey = !!el.if;
  57987. // OR when it is inside another scoped slot or v-for (the reactivity may be
  57988. // disconnected due to the intermediate scope variable)
  57989. // #9438, #9506
  57990. // TODO: this can be further optimized by properly analyzing in-scope bindings
  57991. // and skip force updating ones that do not actually use scope variables.
  57992. if (!needsForceUpdate) {
  57993. var parent = el.parent;
  57994. while (parent) {
  57995. if (
  57996. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  57997. parent.for
  57998. ) {
  57999. needsForceUpdate = true;
  58000. break
  58001. }
  58002. if (parent.if) {
  58003. needsKey = true;
  58004. }
  58005. parent = parent.parent;
  58006. }
  58007. }
  58008. var generatedSlots = Object.keys(slots)
  58009. .map(function (key) { return genScopedSlot(slots[key], state); })
  58010. .join(',');
  58011. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  58012. }
  58013. function hash(str) {
  58014. var hash = 5381;
  58015. var i = str.length;
  58016. while(i) {
  58017. hash = (hash * 33) ^ str.charCodeAt(--i);
  58018. }
  58019. return hash >>> 0
  58020. }
  58021. function containsSlotChild (el) {
  58022. if (el.type === 1) {
  58023. if (el.tag === 'slot') {
  58024. return true
  58025. }
  58026. return el.children.some(containsSlotChild)
  58027. }
  58028. return false
  58029. }
  58030. function genScopedSlot (
  58031. el,
  58032. state
  58033. ) {
  58034. var isLegacySyntax = el.attrsMap['slot-scope'];
  58035. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  58036. return genIf(el, state, genScopedSlot, "null")
  58037. }
  58038. if (el.for && !el.forProcessed) {
  58039. return genFor(el, state, genScopedSlot)
  58040. }
  58041. var slotScope = el.slotScope === emptySlotScopeToken
  58042. ? ""
  58043. : String(el.slotScope);
  58044. var fn = "function(" + slotScope + "){" +
  58045. "return " + (el.tag === 'template'
  58046. ? el.if && isLegacySyntax
  58047. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  58048. : genChildren(el, state) || 'undefined'
  58049. : genElement(el, state)) + "}";
  58050. // reverse proxy v-slot without scope on this.$slots
  58051. var reverseProxy = slotScope ? "" : ",proxy:true";
  58052. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  58053. }
  58054. function genChildren (
  58055. el,
  58056. state,
  58057. checkSkip,
  58058. altGenElement,
  58059. altGenNode
  58060. ) {
  58061. var children = el.children;
  58062. if (children.length) {
  58063. var el$1 = children[0];
  58064. // optimize single v-for
  58065. if (children.length === 1 &&
  58066. el$1.for &&
  58067. el$1.tag !== 'template' &&
  58068. el$1.tag !== 'slot'
  58069. ) {
  58070. var normalizationType = checkSkip
  58071. ? state.maybeComponent(el$1) ? ",1" : ",0"
  58072. : "";
  58073. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  58074. }
  58075. var normalizationType$1 = checkSkip
  58076. ? getNormalizationType(children, state.maybeComponent)
  58077. : 0;
  58078. var gen = altGenNode || genNode;
  58079. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  58080. }
  58081. }
  58082. // determine the normalization needed for the children array.
  58083. // 0: no normalization needed
  58084. // 1: simple normalization needed (possible 1-level deep nested array)
  58085. // 2: full normalization needed
  58086. function getNormalizationType (
  58087. children,
  58088. maybeComponent
  58089. ) {
  58090. var res = 0;
  58091. for (var i = 0; i < children.length; i++) {
  58092. var el = children[i];
  58093. if (el.type !== 1) {
  58094. continue
  58095. }
  58096. if (needsNormalization(el) ||
  58097. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  58098. res = 2;
  58099. break
  58100. }
  58101. if (maybeComponent(el) ||
  58102. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  58103. res = 1;
  58104. }
  58105. }
  58106. return res
  58107. }
  58108. function needsNormalization (el) {
  58109. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  58110. }
  58111. function genNode (node, state) {
  58112. if (node.type === 1) {
  58113. return genElement(node, state)
  58114. } else if (node.type === 3 && node.isComment) {
  58115. return genComment(node)
  58116. } else {
  58117. return genText(node)
  58118. }
  58119. }
  58120. function genText (text) {
  58121. return ("_v(" + (text.type === 2
  58122. ? text.expression // no need for () because already wrapped in _s()
  58123. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  58124. }
  58125. function genComment (comment) {
  58126. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  58127. }
  58128. function genSlot (el, state) {
  58129. var slotName = el.slotName || '"default"';
  58130. var children = genChildren(el, state);
  58131. var res = "_t(" + slotName + (children ? ("," + children) : '');
  58132. var attrs = el.attrs || el.dynamicAttrs
  58133. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  58134. // slot props are camelized
  58135. name: camelize(attr.name),
  58136. value: attr.value,
  58137. dynamic: attr.dynamic
  58138. }); }))
  58139. : null;
  58140. var bind$$1 = el.attrsMap['v-bind'];
  58141. if ((attrs || bind$$1) && !children) {
  58142. res += ",null";
  58143. }
  58144. if (attrs) {
  58145. res += "," + attrs;
  58146. }
  58147. if (bind$$1) {
  58148. res += (attrs ? '' : ',null') + "," + bind$$1;
  58149. }
  58150. return res + ')'
  58151. }
  58152. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  58153. function genComponent (
  58154. componentName,
  58155. el,
  58156. state
  58157. ) {
  58158. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58159. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  58160. }
  58161. function genProps (props) {
  58162. var staticProps = "";
  58163. var dynamicProps = "";
  58164. for (var i = 0; i < props.length; i++) {
  58165. var prop = props[i];
  58166. var value = transformSpecialNewlines(prop.value);
  58167. if (prop.dynamic) {
  58168. dynamicProps += (prop.name) + "," + value + ",";
  58169. } else {
  58170. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  58171. }
  58172. }
  58173. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  58174. if (dynamicProps) {
  58175. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  58176. } else {
  58177. return staticProps
  58178. }
  58179. }
  58180. // #3895, #4268
  58181. function transformSpecialNewlines (text) {
  58182. return text
  58183. .replace(/\u2028/g, '\\u2028')
  58184. .replace(/\u2029/g, '\\u2029')
  58185. }
  58186. /* */
  58187. // these keywords should not appear inside expressions, but operators like
  58188. // typeof, instanceof and in are allowed
  58189. var prohibitedKeywordRE = new RegExp('\\b' + (
  58190. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  58191. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  58192. 'extends,finally,continue,debugger,function,arguments'
  58193. ).split(',').join('\\b|\\b') + '\\b');
  58194. // these unary operators should not be used as property/method names
  58195. var unaryOperatorsRE = new RegExp('\\b' + (
  58196. 'delete,typeof,void'
  58197. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  58198. // strip strings in expressions
  58199. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  58200. // detect problematic expressions in a template
  58201. function detectErrors (ast, warn) {
  58202. if (ast) {
  58203. checkNode(ast, warn);
  58204. }
  58205. }
  58206. function checkNode (node, warn) {
  58207. if (node.type === 1) {
  58208. for (var name in node.attrsMap) {
  58209. if (dirRE.test(name)) {
  58210. var value = node.attrsMap[name];
  58211. if (value) {
  58212. var range = node.rawAttrsMap[name];
  58213. if (name === 'v-for') {
  58214. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  58215. } else if (name === 'v-slot' || name[0] === '#') {
  58216. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  58217. } else if (onRE.test(name)) {
  58218. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  58219. } else {
  58220. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  58221. }
  58222. }
  58223. }
  58224. }
  58225. if (node.children) {
  58226. for (var i = 0; i < node.children.length; i++) {
  58227. checkNode(node.children[i], warn);
  58228. }
  58229. }
  58230. } else if (node.type === 2) {
  58231. checkExpression(node.expression, node.text, warn, node);
  58232. }
  58233. }
  58234. function checkEvent (exp, text, warn, range) {
  58235. var stripped = exp.replace(stripStringRE, '');
  58236. var keywordMatch = stripped.match(unaryOperatorsRE);
  58237. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  58238. warn(
  58239. "avoid using JavaScript unary operator as property name: " +
  58240. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  58241. range
  58242. );
  58243. }
  58244. checkExpression(exp, text, warn, range);
  58245. }
  58246. function checkFor (node, text, warn, range) {
  58247. checkExpression(node.for || '', text, warn, range);
  58248. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  58249. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  58250. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  58251. }
  58252. function checkIdentifier (
  58253. ident,
  58254. type,
  58255. text,
  58256. warn,
  58257. range
  58258. ) {
  58259. if (typeof ident === 'string') {
  58260. try {
  58261. new Function(("var " + ident + "=_"));
  58262. } catch (e) {
  58263. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  58264. }
  58265. }
  58266. }
  58267. function checkExpression (exp, text, warn, range) {
  58268. try {
  58269. new Function(("return " + exp));
  58270. } catch (e) {
  58271. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  58272. if (keywordMatch) {
  58273. warn(
  58274. "avoid using JavaScript keyword as property name: " +
  58275. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  58276. range
  58277. );
  58278. } else {
  58279. warn(
  58280. "invalid expression: " + (e.message) + " in\n\n" +
  58281. " " + exp + "\n\n" +
  58282. " Raw expression: " + (text.trim()) + "\n",
  58283. range
  58284. );
  58285. }
  58286. }
  58287. }
  58288. function checkFunctionParameterExpression (exp, text, warn, range) {
  58289. try {
  58290. new Function(exp, '');
  58291. } catch (e) {
  58292. warn(
  58293. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  58294. " " + exp + "\n\n" +
  58295. " Raw expression: " + (text.trim()) + "\n",
  58296. range
  58297. );
  58298. }
  58299. }
  58300. /* */
  58301. var range = 2;
  58302. function generateCodeFrame (
  58303. source,
  58304. start,
  58305. end
  58306. ) {
  58307. if ( start === void 0 ) start = 0;
  58308. if ( end === void 0 ) end = source.length;
  58309. var lines = source.split(/\r?\n/);
  58310. var count = 0;
  58311. var res = [];
  58312. for (var i = 0; i < lines.length; i++) {
  58313. count += lines[i].length + 1;
  58314. if (count >= start) {
  58315. for (var j = i - range; j <= i + range || end > count; j++) {
  58316. if (j < 0 || j >= lines.length) { continue }
  58317. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  58318. var lineLength = lines[j].length;
  58319. if (j === i) {
  58320. // push underline
  58321. var pad = start - (count - lineLength) + 1;
  58322. var length = end > count ? lineLength - pad : end - start;
  58323. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  58324. } else if (j > i) {
  58325. if (end > count) {
  58326. var length$1 = Math.min(end - count, lineLength);
  58327. res.push(" | " + repeat$1("^", length$1));
  58328. }
  58329. count += lineLength + 1;
  58330. }
  58331. }
  58332. break
  58333. }
  58334. }
  58335. return res.join('\n')
  58336. }
  58337. function repeat$1 (str, n) {
  58338. var result = '';
  58339. if (n > 0) {
  58340. while (true) { // eslint-disable-line
  58341. if (n & 1) { result += str; }
  58342. n >>>= 1;
  58343. if (n <= 0) { break }
  58344. str += str;
  58345. }
  58346. }
  58347. return result
  58348. }
  58349. /* */
  58350. function createFunction (code, errors) {
  58351. try {
  58352. return new Function(code)
  58353. } catch (err) {
  58354. errors.push({ err: err, code: code });
  58355. return noop
  58356. }
  58357. }
  58358. function createCompileToFunctionFn (compile) {
  58359. var cache = Object.create(null);
  58360. return function compileToFunctions (
  58361. template,
  58362. options,
  58363. vm
  58364. ) {
  58365. options = extend({}, options);
  58366. var warn$$1 = options.warn || warn;
  58367. delete options.warn;
  58368. /* istanbul ignore if */
  58369. {
  58370. // detect possible CSP restriction
  58371. try {
  58372. new Function('return 1');
  58373. } catch (e) {
  58374. if (e.toString().match(/unsafe-eval|CSP/)) {
  58375. warn$$1(
  58376. 'It seems you are using the standalone build of Vue.js in an ' +
  58377. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  58378. 'The template compiler cannot work in this environment. Consider ' +
  58379. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  58380. 'templates into render functions.'
  58381. );
  58382. }
  58383. }
  58384. }
  58385. // check cache
  58386. var key = options.delimiters
  58387. ? String(options.delimiters) + template
  58388. : template;
  58389. if (cache[key]) {
  58390. return cache[key]
  58391. }
  58392. // compile
  58393. var compiled = compile(template, options);
  58394. // check compilation errors/tips
  58395. {
  58396. if (compiled.errors && compiled.errors.length) {
  58397. if (options.outputSourceRange) {
  58398. compiled.errors.forEach(function (e) {
  58399. warn$$1(
  58400. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  58401. generateCodeFrame(template, e.start, e.end),
  58402. vm
  58403. );
  58404. });
  58405. } else {
  58406. warn$$1(
  58407. "Error compiling template:\n\n" + template + "\n\n" +
  58408. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  58409. vm
  58410. );
  58411. }
  58412. }
  58413. if (compiled.tips && compiled.tips.length) {
  58414. if (options.outputSourceRange) {
  58415. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  58416. } else {
  58417. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  58418. }
  58419. }
  58420. }
  58421. // turn code into functions
  58422. var res = {};
  58423. var fnGenErrors = [];
  58424. res.render = createFunction(compiled.render, fnGenErrors);
  58425. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  58426. return createFunction(code, fnGenErrors)
  58427. });
  58428. // check function generation errors.
  58429. // this should only happen if there is a bug in the compiler itself.
  58430. // mostly for codegen development use
  58431. /* istanbul ignore if */
  58432. {
  58433. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  58434. warn$$1(
  58435. "Failed to generate render function:\n\n" +
  58436. fnGenErrors.map(function (ref) {
  58437. var err = ref.err;
  58438. var code = ref.code;
  58439. return ((err.toString()) + " in\n\n" + code + "\n");
  58440. }).join('\n'),
  58441. vm
  58442. );
  58443. }
  58444. }
  58445. return (cache[key] = res)
  58446. }
  58447. }
  58448. /* */
  58449. function createCompilerCreator (baseCompile) {
  58450. return function createCompiler (baseOptions) {
  58451. function compile (
  58452. template,
  58453. options
  58454. ) {
  58455. var finalOptions = Object.create(baseOptions);
  58456. var errors = [];
  58457. var tips = [];
  58458. var warn = function (msg, range, tip) {
  58459. (tip ? tips : errors).push(msg);
  58460. };
  58461. if (options) {
  58462. if (options.outputSourceRange) {
  58463. // $flow-disable-line
  58464. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  58465. warn = function (msg, range, tip) {
  58466. var data = { msg: msg };
  58467. if (range) {
  58468. if (range.start != null) {
  58469. data.start = range.start + leadingSpaceLength;
  58470. }
  58471. if (range.end != null) {
  58472. data.end = range.end + leadingSpaceLength;
  58473. }
  58474. }
  58475. (tip ? tips : errors).push(data);
  58476. };
  58477. }
  58478. // merge custom modules
  58479. if (options.modules) {
  58480. finalOptions.modules =
  58481. (baseOptions.modules || []).concat(options.modules);
  58482. }
  58483. // merge custom directives
  58484. if (options.directives) {
  58485. finalOptions.directives = extend(
  58486. Object.create(baseOptions.directives || null),
  58487. options.directives
  58488. );
  58489. }
  58490. // copy other options
  58491. for (var key in options) {
  58492. if (key !== 'modules' && key !== 'directives') {
  58493. finalOptions[key] = options[key];
  58494. }
  58495. }
  58496. }
  58497. finalOptions.warn = warn;
  58498. var compiled = baseCompile(template.trim(), finalOptions);
  58499. {
  58500. detectErrors(compiled.ast, warn);
  58501. }
  58502. compiled.errors = errors;
  58503. compiled.tips = tips;
  58504. return compiled
  58505. }
  58506. return {
  58507. compile: compile,
  58508. compileToFunctions: createCompileToFunctionFn(compile)
  58509. }
  58510. }
  58511. }
  58512. /* */
  58513. // `createCompilerCreator` allows creating compilers that use alternative
  58514. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  58515. // Here we just export a default compiler using the default parts.
  58516. var createCompiler = createCompilerCreator(function baseCompile (
  58517. template,
  58518. options
  58519. ) {
  58520. var ast = parse(template.trim(), options);
  58521. if (options.optimize !== false) {
  58522. optimize(ast, options);
  58523. }
  58524. var code = generate(ast, options);
  58525. return {
  58526. ast: ast,
  58527. render: code.render,
  58528. staticRenderFns: code.staticRenderFns
  58529. }
  58530. });
  58531. /* */
  58532. var ref$1 = createCompiler(baseOptions);
  58533. var compile = ref$1.compile;
  58534. var compileToFunctions = ref$1.compileToFunctions;
  58535. /* */
  58536. // check whether current browser encodes a char inside attribute values
  58537. var div;
  58538. function getShouldDecode (href) {
  58539. div = div || document.createElement('div');
  58540. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  58541. return div.innerHTML.indexOf('&#10;') > 0
  58542. }
  58543. // #3663: IE encodes newlines inside attribute values while other browsers don't
  58544. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  58545. // #6828: chrome encodes content in a[href]
  58546. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  58547. /* */
  58548. var idToTemplate = cached(function (id) {
  58549. var el = query(id);
  58550. return el && el.innerHTML
  58551. });
  58552. var mount = Vue.prototype.$mount;
  58553. Vue.prototype.$mount = function (
  58554. el,
  58555. hydrating
  58556. ) {
  58557. el = el && query(el);
  58558. /* istanbul ignore if */
  58559. if (el === document.body || el === document.documentElement) {
  58560. warn(
  58561. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  58562. );
  58563. return this
  58564. }
  58565. var options = this.$options;
  58566. // resolve template/el and convert to render function
  58567. if (!options.render) {
  58568. var template = options.template;
  58569. if (template) {
  58570. if (typeof template === 'string') {
  58571. if (template.charAt(0) === '#') {
  58572. template = idToTemplate(template);
  58573. /* istanbul ignore if */
  58574. if (!template) {
  58575. warn(
  58576. ("Template element not found or is empty: " + (options.template)),
  58577. this
  58578. );
  58579. }
  58580. }
  58581. } else if (template.nodeType) {
  58582. template = template.innerHTML;
  58583. } else {
  58584. {
  58585. warn('invalid template option:' + template, this);
  58586. }
  58587. return this
  58588. }
  58589. } else if (el) {
  58590. template = getOuterHTML(el);
  58591. }
  58592. if (template) {
  58593. /* istanbul ignore if */
  58594. if (config.performance && mark) {
  58595. mark('compile');
  58596. }
  58597. var ref = compileToFunctions(template, {
  58598. outputSourceRange: "development" !== 'production',
  58599. shouldDecodeNewlines: shouldDecodeNewlines,
  58600. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  58601. delimiters: options.delimiters,
  58602. comments: options.comments
  58603. }, this);
  58604. var render = ref.render;
  58605. var staticRenderFns = ref.staticRenderFns;
  58606. options.render = render;
  58607. options.staticRenderFns = staticRenderFns;
  58608. /* istanbul ignore if */
  58609. if (config.performance && mark) {
  58610. mark('compile end');
  58611. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  58612. }
  58613. }
  58614. }
  58615. return mount.call(this, el, hydrating)
  58616. };
  58617. /**
  58618. * Get outerHTML of elements, taking care
  58619. * of SVG elements in IE as well.
  58620. */
  58621. function getOuterHTML (el) {
  58622. if (el.outerHTML) {
  58623. return el.outerHTML
  58624. } else {
  58625. var container = document.createElement('div');
  58626. container.appendChild(el.cloneNode(true));
  58627. return container.innerHTML
  58628. }
  58629. }
  58630. Vue.compile = compileToFunctions;
  58631. module.exports = Vue;
  58632. /* 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))
  58633. /***/ }),
  58634. /***/ "./node_modules/vue/dist/vue.common.js":
  58635. /*!*********************************************!*\
  58636. !*** ./node_modules/vue/dist/vue.common.js ***!
  58637. \*********************************************/
  58638. /*! no static exports found */
  58639. /***/ (function(module, exports, __webpack_require__) {
  58640. if (false) {} else {
  58641. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  58642. }
  58643. /***/ }),
  58644. /***/ "./node_modules/webpack/buildin/global.js":
  58645. /*!***********************************!*\
  58646. !*** (webpack)/buildin/global.js ***!
  58647. \***********************************/
  58648. /*! no static exports found */
  58649. /***/ (function(module, exports) {
  58650. var g;
  58651. // This works in non-strict mode
  58652. g = (function() {
  58653. return this;
  58654. })();
  58655. try {
  58656. // This works if eval is allowed (see CSP)
  58657. g = g || new Function("return this")();
  58658. } catch (e) {
  58659. // This works if the window reference is available
  58660. if (typeof window === "object") g = window;
  58661. }
  58662. // g can still be undefined, but nothing to do about it...
  58663. // We return undefined, instead of nothing here, so it's
  58664. // easier to handle this case. if(!global) { ...}
  58665. module.exports = g;
  58666. /***/ }),
  58667. /***/ "./node_modules/webpack/buildin/module.js":
  58668. /*!***********************************!*\
  58669. !*** (webpack)/buildin/module.js ***!
  58670. \***********************************/
  58671. /*! no static exports found */
  58672. /***/ (function(module, exports) {
  58673. module.exports = function(module) {
  58674. if (!module.webpackPolyfill) {
  58675. module.deprecate = function() {};
  58676. module.paths = [];
  58677. // module.parent = undefined by default
  58678. if (!module.children) module.children = [];
  58679. Object.defineProperty(module, "loaded", {
  58680. enumerable: true,
  58681. get: function() {
  58682. return module.l;
  58683. }
  58684. });
  58685. Object.defineProperty(module, "id", {
  58686. enumerable: true,
  58687. get: function() {
  58688. return module.i;
  58689. }
  58690. });
  58691. module.webpackPolyfill = 1;
  58692. }
  58693. return module;
  58694. };
  58695. /***/ }),
  58696. /***/ "./resources/js/app.js":
  58697. /*!*****************************!*\
  58698. !*** ./resources/js/app.js ***!
  58699. \*****************************/
  58700. /*! no exports provided */
  58701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58702. "use strict";
  58703. __webpack_require__.r(__webpack_exports__);
  58704. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  58705. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  58706. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  58707. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  58708. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  58709. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  58710. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  58711. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  58712. /**
  58713. * First we will load all of this project's JavaScript dependencies which
  58714. * includes Vue and other libraries. It is a great starting point when
  58715. * building robust, powerful web applications using Vue and Laravel.
  58716. */
  58717. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  58718. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  58719. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  58720. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  58721. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  58722. mode: 'history',
  58723. routes: [{
  58724. path: '/',
  58725. name: 'home',
  58726. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  58727. }, {
  58728. path: '/login',
  58729. name: 'login',
  58730. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  58731. }, {
  58732. path: '/dashboard',
  58733. name: 'dashboard',
  58734. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  58735. }, {
  58736. path: '/workorders/:id',
  58737. name: 'workorders',
  58738. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  58739. props: true
  58740. }]
  58741. });
  58742. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  58743. el: '#app',
  58744. components: {
  58745. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  58746. },
  58747. router: router
  58748. });
  58749. $(function () {
  58750. $('[data-toggle="tooltip"]').tooltip();
  58751. });
  58752. var clipboard = new Clipboard('.btn-clip');
  58753. clipboard.on('success', function (e) {
  58754. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  58755. position: "right",
  58756. className: 'success'
  58757. });
  58758. e.clearSelection();
  58759. });
  58760. /***/ }),
  58761. /***/ "./resources/js/bootstrap.js":
  58762. /*!***********************************!*\
  58763. !*** ./resources/js/bootstrap.js ***!
  58764. \***********************************/
  58765. /*! no exports provided */
  58766. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58767. "use strict";
  58768. __webpack_require__.r(__webpack_exports__);
  58769. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  58770. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  58771. /**
  58772. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  58773. * for JavaScript based Bootstrap features such as modals and tabs. This
  58774. * code may be modified to fit the specific needs of your application.
  58775. */
  58776. try {
  58777. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  58778. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  58779. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  58780. } catch (e) {}
  58781. /**
  58782. * We'll load the axios HTTP library which allows us to easily issue requests
  58783. * to our Laravel back-end. This library automatically handles sending the
  58784. * CSRF token as a header based on the value of the "XSRF" token cookie.
  58785. */
  58786. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  58787. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  58788. /**
  58789. * Echo exposes an expressive API for subscribing to channels and listening
  58790. * for events that are broadcast by Laravel. Echo and event broadcasting
  58791. * allows your team to easily build robust real-time web applications.
  58792. */
  58793. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  58794. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  58795. broadcaster: 'pusher',
  58796. key: "upccrt",
  58797. authEndpoint: '/broadcasting/auth',
  58798. wsHost: window.location.hostname,
  58799. wsPort: 6001,
  58800. disableStats: true
  58801. });
  58802. /***/ }),
  58803. /***/ "./resources/js/components/AssetInfo.vue":
  58804. /*!***********************************************!*\
  58805. !*** ./resources/js/components/AssetInfo.vue ***!
  58806. \***********************************************/
  58807. /*! exports provided: default */
  58808. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58809. "use strict";
  58810. __webpack_require__.r(__webpack_exports__);
  58811. /* 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&");
  58812. /* 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&");
  58813. /* 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");
  58814. /* normalize component */
  58815. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58816. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58817. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  58818. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58819. false,
  58820. null,
  58821. null,
  58822. null
  58823. )
  58824. /* hot reload */
  58825. if (false) { var api; }
  58826. component.options.__file = "resources/js/components/AssetInfo.vue"
  58827. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58828. /***/ }),
  58829. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  58830. /*!************************************************************************!*\
  58831. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  58832. \************************************************************************/
  58833. /*! exports provided: default */
  58834. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58835. "use strict";
  58836. __webpack_require__.r(__webpack_exports__);
  58837. /* 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&");
  58838. /* 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"]);
  58839. /***/ }),
  58840. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  58841. /*!******************************************************************************!*\
  58842. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  58843. \******************************************************************************/
  58844. /*! exports provided: render, staticRenderFns */
  58845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58846. "use strict";
  58847. __webpack_require__.r(__webpack_exports__);
  58848. /* 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&");
  58849. /* 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"]; });
  58850. /* 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"]; });
  58851. /***/ }),
  58852. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  58853. /*!********************************************************!*\
  58854. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  58855. \********************************************************/
  58856. /*! exports provided: default */
  58857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58858. "use strict";
  58859. __webpack_require__.r(__webpack_exports__);
  58860. /* 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&");
  58861. /* 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&");
  58862. /* 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");
  58863. /* normalize component */
  58864. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58865. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58866. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  58867. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58868. false,
  58869. null,
  58870. null,
  58871. null
  58872. )
  58873. /* hot reload */
  58874. if (false) { var api; }
  58875. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  58876. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58877. /***/ }),
  58878. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  58879. /*!*********************************************************************************!*\
  58880. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  58881. \*********************************************************************************/
  58882. /*! exports provided: default */
  58883. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58884. "use strict";
  58885. __webpack_require__.r(__webpack_exports__);
  58886. /* 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&");
  58887. /* 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"]);
  58888. /***/ }),
  58889. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  58890. /*!***************************************************************************************!*\
  58891. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  58892. \***************************************************************************************/
  58893. /*! exports provided: render, staticRenderFns */
  58894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58895. "use strict";
  58896. __webpack_require__.r(__webpack_exports__);
  58897. /* 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&");
  58898. /* 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"]; });
  58899. /* 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"]; });
  58900. /***/ }),
  58901. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  58902. /*!****************************************************************!*\
  58903. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  58904. \****************************************************************/
  58905. /*! exports provided: default */
  58906. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58907. "use strict";
  58908. __webpack_require__.r(__webpack_exports__);
  58909. /* 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&");
  58910. /* 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&");
  58911. /* 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");
  58912. /* normalize component */
  58913. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58914. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58915. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  58916. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58917. false,
  58918. null,
  58919. null,
  58920. null
  58921. )
  58922. /* hot reload */
  58923. if (false) { var api; }
  58924. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  58925. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58926. /***/ }),
  58927. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  58928. /*!*****************************************************************************************!*\
  58929. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  58930. \*****************************************************************************************/
  58931. /*! exports provided: default */
  58932. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58933. "use strict";
  58934. __webpack_require__.r(__webpack_exports__);
  58935. /* 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&");
  58936. /* 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"]);
  58937. /***/ }),
  58938. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  58939. /*!***********************************************************************************************!*\
  58940. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  58941. \***********************************************************************************************/
  58942. /*! exports provided: render, staticRenderFns */
  58943. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58944. "use strict";
  58945. __webpack_require__.r(__webpack_exports__);
  58946. /* 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&");
  58947. /* 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"]; });
  58948. /* 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"]; });
  58949. /***/ }),
  58950. /***/ "./resources/js/components/CircleSpinner.vue":
  58951. /*!***************************************************!*\
  58952. !*** ./resources/js/components/CircleSpinner.vue ***!
  58953. \***************************************************/
  58954. /*! no static exports found */
  58955. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58956. "use strict";
  58957. __webpack_require__.r(__webpack_exports__);
  58958. /* 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&");
  58959. /* 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&");
  58960. /* 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__));
  58961. /* 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&");
  58962. /* 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");
  58963. /* normalize component */
  58964. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  58965. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58966. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  58967. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58968. false,
  58969. null,
  58970. "9a543b64",
  58971. null
  58972. )
  58973. /* hot reload */
  58974. if (false) { var api; }
  58975. component.options.__file = "resources/js/components/CircleSpinner.vue"
  58976. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58977. /***/ }),
  58978. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  58979. /*!****************************************************************************!*\
  58980. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  58981. \****************************************************************************/
  58982. /*! no static exports found */
  58983. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58984. "use strict";
  58985. __webpack_require__.r(__webpack_exports__);
  58986. /* 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&");
  58987. /* 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"]);
  58988. /***/ }),
  58989. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  58990. /*!************************************************************************************************************!*\
  58991. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  58992. \************************************************************************************************************/
  58993. /*! no static exports found */
  58994. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58995. "use strict";
  58996. __webpack_require__.r(__webpack_exports__);
  58997. /* 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&");
  58998. /* 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__);
  58999. /* 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__));
  59000. /* 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);
  59001. /***/ }),
  59002. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  59003. /*!**********************************************************************************************!*\
  59004. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  59005. \**********************************************************************************************/
  59006. /*! exports provided: render, staticRenderFns */
  59007. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59008. "use strict";
  59009. __webpack_require__.r(__webpack_exports__);
  59010. /* 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&");
  59011. /* 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"]; });
  59012. /* 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"]; });
  59013. /***/ }),
  59014. /***/ "./resources/js/components/Modal.vue":
  59015. /*!*******************************************!*\
  59016. !*** ./resources/js/components/Modal.vue ***!
  59017. \*******************************************/
  59018. /*! exports provided: default */
  59019. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59020. "use strict";
  59021. __webpack_require__.r(__webpack_exports__);
  59022. /* 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&");
  59023. /* 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");
  59024. var script = {}
  59025. /* normalize component */
  59026. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  59027. script,
  59028. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59029. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59030. false,
  59031. null,
  59032. null,
  59033. null
  59034. )
  59035. /* hot reload */
  59036. if (false) { var api; }
  59037. component.options.__file = "resources/js/components/Modal.vue"
  59038. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59039. /***/ }),
  59040. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  59041. /*!**************************************************************************!*\
  59042. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  59043. \**************************************************************************/
  59044. /*! exports provided: render, staticRenderFns */
  59045. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59046. "use strict";
  59047. __webpack_require__.r(__webpack_exports__);
  59048. /* 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&");
  59049. /* 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"]; });
  59050. /* 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"]; });
  59051. /***/ }),
  59052. /***/ "./resources/js/components/WoInfoEditModal.vue":
  59053. /*!*****************************************************!*\
  59054. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  59055. \*****************************************************/
  59056. /*! exports provided: default */
  59057. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59058. "use strict";
  59059. __webpack_require__.r(__webpack_exports__);
  59060. /* 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&");
  59061. /* 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&");
  59062. /* 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");
  59063. /* normalize component */
  59064. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59065. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59066. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59067. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59068. false,
  59069. null,
  59070. null,
  59071. null
  59072. )
  59073. /* hot reload */
  59074. if (false) { var api; }
  59075. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  59076. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59077. /***/ }),
  59078. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  59079. /*!******************************************************************************!*\
  59080. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  59081. \******************************************************************************/
  59082. /*! exports provided: default */
  59083. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59084. "use strict";
  59085. __webpack_require__.r(__webpack_exports__);
  59086. /* 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&");
  59087. /* 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"]);
  59088. /***/ }),
  59089. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  59090. /*!************************************************************************************!*\
  59091. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  59092. \************************************************************************************/
  59093. /*! exports provided: render, staticRenderFns */
  59094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59095. "use strict";
  59096. __webpack_require__.r(__webpack_exports__);
  59097. /* 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&");
  59098. /* 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"]; });
  59099. /* 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"]; });
  59100. /***/ }),
  59101. /***/ "./resources/js/components/WorkOrderInfo.vue":
  59102. /*!***************************************************!*\
  59103. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  59104. \***************************************************/
  59105. /*! exports provided: default */
  59106. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59107. "use strict";
  59108. __webpack_require__.r(__webpack_exports__);
  59109. /* 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&");
  59110. /* 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&");
  59111. /* 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");
  59112. /* normalize component */
  59113. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59114. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59115. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  59116. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59117. false,
  59118. null,
  59119. null,
  59120. null
  59121. )
  59122. /* hot reload */
  59123. if (false) { var api; }
  59124. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  59125. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59126. /***/ }),
  59127. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  59128. /*!****************************************************************************!*\
  59129. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  59130. \****************************************************************************/
  59131. /*! exports provided: default */
  59132. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59133. "use strict";
  59134. __webpack_require__.r(__webpack_exports__);
  59135. /* 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&");
  59136. /* 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"]);
  59137. /***/ }),
  59138. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  59139. /*!**********************************************************************************!*\
  59140. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  59141. \**********************************************************************************/
  59142. /*! exports provided: render, staticRenderFns */
  59143. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59144. "use strict";
  59145. __webpack_require__.r(__webpack_exports__);
  59146. /* 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&");
  59147. /* 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"]; });
  59148. /* 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"]; });
  59149. /***/ }),
  59150. /***/ "./resources/js/mixins/dateMixin.js":
  59151. /*!******************************************!*\
  59152. !*** ./resources/js/mixins/dateMixin.js ***!
  59153. \******************************************/
  59154. /*! exports provided: default */
  59155. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59156. "use strict";
  59157. __webpack_require__.r(__webpack_exports__);
  59158. /* harmony default export */ __webpack_exports__["default"] = ({
  59159. methods: {
  59160. treatAsUTC: function treatAsUTC(date) {
  59161. var result = new Date(date);
  59162. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  59163. return result;
  59164. },
  59165. daysSinceToday: function daysSinceToday(date) {
  59166. var currentDate = new Date();
  59167. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  59168. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  59169. },
  59170. getHRDate: function getHRDate(dateString) {
  59171. var date = new Date(dateString);
  59172. return date.toLocaleString('default', {
  59173. month: 'short',
  59174. day: 'numeric',
  59175. year: 'numeric',
  59176. hour: 'numeric',
  59177. minute: 'numeric'
  59178. });
  59179. },
  59180. isZero: function isZero(dateString) {
  59181. return dateString === '0000-00-00 00:00:00';
  59182. }
  59183. }
  59184. });
  59185. /***/ }),
  59186. /***/ "./resources/js/notify.min.js":
  59187. /*!************************************!*\
  59188. !*** ./resources/js/notify.min.js ***!
  59189. \************************************/
  59190. /*! no static exports found */
  59191. /***/ (function(module, exports, __webpack_require__) {
  59192. 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); }
  59193. (function (e) {
  59194. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  59195. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  59196. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  59197. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  59198. })(function (e) {
  59199. function A(t, n, i) {
  59200. typeof i == "string" && (i = {
  59201. className: i
  59202. }), 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);
  59203. }
  59204. var t = [].indexOf || function (e) {
  59205. for (var t = 0, n = this.length; t < n; t++) {
  59206. if (t in this && this[t] === e) return t;
  59207. }
  59208. return -1;
  59209. },
  59210. n = "notify",
  59211. r = n + "js",
  59212. i = n + "!blank",
  59213. s = {
  59214. t: "top",
  59215. m: "middle",
  59216. b: "bottom",
  59217. l: "left",
  59218. c: "center",
  59219. r: "right"
  59220. },
  59221. o = ["l", "c", "r"],
  59222. u = ["t", "m", "b"],
  59223. a = ["t", "b", "l", "r"],
  59224. f = {
  59225. t: "b",
  59226. m: null,
  59227. b: "t",
  59228. l: "r",
  59229. c: null,
  59230. r: "l"
  59231. },
  59232. l = function l(t) {
  59233. var n;
  59234. return n = [], e.each(t.split(/\W+/), function (e, t) {
  59235. var r;
  59236. r = t.toLowerCase().charAt(0);
  59237. if (s[r]) return n.push(r);
  59238. }), n;
  59239. },
  59240. c = {},
  59241. h = {
  59242. name: "core",
  59243. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  59244. 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}"
  59245. },
  59246. p = {
  59247. "border-radius": ["-webkit-", "-moz-"]
  59248. },
  59249. d = function d(e) {
  59250. return c[e];
  59251. },
  59252. v = function v(e) {
  59253. if (!e) throw "Missing Style name";
  59254. c[e] && delete c[e];
  59255. },
  59256. m = function m(t, i) {
  59257. if (!t) throw "Missing Style name";
  59258. if (!i) throw "Missing Style definition";
  59259. if (!i.html) throw "Missing Style HTML";
  59260. var s = c[t];
  59261. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  59262. var o = "";
  59263. i.classes && e.each(i.classes, function (t, n) {
  59264. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  59265. return p[t] && e.each(p[t], function (e, r) {
  59266. return o += " " + r + t + ": " + n + ";\n";
  59267. }), o += " " + t + ": " + n + ";\n";
  59268. }), o += "}\n";
  59269. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  59270. var u = {},
  59271. a = e(i.html);
  59272. y("html", a, u), y("text", a, u), i.fields = u;
  59273. },
  59274. g = function g(t) {
  59275. var n, r, i;
  59276. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  59277. try {
  59278. r.html(t);
  59279. } catch (s) {
  59280. r[0].styleSheet.cssText = t;
  59281. }
  59282. return r;
  59283. },
  59284. y = function y(t, n, r) {
  59285. var s;
  59286. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  59287. var n;
  59288. n = e(this).attr(s), n || (n = i), r[n] = t;
  59289. });
  59290. },
  59291. b = function b(e, t) {
  59292. return e.is(t) ? e : e.find(t);
  59293. },
  59294. w = {
  59295. clickToHide: !0,
  59296. autoHide: !0,
  59297. autoHideDelay: 5e3,
  59298. arrowShow: !0,
  59299. arrowSize: 5,
  59300. breakNewLines: !0,
  59301. elementPosition: "bottom",
  59302. globalPosition: "top right",
  59303. style: "bootstrap",
  59304. className: "error",
  59305. showAnimation: "slideDown",
  59306. showDuration: 400,
  59307. hideAnimation: "slideUp",
  59308. hideDuration: 200,
  59309. gap: 5
  59310. },
  59311. E = function E(t, n) {
  59312. var r;
  59313. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  59314. },
  59315. S = function S(t) {
  59316. return e.extend(w, t);
  59317. },
  59318. x = function x(t) {
  59319. return e("<" + t + "></" + t + ">");
  59320. },
  59321. T = {},
  59322. N = function N(t) {
  59323. var n;
  59324. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  59325. return e(r).attr("name") === t.attr("name");
  59326. }), t = n.first()), t;
  59327. },
  59328. C = function C(e, t, n) {
  59329. var r, i;
  59330. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  59331. if (isNaN(n)) return;
  59332. 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;
  59333. },
  59334. k = function k(e, t, n) {
  59335. if (e === "l" || e === "t") return 0;
  59336. if (e === "c" || e === "m") return n / 2 - t / 2;
  59337. if (e === "r" || e === "b") return n - t;
  59338. throw "Invalid alignment";
  59339. },
  59340. L = function L(e) {
  59341. return L.e = L.e || x("div"), L.e.text(e).html();
  59342. };
  59343. A.prototype.loadHTML = function () {
  59344. var t;
  59345. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  59346. }, A.prototype.show = function (e, t) {
  59347. var n, r, i, s, o;
  59348. r = function (n) {
  59349. return function () {
  59350. !e && !n.elem && n.destroy();
  59351. if (t) return t();
  59352. };
  59353. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  59354. 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 {
  59355. if (!!o || !!e) return r();
  59356. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  59357. }
  59358. return n.push(r), i[s].apply(i, n);
  59359. }, A.prototype.setGlobalPosition = function () {
  59360. var t = this.getPosition(),
  59361. n = t[0],
  59362. i = t[1],
  59363. o = s[n],
  59364. u = s[i],
  59365. a = n + "|" + i,
  59366. f = T[a];
  59367. if (!f || !document.body.contains(f[0])) {
  59368. f = T[a] = x("div");
  59369. var l = {};
  59370. 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);
  59371. }
  59372. return f.prepend(this.wrapper);
  59373. }, A.prototype.setElementPosition = function () {
  59374. 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;
  59375. 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"];
  59376. for (w = 0, S = B.length; w < S; w++) {
  59377. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  59378. }
  59379. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  59380. if (!this.options.arrowShow) this.arrow.hide();else {
  59381. 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";
  59382. for (E = 0, x = a.length; E < x; E++) {
  59383. D = a[E], P = s[D];
  59384. if (D === L) continue;
  59385. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  59386. }
  59387. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  59388. }
  59389. 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);
  59390. if (r) return this.arrow.removeAttr("style").css(r);
  59391. }, A.prototype.getPosition = function () {
  59392. var e, n, r, i, s, f, c, h;
  59393. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  59394. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  59395. 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";
  59396. return e.length === 2 && (e[2] = e[1]), e;
  59397. }, A.prototype.getStyle = function (e) {
  59398. var t;
  59399. e || (e = this.options.style), e || (e = "default"), t = c[e];
  59400. if (!t) throw "Missing style: " + e;
  59401. return t;
  59402. }, A.prototype.updateClasses = function () {
  59403. var t, n;
  59404. 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) {
  59405. return r + "-" + n.name + "-" + e;
  59406. }).join(" "), this.userContainer.attr("class", t);
  59407. }, A.prototype.run = function (t, n) {
  59408. var r, s, o, u, a;
  59409. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  59410. if (this.container && !t) {
  59411. this.show(!1);
  59412. return;
  59413. }
  59414. if (!this.container && !t) return;
  59415. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  59416. for (o in s) {
  59417. r = s[o], u = this.userFields[o];
  59418. if (!u) continue;
  59419. 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);
  59420. }
  59421. 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));
  59422. }, A.prototype.destroy = function () {
  59423. this.wrapper.data(r, null), this.wrapper.remove();
  59424. }, e[n] = function (t, r, i) {
  59425. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  59426. }, e.fn[n] = function (t, n) {
  59427. return e(this).each(function () {
  59428. var i = N(e(this)).data(r);
  59429. i && i.destroy();
  59430. var s = new A(e(this), t, n);
  59431. }), this;
  59432. }, e.extend(e[n], {
  59433. defaults: S,
  59434. addStyle: m,
  59435. removeStyle: v,
  59436. pluginOptions: w,
  59437. getStyle: d,
  59438. insertCSS: g
  59439. }), m("bootstrap", {
  59440. html: "<div>\n<span data-notify-text></span>\n</div>",
  59441. classes: {
  59442. base: {
  59443. "font-weight": "bold",
  59444. padding: "8px 15px 8px 14px",
  59445. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  59446. "background-color": "#fcf8e3",
  59447. border: "1px solid #fbeed5",
  59448. "border-radius": "4px",
  59449. "white-space": "nowrap",
  59450. "padding-left": "25px",
  59451. "background-repeat": "no-repeat",
  59452. "background-position": "3px 7px"
  59453. },
  59454. error: {
  59455. color: "#B94A48",
  59456. "background-color": "#F2DEDE",
  59457. "border-color": "#EED3D7",
  59458. "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=)"
  59459. },
  59460. success: {
  59461. color: "#468847",
  59462. "background-color": "#DFF0D8",
  59463. "border-color": "#D6E9C6",
  59464. "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==)"
  59465. },
  59466. info: {
  59467. color: "#3A87AD",
  59468. "background-color": "#D9EDF7",
  59469. "border-color": "#BCE8F1",
  59470. "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=)"
  59471. },
  59472. warn: {
  59473. color: "#C09853",
  59474. "background-color": "#FCF8E3",
  59475. "border-color": "#FBEED5",
  59476. "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)"
  59477. }
  59478. }
  59479. }), e(function () {
  59480. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  59481. e(this).trigger("notify-hide");
  59482. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  59483. var n = e(this).data(r);
  59484. n && n.show(!1);
  59485. });
  59486. });
  59487. });
  59488. /***/ }),
  59489. /***/ "./resources/js/views/App.vue":
  59490. /*!************************************!*\
  59491. !*** ./resources/js/views/App.vue ***!
  59492. \************************************/
  59493. /*! exports provided: default */
  59494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59495. "use strict";
  59496. __webpack_require__.r(__webpack_exports__);
  59497. /* 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&");
  59498. /* 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&");
  59499. /* 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");
  59500. /* normalize component */
  59501. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59502. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59503. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  59504. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59505. false,
  59506. null,
  59507. null,
  59508. null
  59509. )
  59510. /* hot reload */
  59511. if (false) { var api; }
  59512. component.options.__file = "resources/js/views/App.vue"
  59513. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59514. /***/ }),
  59515. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  59516. /*!*************************************************************!*\
  59517. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  59518. \*************************************************************/
  59519. /*! exports provided: default */
  59520. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59521. "use strict";
  59522. __webpack_require__.r(__webpack_exports__);
  59523. /* 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&");
  59524. /* 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"]);
  59525. /***/ }),
  59526. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  59527. /*!*******************************************************************!*\
  59528. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  59529. \*******************************************************************/
  59530. /*! exports provided: render, staticRenderFns */
  59531. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59532. "use strict";
  59533. __webpack_require__.r(__webpack_exports__);
  59534. /* 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&");
  59535. /* 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"]; });
  59536. /* 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"]; });
  59537. /***/ }),
  59538. /***/ "./resources/js/views/Dashboard.vue":
  59539. /*!******************************************!*\
  59540. !*** ./resources/js/views/Dashboard.vue ***!
  59541. \******************************************/
  59542. /*! exports provided: default */
  59543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59544. "use strict";
  59545. __webpack_require__.r(__webpack_exports__);
  59546. /* 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&");
  59547. /* 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&");
  59548. /* 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");
  59549. /* normalize component */
  59550. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59551. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59552. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  59553. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59554. false,
  59555. null,
  59556. null,
  59557. null
  59558. )
  59559. /* hot reload */
  59560. if (false) { var api; }
  59561. component.options.__file = "resources/js/views/Dashboard.vue"
  59562. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59563. /***/ }),
  59564. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  59565. /*!*******************************************************************!*\
  59566. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  59567. \*******************************************************************/
  59568. /*! exports provided: default */
  59569. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59570. "use strict";
  59571. __webpack_require__.r(__webpack_exports__);
  59572. /* 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&");
  59573. /* 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"]);
  59574. /***/ }),
  59575. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  59576. /*!*************************************************************************!*\
  59577. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  59578. \*************************************************************************/
  59579. /*! exports provided: render, staticRenderFns */
  59580. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59581. "use strict";
  59582. __webpack_require__.r(__webpack_exports__);
  59583. /* 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&");
  59584. /* 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"]; });
  59585. /* 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"]; });
  59586. /***/ }),
  59587. /***/ "./resources/js/views/Login.vue":
  59588. /*!**************************************!*\
  59589. !*** ./resources/js/views/Login.vue ***!
  59590. \**************************************/
  59591. /*! exports provided: default */
  59592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59593. "use strict";
  59594. __webpack_require__.r(__webpack_exports__);
  59595. /* 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&");
  59596. /* 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&");
  59597. /* 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");
  59598. /* normalize component */
  59599. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59600. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59601. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  59602. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59603. false,
  59604. null,
  59605. null,
  59606. null
  59607. )
  59608. /* hot reload */
  59609. if (false) { var api; }
  59610. component.options.__file = "resources/js/views/Login.vue"
  59611. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59612. /***/ }),
  59613. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  59614. /*!***************************************************************!*\
  59615. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  59616. \***************************************************************/
  59617. /*! exports provided: default */
  59618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59619. "use strict";
  59620. __webpack_require__.r(__webpack_exports__);
  59621. /* 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&");
  59622. /* 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"]);
  59623. /***/ }),
  59624. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  59625. /*!*********************************************************************!*\
  59626. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  59627. \*********************************************************************/
  59628. /*! exports provided: render, staticRenderFns */
  59629. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59630. "use strict";
  59631. __webpack_require__.r(__webpack_exports__);
  59632. /* 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&");
  59633. /* 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"]; });
  59634. /* 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"]; });
  59635. /***/ }),
  59636. /***/ "./resources/js/views/Welcome.vue":
  59637. /*!****************************************!*\
  59638. !*** ./resources/js/views/Welcome.vue ***!
  59639. \****************************************/
  59640. /*! exports provided: default */
  59641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59642. "use strict";
  59643. __webpack_require__.r(__webpack_exports__);
  59644. /* 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&");
  59645. /* 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&");
  59646. /* 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&");
  59647. /* 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");
  59648. /* normalize component */
  59649. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  59650. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59651. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  59652. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59653. false,
  59654. null,
  59655. "1ae8ae93",
  59656. null
  59657. )
  59658. /* hot reload */
  59659. if (false) { var api; }
  59660. component.options.__file = "resources/js/views/Welcome.vue"
  59661. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59662. /***/ }),
  59663. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  59664. /*!*****************************************************************!*\
  59665. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  59666. \*****************************************************************/
  59667. /*! exports provided: default */
  59668. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59669. "use strict";
  59670. __webpack_require__.r(__webpack_exports__);
  59671. /* 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&");
  59672. /* 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"]);
  59673. /***/ }),
  59674. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  59675. /*!*************************************************************************************************!*\
  59676. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  59677. \*************************************************************************************************/
  59678. /*! no static exports found */
  59679. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59680. "use strict";
  59681. __webpack_require__.r(__webpack_exports__);
  59682. /* 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&");
  59683. /* 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__);
  59684. /* 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__));
  59685. /* 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);
  59686. /***/ }),
  59687. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  59688. /*!***********************************************************************************!*\
  59689. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  59690. \***********************************************************************************/
  59691. /*! exports provided: render, staticRenderFns */
  59692. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59693. "use strict";
  59694. __webpack_require__.r(__webpack_exports__);
  59695. /* 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&");
  59696. /* 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"]; });
  59697. /* 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"]; });
  59698. /***/ }),
  59699. /***/ "./resources/js/views/WorkOrder.vue":
  59700. /*!******************************************!*\
  59701. !*** ./resources/js/views/WorkOrder.vue ***!
  59702. \******************************************/
  59703. /*! exports provided: default */
  59704. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59705. "use strict";
  59706. __webpack_require__.r(__webpack_exports__);
  59707. /* 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&");
  59708. /* 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&");
  59709. /* 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");
  59710. /* normalize component */
  59711. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59712. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59713. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  59714. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59715. false,
  59716. null,
  59717. null,
  59718. null
  59719. )
  59720. /* hot reload */
  59721. if (false) { var api; }
  59722. component.options.__file = "resources/js/views/WorkOrder.vue"
  59723. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59724. /***/ }),
  59725. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  59726. /*!*******************************************************************!*\
  59727. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  59728. \*******************************************************************/
  59729. /*! exports provided: default */
  59730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59731. "use strict";
  59732. __webpack_require__.r(__webpack_exports__);
  59733. /* 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&");
  59734. /* 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"]);
  59735. /***/ }),
  59736. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  59737. /*!*************************************************************************!*\
  59738. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  59739. \*************************************************************************/
  59740. /*! exports provided: render, staticRenderFns */
  59741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59742. "use strict";
  59743. __webpack_require__.r(__webpack_exports__);
  59744. /* 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&");
  59745. /* 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"]; });
  59746. /* 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"]; });
  59747. /***/ }),
  59748. /***/ "./resources/sass/app.scss":
  59749. /*!*********************************!*\
  59750. !*** ./resources/sass/app.scss ***!
  59751. \*********************************/
  59752. /*! no static exports found */
  59753. /***/ (function(module, exports) {
  59754. // removed by extract-text-webpack-plugin
  59755. /***/ }),
  59756. /***/ 0:
  59757. /*!*************************************************************!*\
  59758. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  59759. \*************************************************************/
  59760. /*! no static exports found */
  59761. /***/ (function(module, exports, __webpack_require__) {
  59762. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  59763. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  59764. /***/ })
  59765. /******/ });